Loading several samples from a file simulink - buffer

I have a problem loading samples using the "from file" block in Simulink. I have a matrix with 68 channels and 500 samples for each channel, and before this sample goes into the processing blocks,I want to make load all of them so the matrix ends up having the dimensions 68 x 500 .
Since simulink loads the samples incrementally, is there a way i can store the samples until all of them have been loaded? I have tried with a buffer but its not working for me. Thanks in advance!
Ernest

Related

How can I resample an audio file programatically in swift?

I would like to know if it's possible to resample an already written AVAudioFile.
All the references that I found don't work on this particular problem, since:
They propose the resampling while the user is recording an AVAudioFile, while installTap is running. In this approach, the AVAudioConverter works in each buffer chunk given by the inputNode and appends it in the AVAudioFile. [1] [2]
The point is that I would like to resample my audio file regardless of the recording process.
The harder approach would be to upsample the signal by a L factor and applying decimation by a factor of M, using vDSP:
Audio on Compact Disc has a sampling rate of 44.1 kHz; to transfer it to a digital medium that uses 48 kHz, method 1 above can be used with L = 160, M = 147 (since 48000/44100 = 160/147). For the reverse conversion, the values of L and M are swapped. Per above, in both cases, the low-pass filter should be set to 22.05 kHz. [3]
The last one obviously seems like a too hard coded way to solve it. I hope there's a way to resample it with AVAudioConverter, but it lacks documentation :(

Face Recognition Prediction problem on real time streaming videos

For Face Recognition I am using KNN based approach as per link
Training dataset
Bollywood Actors: Total Actors 50 and for each actor 100 images are
there
Bollywood Actress: Total Actress 50 and for each actor 100 images
are there
For Testing this model I am using Real time Youtube Videos and link of one of the video
With correct detection large number of misclassifications are also coming and as video length increases misclassifications are also increasing
Result of Above video
Correct detection
Boman_Irani
Amitabh_Bachchan
Incorrect detection
Sridevi
Virender _Sehwag
Nishant _Chaturvedi
Mausam _Khatri
Uttam _Kumar
IS THERE ANY WAY TO REDUCE/REMOVE THIS WRONG DETECTION
Update:
I've tried these two examples.
https://github.com/ageitgey/face_recognition/blob/master/examples/face_recognition_knn.py
https://github.com/davidsandberg/facenet

Image Preprocessing in Machine Learning

So i recently took a very deep dive into machine learning using keras and tensorflow. I have been working on a dataset for skin cancer detection, i have all the images in a separate folder, and together with it came two separate csv files :hmnist_8_8_L( has 64 columns which i guess is a 8 by 8 pixel representation) and hmnist_8_8_RGB(has 194 columns that i dont know how they got).
My worry is that perhaps i didn't get a clear understanding of how this two files were arrived at? how did the hmnist_8_8_RGB.csv get the 194 columns out of a single image?
Looking into the data (https://www.kaggle.com/kmader/skin-cancer-mnist-ham10000#hmnist_8_8_RGB.csv) i see that the file contains 192 pixel columns and the label.
So the columns in your hmnist_8_8_RGB.csv should be 193 and not 194.
Since the images used for this file are in RGB scale you have 8x8x3 =192 ( pixels x pixels x color channels). The last column is the label category.
Please pay attention that also in the file hmnist_8_8_L the last column is dedicated to the label.
As marginal note, in future try to give more context in your question. Ad example a link to the dataset would have been appreciated

Training on a big set of high-res pictures with turicreate out of memory

I'm trying to use Turicreate to train a model on some 150 pictures that are pretty high-res (4Mb each, 3000X5000).
I'm running
model = tc.object_detector.create(train_data, max_iterations=10)
and after a while I'm getting and 'low virtual memory' warning and right after my computer gets stuck.
I was wondering what's the best practice here to be able to train on such a batch of pictures.
Full code that I'm using:
import turicreate as tc
data = tc.SFrame('annotations.sframe')
train_data, test_data = data.random_split(0.8)
model = tc.object_detector.create(train_data, max_iterations=10)
predictions = model.predict(test_data)
metrics = model.evaluate(test_data)
model.save('mymodel.model')
model.export_coreml('MyCustomObjectDetector.mlmodel')
Normally you'd want to reduce the batch size, i.e. how large of a portion of the training data is used for one iteration. Apparently that's not easy to tweak yet in Turicreate, so it looks like the program is using the full dataset for one epoch. Ideally you'd want to use a smaller portion, for example 32 or 64 images. There's some discussion about the topic on Github, and apparently batch size as a public parameter might be coming in some future release.
3000 x 5000 is also fairly large for this kind of work. You will probably want to downsize the images, i.e. by using bicubic interpolation implemented in for example Scipy. Depending on the kind of images you are working on even a factor of 10 along each dimension might not be too much shrinkage.
Reduce the size of the data set images for example to (width: 400 height: 300), and bump up max_iterations to at least 1000.

MATLAB - Trouble of converting training data to spectrogram

I am a student and new to signal processing just few months ago. I picked "A Novel Fuzzy Approach to Speech Recognition" for my project (you can google for the downloadable version).
I am a little stuck in converting the training data into a spectrogram which has been passed through a mel-filter.
I use this for my mel-filterbank, with a little modification of course.
Then I wrote this simple code to make the spectrogram of my training data:
p =25;
fl =0.0;
fh =0.5;
w ='hty';
[a,fs]=wavread('a.wav'); %you can simply record a sound and name it a.wav, other param will follows
n=length(a)+1;
fa=rfft(a);
xa=melbank_me(p,n,fs); %the mel-filterbank function
za=log(xa*abs(fa).^2);
ca=dct(za);
spectrogram(ca(:,1))
All I got is just like this which is not like the paper say::
Please let me know that either my code or the spectrogram I have was right. if so, what do I have to do to make my spectrogram like the paper's? and if didn't, please tell me where's the wrong
And another question, is it ok to having the lenght of FFT that much?
Because when I try to lower it, my code gives errors.
You shouldn't be doing an FFT of the entire file - that will include too much time-varing information - you should pick a window size in which the sound is relatively stationary, e.g. 10 ms # 44.1 kHz = 441 samples, so perhaps N = 512 might be a good starting point. You can then generate your spectrogram over successive windows if needed, in order to display the time-varying frequency content.

Resources