I was looking for this kind of video for ages. Everytime when I see tutorials on CNNs and building it through code, they never ever explain what sort of filters are being used in the architecture. This video cleared by confusions on this matter. Thank you very much.
so far this channel is the best to learn machine learning. I hope you keep uploading more videos... about RNN, LSTM, segmentation, spiking NN... and more maybe
Just finished watching all 22 of these videos, they were super helpful! Just getting started with TF and was completely lost without understanding the vocabulary and concepts. Still lost but a little less so now :). Hopefully you decide to keep making these types of videos and I will recommend them to anyone looking to get into ML.
Hey Javed, thanks for letting me know! I'm glad these videos were helpful for you. If you're interested, I also have a Keras playlist that goes through some basics of building the network, training, predicting, etc. Keras is built on top of Tensorflow and is a higher level neural network API. Either way, good luck on your ML journey! ru-vid.com/group/PLZbbT5o_s2xrwRnXk_yCPtnqqo4_u2YGL
thank you for these videos! amazing series... been binge-watching your channel for the past few hours, and feel like i learned more than i did in previous few months
Surprising how the inner mechanics of a neural network can sometimes be visualized in a humanly comprehensive way. Most of the time i only encounter chaos ^^ Cool demo!
Deeplizard: thanks for watching the video Me: No thanks for even existing and bringing this content to my life, you're a blessing to be found by anyone so thankyou!
Great video! There's something I don't get yet (I haven't gone through the code): a filter is usually small (3x3, 5x5, 7x7...) but those filters showing patters seemed huge (compared to the ones I imagined). They must be no less than... 32x32. Are they really that big, or am I missing something?
Thanks, Daniel! You're right, filters are usually small. In fact, the filters for each convolutional layer within the VGG16 network (used in this video) are all 3x3. The visuals we saw of the gray squares with patterns on them are not the filters themselves. Rather, we're passing the network a 128x128 plain gray image with some random noise with the objective of being able to visualize what sort of input would maximize the activation for any given filter. The outputs from this process are the transformed grey 128x128 images that would maximize the corresponding activations the most. Let me know if this helps clear things up.
Hi, I didn't answer before because I didn't completely understand it. But I came across some nice code from the Keras team that does exactly what you said: it creates a loss function that maximizes the activation for the filter whose activation map we want to visualize. This is the code: github.com/keras-team/keras/blob/master/examples/conv_filter_visualization.py I'm not quite sure about how the K.gradients function works, but assuming it works, it's not difficult to visualize any filter of any layer. Amazing. Only after having played with it I can say I understand it. Thanks
Yes, definitely took me some time to play with the code in this video myself before I fully got what exactly it was doing. Also, yes, that link is to the same code we used here, so you're on the right track! I'm glad you were able to develop an understanding for it. :)
It's weird, the video is so well done but you neglect to mention the entire idea of the processing code. That we perform gradient ascent and instead of updating our network with the gradients, we update the input image. Thus the image gets morphed into a matrix, that maximizes the filter activation. Came here to learn this but had to read the blog post instead.
Sorry I am still not able to understand the last part, when you illustrate the dog face. Why are we not seeing the edges of the object in your demonstration, instead we see only random patterns. I know you have explained in the video, but can you simplify what do you mean again?
Hey Noel - So, in this video, we were passing the network a plain gray image with some random noise with the objective of being able to visualize what sort of input would maximize the activation for any given filter. The images that we're visualizing from these filters are the transformed grey images that would maximize the corresponding activations the most. In the previous video of this playlist on CNNs, however, we did something a bit different. There, we looked at the patterns that a given filter was able to detect from _specific images_ (dog faces, etc.) that highly activated the filter. Let me know if this helps clear things up.
Nice video....you should have more views. My question is, HOW do the filters learn which features to look for? Example, how does one filter learn vertical lines and another filter learn horizontal lines? And eventually, the higher order filters learning angles and textures? Thank you.
The previous 21 videos were very clear. But this one had a lot of gaps. For example the code explanation was very short. Great work though. Keep up the good work.
Hey Gamma - Appreciate the feedback. My intention was to give a high-level overview of the code and focus more on how we can interpret the visualizations. Maybe a I'll add a video to the Keras playlist (below) where we go over the specifics of this program. In that series, the focus is on all the code-level details :) ru-vid.com/group/PLZbbT5o_s2xrwRnXk_yCPtnqqo4_u2YGL
Hi, How are you ? really you did a great job. I watched your previous videos in this list and I can say i got a good understanding because of your well preparation of the video and your simple presentation of the information. yet, in this video, I watched it twice and still i have the feeling that there are a lot of missing parts to me. 1- I understand that, in this video, you are passing a gray input image with random noise and you are displaying to us or (visualizing) the input images that will give the most activation for the filters. Am i correct ? "Please correct me if i am wrong". (So, your input input is gray images with random noise and what we are seeing in the end of the videos are the instances of the input images which most activated certain filters) 2- if I am right in the first part, I don't understand what is conv1-block1, conv2_block3, and so on. can u explain it in the comment? and why we are seeing many of the images not only just the one the most activated the filter ? sorry if I asked the wrong question maybe I misunderstood the whole video; in this case, can you simply correct me ?
Hey Mohamed - You are absolutely correct for number (1), and your questions are completely valid! For (2), "conv1-block1" means the first convolutional layer in the first group of convolutional layers. So, for example, a network may have five convolutional layers that are then followed by some dense layers, and then another group of five convolutional layers followed again by some more fully connected layers. We're calling these groups of convolutional layers "convolutional blocks." So, the first group would be block1, the second group would be block2. When we want to refer to the first conv layer in block1, we say "conv1-block1." Additionally, the 25 squares for one convolutional layer represent the 25 different filters contained within the layer. Each filter detects a different pattern. Does this all make sense?
@@deeplizard Thanks a lot for your response and declaration. You still dedicated and giving a quick response even after 9 months after posting the video. Now, I can say that there are sets of convolution layers spread within the hidden layers. The set is called block. So, the first set of the convolution layers is block-1, and the conv-3 is the third convolution layer in the set, of course according to which block we are talking about. Moreover, each convolution layer is composed of number of filters. Therefore, if we are talking about block-1 conv-2, what we are seeing is the instances of the input gray image with random noise that activated the filters in the 2nd convolution layer in the 1st set, block, of convolution layers. Thanks again. I hope I got it right.
In this video the layers i.e. conv1-block1, conv2-block3 are just the filters(weights) that we get after each layer. We did not convolute these filters with anything. They are just filters that we have learned. In the last part she says that now when we apply those filters i.e. convolute them with dog pics, then we get a convolutions that actually look like dogs.
Machine Learning / Deep Learning Tutorials for Programmers playlist: ru-vid.com/group/PLZbbT5o_s2xq7LwI2y8_QtvuXZedL6tQU Keras Machine Learning / Deep Learning Tutorial playlist: ru-vid.com/group/PLZbbT5o_s2xrwRnXk_yCPtnqqo4_u2YGL
{ "question": "Gradient ascent differs from gradient descent in trying to _______________ loss in order to _______________", "choices": [ "maximize / emphasize pattern detection of the filter", "minimize / increase accuracy", "maximize / identify overfitting", "minimize / isolate the activation function" ], "answer": "maximize / emphasize pattern detection of the filter", "creator": "Chris", "creationDate": "2019-12-14T01:42:45.651Z" }
Why we want to maximize our loss ? Not understood very clearly. Secondly once we have maximum loss then how we reduced to minimum loss further ? Can you pl explain Thanks
Hey Joe - Are you referring to the filters that are shown at 0:26 in the video? If so, those filters were pulled from the previous video in the playlist on CNNs. In that video, I go into more detail about filters. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-YRhxdVk_sIs.html I just created these filters for illustration purposes to show what an "edge detector" filter would look like. In general though, all the filters throughout a network are randomly initialized, and the values will change during training. With this being said, networks have far more complex filters than the ones I showed at 0:26.
Thanks for the video. Could you please clarify a bit more what the visualisation of the dog faces at the end was? Was that a deep layer's filter applied to the raw input image? Or something else?
Hey TallWaters - So, in this video, we were passing the network a plain gray image with some random noise with the objective of being able to visualize what sort of input would maximize the activation for any given filter. The images that we're visualizing from these filters are the (transformed grey) images that would maximize the corresponding activations the most. In the previous video of this playlist on CNNs (ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-YRhxdVk_sIs.html), however, we did something a bit different. There, we looked at the patterns that a given filter was able to detect from specific images that highly activated the filter. That's what we were looking at with the dog faces example. Let me know if this helps clear things up.
Oh so you're just taking the raw filter in deeper layers and running it over certain training/test images? But those filters would usually be for blocks with more dimensions right? I mean initially the filters would be like (5, 5, 3) where 3 represents RGB colours. But the later layers would have filters like (8, 8, 64) perhaps? Am I totally misunderstanding? :(
Hi, I just don't understand how filters can be visualised. And also why would you say that some filters are highly activated for some images? How can can filters be activated? I mean filters can only extract features from an input image or matrix. So what does does it mean when you say they can be visualised or highly activated?
Hey Andre - So, in this video, we were passing the network a plain gray image with some random noise with the objective of being able to visualize what sort of input would maximize the activation for any given filter. The images that we're visualizing from these filters are the (transformed grey) images that would maximize the corresponding activations the most. In the previous video of this playlist on CNNs, however, we did something a bit different. There, we looked at the patterns that a given filter was able to detect from specific images that highly activated the filter. At 4:57 in this video, I attempt to make that point. Let me know if this helps clear things up.
Could you please clarify how the loss function for maximizing the activation works? I don't understand what each gradient ascent step actually updates, since here our trained model already has fixed weights (which is what the loss function for the output of the model updates) and also a fixed input picture. So what can this loss function possibly be maximized on, in order to visualize what the filter is looking for?
Great video. Thanks. I understand the general model of conv16,maxpool,conv32, maxpool ... flatten, dense , dense, non-linearity. But do all those filter values respectively get added into one image, or is it simply a single filter value given a success rating during training and then those total yes rated filter images use in essence human understanding "gestalt" to a pixel figure we call say 8. So the more layers and the more neurons in each layer give us more fine tuning control to a point? So a cat's two ears is a function of perhaps 100 filtered success rated images?
Hey Christian - Yes, your latter explanation is correct :) The section called Output Channels And Feature Maps in the blog below may be helpful in this area as well. deeplizard.com/learn/video/k6ZF1TSniYk
@@deeplizard Thank you so much for your answer and exciting reference. I need to learn more Pytorch obviously. Every time I think I know something, you have another video I need to learn. And you have a long list of videos making Deeplizard the best learning source online bar none. On your vlog you quit your jobs but it looks like you have more than two full-time jobs now, lol.
Yes. Only, the input and output are channels. This is why diagrams of CNNs look like the one at the top of the page here: deeplizard.com/learn/video/k6ZF1TSniYk
Need help please answer, I would like to know if you pass a grey image suppose it is a one channel, then after convolving with the filters, why the image appears colorful like green, pink in your video. It has something to do with RGB channels. Please explain thanks.
Hi. I can't find the notebook you're using in this video on your website. I found deep-learning-fundamentals-deeplizard.ipynb but it doesn't have the Visualizing Convolutional Filters from a CNN part. Where can I found it? Thank you.
Hey Maria - The code used in this episode is from this original Keras blog: blog.keras.io/how-convolutional-neural-networks-see-the-world.html As stated there, the author has since updated the blog, now at this link: keras.io/examples/vision/visualizing_what_convnets_learn/ The corresponding github link and Jupyter Notebook for the updated code from the blog are below: colab.research.google.com/github/keras-team/keras-io/blob/master/examples/vision/ipynb/visualizing_what_convnets_learn.ipynb github.com/keras-team/keras-io/blob/master/examples/vision/visualizing_what_convnets_learn.py
First, this is great work. I find error in using: grads = K.gradients(loss, input_img)[0] and I am also not sure if I have to insert an image at (I am using it as it is): input_img = model.input Can you help in running this?
At 2:45 in the episode, you can see the path to where the images should be saved. You should create a directory called conv_images inside of the directory for which your code resides. The images should be saved in conv_images if you follow the same code shown at 2:45.
conv1-block1" means the first convolutional layer in the first group of convolutional layers. So, for example, a network may have five convolutional layers that are then followed by some dense layers, and then another group of five convolutional layers followed again by some more fully connected layers. We're calling these groups of convolutional layers "convolutional blocks." So, the first group would be block1, the second group would be block2. When we want to refer to the first conv layer in block1, we say "conv1-block1." Additionally, the 25 squares for one convolutional layer represent the 25 different filters contained within the layer. Each filter detects a different pattern.
What annoys me is this: everyone does the vgg16 model but what if I actually trained my own keras model? As far as I can tell this code only works for this specific example, throwing weird assertion errors without explanation and really is no help if you have another model.
Hey Giovanni - Check out the previous video and blog where this is explained: deeplizard.com/learn/video/YRhxdVk_sIs Additionally, the video and blog below explain even more technical details regarding CNNs as well: deeplizard.com/learn/video/k6ZF1TSniYk
@@deeplizard Well I had'nt expected that u will reply .. bcz this video was posted almost 3 years ago..Still u are maintaining it ..that's something awesome.. Loving ur series :)