At 9:39, it has been said that the output after the first convulation layer would be 28 x 28 x 10. I think it should be 26 x 26 x 10 as our input image is 28 x 28 and our filter size, f is 3. So, the size after passing through the filter = (28 - f + 1) x (28 - f + 1) x (number of filters) = 26 x 26 x 10.
I didn't mention this in the video in this spot, although I probably should have - the choice of padding here effects the final output size. By choosing 'same', I am keeping the output size the same as the input. See 'padding' in the documentation for more details: www.mathworks.com/help/deeplearning/ref/nnet.cnn.layer.convolution2dlayer.html
Helpful video. Thank you. I have a question . If I have a dataset contained of images and their labels are reside on excel sheet files. How do I deal with them to build CNN?
Beautiful Explanation, Can we use CNN for timeseries without converting it into images. And, is there any source which introduces the layers more thoroughly?
It should be possible to make a moving window in 1 dimension, and apply that to a 1 dimensional signal as a convolution. I assume but am not positive this is done with RNNs. I wish I had a better introduction for layers too... next time maybe? :)
I am always happy to discuss things privately, although for larger projects it may need to be a formal consultation if it is more than a bit of advice. My email is available in the about page.
for the layers part of the CNN what if the images are of varying sizes, unlike here where you just wrote "imageInputLayer([28 28 1])" ? Do I have to set the dimensions of all my data to match or what's the best way to proceed ?
@@CodingLikeMad Another question, how would you do the splitting of data for training, validation and testing when using an augmented image dataset ? I noticed that "splitEachLabel()" doesn't work with the augmented set. Found someone doing it by indexed partitioning but don't fully understand if it does the same thing as splitEachLabel()
how to test this to know if this work? I mean, I had trained my own custom-handwriting, and i would like to see if it can predict the number in an image (image that is not use for training set nor test set) that I will upload into the MATLAB.
I'm afraid I don't have one strictly on regression using CNNs in matlab. My other videos that might be slightly helpful are: Classification using MLP in Matlab: th-cam.com/video/IUK8x3fZ1CA/w-d-xo.html Regression using ML in Matlab: th-cam.com/video/l69Ln_Pjb5c/w-d-xo.html Neither of those are strictly what you're looking for sadly, but perhaps you will find them helpful.
It was a great tutorial. explained neatly. I want to ask you that whether CNN works only on gray image or we can provide binary image also? also one more thing can we add thresholding layer instead of relu in between?
You can work with greyscale, color, or black and white data, although it may harm your accuracy to drop the color scale information. You can also use a wide variety of activation functions, including sigmoid functions which are a sortof soft thresholding function. I have used these together on some projects with cnns successfully.
That's a very big topic. The best approach is EDA - exploratory data analysis. Use things like correlation and other KPIs to see which features appear important, and focus on those first.
Sir that is really great work and explanation. Thanks a lot . Question: Why not using the WebDesigner App in MATLAB Instead of coding all this ? Looking forward to hearing from you. Thanks again :)
Hi Mustapha, I am not positive I know what you mean by webdesigner app - do you mean the app designer? If so, that will only help make the user interface. To incorporate it, you could follow instructions like these: www.mathworks.com/matlabcentral/answers/444474-neural-network-in-matlab-app-designer You might also have meant the deep network designer: www.mathworks.com/help/deeplearning/ug/build-networks-with-deep-network-designer.html I haven't used this tool before, but my feeling is that it is useful once you understand how things work, or for incorporating other structures. HOWEVER, the great thing about the code I use here is that it is almost identical in structure (basically line by line) to what you need in other major frameworks like Keras. So by learning this way, you learn better now, and then later have a structure very easy to port if you decide you want something else. Either way though, the basics are needed to start. Just my view anyway :) Goodluck!
So you would need a fixed window or fixed length time-series set for this, and it's really not the right tool for the job. I suggest looking into LSTM or RNN methods - they allow you to use mathematics for this that are much more appropriate for time series, but allow for the same underlying techniques. For instance, they can consider a moving window that acts a lot like a CNN in terms of weighting. Best of luck :)
@@CodingLikeMad You hit the point! I'm now stuck at understanding such windows that all papers call "Sliding Window". I just can't grasp its usefully! Why I cant input raw time-series data into NN. Isn't this right? Can you please enlighten me?
So, most neural net architectures for cnn struggle to handle variable size inputs. So if you collect data at 1khz, and go for 2 seconds, that's different then 3 seconds. The window makes it so it seems the same data input each time, because the window truncated it.
@@CodingLikeMad Great! That's a very good explanation actually. I need your help In sliding window code for MATLAB to extract features like mean and std and correlation from raw sensor data and put these features in a vector or feature vector. last days I was writing such code from online ones but my approach was not what I wanted and didn't work as I excepted. Please help me with this as you are dealing with MATLAB on daily basis.
@@saiftech659 I'm not sure you are still working on this, as I missed that you replied. If you are still looking for help, let me know. The normal approach I would take for this is to just dump a moving window into an array, and calculate the stats in that array.
So this is basically just a count problem. Apply the prediction model method to all of the data in your test set so you know the predicted value. Then for each value in the test set, look up the true value. The true value species a row, and the predicted value a column, and the totals for each combination of those the values inside it. So it's basically just a counting problem applied to the outputs/inputs of the model.
Very helpful my friend. How can u extract the text part of a label of a classified image when working with a large food meal dataset? I would like to classify food image and recommend recipes based on the label identified but I am not understanding how to do this. I WOULD kindly ask a tutorial on how to recommend the recipe after classifying an image. For example, we identify a lasagna and then recommend a recipe for that lasagna with a recipe dataset or somthing like that. There is barely information on food related projects plz
Hi Moe, I'm actually using a dataset built into matlab as part of the nn demos. If you take a look at 6:56 you can see the loading code for it - if you have the matlab neural network toolbox you should already have it. Everything I showed here will work for the mnist data set though with minimal changes, although you'll find slightly lower train/test performance as the mnist data set is a much messier (or perhaps more realistic) dataset. If you need help setting up mnist for this though, I can explain how to do that too. The Imagedatastore object is actually very easy to make work thankfully, and uses the same "label from folder" system as things like keras do.
@@HandheldGamingHQ I'm using matlab 2018a in this video - are you using something more recent then that? Could you say the specific file you see in that location, I might be able to look into it a bit more. I'm not sure what your goal is though - why do you want to split them out? Or is my code incompatable with the new file formats?
Can the network input be changed from the image to the data matrix? If possible, help to solve this problem. I know that the image itself is a matrix, but I do not know that the network can understand that the data input is not the image ?!
Yes, the only difference is the number of channels. An image typically has 3 color channels, a matrix will have 1 for a 2d matrix. The cnn approach still works fine for it. Yoi need to input the training data directly in this case rather then use the directory system though.
Hi sir ,Do you have a matlab code on human activity [such as walking running ....etc] using convolutional neural networks? Can you help me on this topic please
694 is an unused state level zip code which is slated for inclusion in Nebraska, should they ever grow large enough. It's important to use zip codes which aren't currently in use, to prevent any unsolicited letter mail to those addresses. #ResponsibleAddresses.
At 9:39, it has been said that the output after the first convulation layer would be 28 x 28 x 10. I think it should be 26 x 26 x 10 as our input image is 28 x 28 and our filter size, f is 3. So, the size after passing through the filter = (28 - f + 1) x (28 - f + 1) x (number of filters) = 26 x 26 x 10.
I didn't mention this in the video in this spot, although I probably should have - the choice of padding here effects the final output size. By choosing 'same', I am keeping the output size the same as the input. See 'padding' in the documentation for more details: www.mathworks.com/help/deeplearning/ref/nnet.cnn.layer.convolution2dlayer.html
@@CodingLikeMad Thank you so much for the explanation! I understood it. Thank you for the good video! :)
Helpful video. Thank you. I have a question .
If I have a dataset contained of images and their labels are reside on excel sheet files. How do I deal with them to build CNN?
Excellent Video I have learned so much
Great tutorial. Thank you.
Great insight - thanks
Dude, great video , thnx a lot ☺️🤘
Beautiful Explanation, Can we use CNN for timeseries without converting it into images. And, is there any source which introduces the layers more thoroughly?
It should be possible to make a moving window in 1 dimension, and apply that to a 1 dimensional signal as a convolution. I assume but am not positive this is done with RNNs. I wish I had a better introduction for layers too... next time maybe? :)
Hi, I have doubt in matlab program for speed analysis. Please can I contact you, if you share any media to share my question!
I am always happy to discuss things privately, although for larger projects it may need to be a formal consultation if it is more than a bit of advice. My email is available in the about page.
for the layers part of the CNN what if the images are of varying sizes, unlike here where you just wrote "imageInputLayer([28 28 1])" ? Do I have to set the dimensions of all my data to match or what's the best way to proceed ?
More advanced networks can handle varying sizes, but typically you resize the data to equal sizes during preproccesing.
@@CodingLikeMad Another question, how would you do the splitting of data for training, validation and testing when using an augmented image dataset ? I noticed that "splitEachLabel()" doesn't work with the augmented set. Found someone doing it by indexed partitioning but don't fully understand if it does the same thing as splitEachLabel()
how to test this to know if this work? I mean, I had trained my own custom-handwriting, and i would like to see if it can predict the number in an image (image that is not use for training set nor test set) that I will upload into the MATLAB.
Thnk you sir. Do you have any other video related to regression of data using CNN in matlab???
I'm afraid I don't have one strictly on regression using CNNs in matlab. My other videos that might be slightly helpful are:
Classification using MLP in Matlab:
th-cam.com/video/IUK8x3fZ1CA/w-d-xo.html
Regression using ML in Matlab:
th-cam.com/video/l69Ln_Pjb5c/w-d-xo.html
Neither of those are strictly what you're looking for sadly, but perhaps you will find them helpful.
It was a great tutorial. explained neatly. I want to ask you that whether CNN works only on gray image or we can provide binary image also? also one more thing can we add thresholding layer instead of relu in between?
You can work with greyscale, color, or black and white data, although it may harm your accuracy to drop the color scale information. You can also use a wide variety of activation functions, including sigmoid functions which are a sortof soft thresholding function. I have used these together on some projects with cnns successfully.
@@CodingLikeMad hello sir. If I want to do feature selection from large features, then which technique is good and How I can extract those features
That's a very big topic. The best approach is EDA - exploratory data analysis. Use things like correlation and other KPIs to see which features appear important, and focus on those first.
Sir that is really great work and explanation. Thanks a lot .
Question: Why not using the WebDesigner App in MATLAB Instead of coding all this ?
Looking forward to hearing from you.
Thanks again :)
Hi Mustapha,
I am not positive I know what you mean by webdesigner app - do you mean the app designer? If so, that will only help make the user interface. To incorporate it, you could follow instructions like these:
www.mathworks.com/matlabcentral/answers/444474-neural-network-in-matlab-app-designer
You might also have meant the deep network designer:
www.mathworks.com/help/deeplearning/ug/build-networks-with-deep-network-designer.html
I haven't used this tool before, but my feeling is that it is useful once you understand how things work, or for incorporating other structures. HOWEVER, the great thing about the code I use here is that it is almost identical in structure (basically line by line) to what you need in other major frameworks like Keras. So by learning this way, you learn better now, and then later have a structure very easy to port if you decide you want something else. Either way though, the basics are needed to start. Just my view anyway :) Goodluck!
Great Video!
Thanks!
Very helpful video, ...
I wonder if CNN could handle sensor data (time-series)?
So you would need a fixed window or fixed length time-series set for this, and it's really not the right tool for the job. I suggest looking into LSTM or RNN methods - they allow you to use mathematics for this that are much more appropriate for time series, but allow for the same underlying techniques. For instance, they can consider a moving window that acts a lot like a CNN in terms of weighting. Best of luck :)
@@CodingLikeMad You hit the point!
I'm now stuck at understanding such windows that all papers call "Sliding Window".
I just can't grasp its usefully!
Why I cant input raw time-series data into NN.
Isn't this right?
Can you please enlighten me?
So, most neural net architectures for cnn struggle to handle variable size inputs. So if you collect data at 1khz, and go for 2 seconds, that's different then 3 seconds. The window makes it so it seems the same data input each time, because the window truncated it.
@@CodingLikeMad Great!
That's a very good explanation actually.
I need your help In sliding window code for MATLAB to extract features like mean and std and correlation from raw sensor data and put these features in a vector or feature vector.
last days I was writing such code from online ones but my approach was not what I wanted and didn't work as I excepted.
Please help me with this as you are dealing with MATLAB on daily basis.
@@saiftech659 I'm not sure you are still working on this, as I missed that you replied. If you are still looking for help, let me know. The normal approach I would take for this is to just dump a moving window into an array, and calculate the stats in that array.
Code for number recognition ?
Hello sir
i have a question, how to find confusion matrix in this n which pretrained network model is used here?
plz let me know
So this is basically just a count problem. Apply the prediction model method to all of the data in your test set so you know the predicted value. Then for each value in the test set, look up the true value. The true value species a row, and the predicted value a column, and the totals for each combination of those the values inside it. So it's basically just a counting problem applied to the outputs/inputs of the model.
@@CodingLikeMad okay thank you sir
Thank you sir.
Sir do u have matlab code for Recognize shape like balloon, cylinder, cone using CNN Or it's dataset
Sorry, I dont know of such a dataset. Goodluck!
@@CodingLikeMad thank you sir
Very helpful my friend. How can u extract the text part of a label of a classified image when working with a large food meal dataset? I would like to classify food image and recommend recipes based on the label identified but I am not understanding how to do this. I WOULD kindly ask a tutorial on how to recommend the recipe after classifying an image. For example, we identify a lasagna and then recommend a recipe for that lasagna with a recipe dataset or somthing like that. There is barely information on food related projects plz
are you using the mnist dataset in this video?
if not, can you please send me the link for the one you're using
Hi Moe, I'm actually using a dataset built into matlab as part of the nn demos. If you take a look at 6:56 you can see the loading code for it - if you have the matlab neural network toolbox you should already have it. Everything I showed here will work for the mnist data set though with minimal changes, although you'll find slightly lower train/test performance as the mnist data set is a much messier (or perhaps more realistic) dataset. If you need help setting up mnist for this though, I can explain how to do that too. The Imagedatastore object is actually very easy to make work thankfully, and uses the same "label from folder" system as things like keras do.
@@CodingLikeMad yes i found them in the nndemos folder but they're all matlab projects, not separate image files like yours
@@HandheldGamingHQ I'm using matlab 2018a in this video - are you using something more recent then that? Could you say the specific file you see in that location, I might be able to look into it a bit more. I'm not sure what your goal is though - why do you want to split them out? Or is my code incompatable with the new file formats?
Can the network input be changed from the image to the data matrix? If possible, help to solve this problem. I know that the image itself is a matrix, but I do not know that the network can understand that the data input is not the image ?!
Yes, the only difference is the number of channels. An image typically has 3 color channels, a matrix will have 1 for a 2d matrix. The cnn approach still works fine for it. Yoi need to input the training data directly in this case rather then use the directory system though.
Hi sir ,Do you have a matlab code on human activity [such as walking running ....etc] using convolutional neural networks? Can you help me on this topic please
I dont have code or experience with pose or activity detection sorry. Goodluck!
@@CodingLikeMad Thank you very much, but can you contact me for someone (master's student or doctoral student) who is doing the same job?
I dont know anyone working on that subject, sorry. Best of luck :)
@@CodingLikeMad Thank you
Thank you.
Sir can you solve a optimization problem i have problem in code
In this code, or in a seperate topic?
69420? Really?
694 is an unused state level zip code which is slated for inclusion in Nebraska, should they ever grow large enough. It's important to use zip codes which aren't currently in use, to prevent any unsolicited letter mail to those addresses. #ResponsibleAddresses.
Good catch 🤣
Sir may i have your email please. I am in some problems. Please can i share my problems with you? Thank You.
My email is listed on the about page. I often cant help with more complex projects, but I always think about it a bit at least.