Convolution in 2 D
Convolutional Neural Networks
The course is part of this learning path
In this course, discover convolutions and the convolutional neural networks involved in Data and Machine Learning. Introducing the concept of tensor, which is essential for everything that follows.
Learn to apply the right kind of data such as images. Images store their information in pixels, but you will discover that it is not the value of each pixel that matters.
- Understand how convolutional neural networks are essential to the fundamentals of Data and Machine Learning.
- It is recommended to complete the Introduction to Data and Machine Learning course before starting.
Hello and welcome to this video on two-dimensional convolution. In this video, we will talk about two-dimensional convolution. Let's say we have a nine-by-nine image like the one here. And let's say we're looking for diagonal patterns like the one that is represented here. In this image, there are four three-by-three windows that match exactly the pattern displayed here in the few other places where similar patten can be found. Let's see how a convolution helps us identify those four locations. We perform a convolution of two images by multiplying the three-by-three filter with a three-by-three patch in the image and then shifting the patch like in the one-dimensional case. Let's do this pixel by pixels. We started the first pixel and stored the multiplication in a temporary three-by-three array.
Then move on to the second pixel. Then the third. Then the fourth and so on until we've reached the end of the filter. At this point, we have multiplied each of the nine pixels and we can take the sum of all the products and while we're at it, we also divide by the number of elements in the patch, which means we normalize the sum by the area of the patch. We have effectively averaged the product of the patch with the filter and in this particular case we obtain a value of one as our final result. We can perform the same operation using a different patch in the image. In this case, some pixel product will turn out to be negative because the patch is not identical to our filter. When we're done, we do the sum and divide by nine and we obtain a different smaller value for the corresponding pixel in the convolution result.
If we repeat this process for every possible three-by-three patch in the original image, we obtain the 2D convolution of the image with the filter. Notice that four pixels in the resulting convolution are exactly equal to one and they correspond to a perfect match of the filter with the image at that location. The other pixels have smaller values with varying degrees indicating partial match only. We will indicate the convolution with the symbol of a cross circle. And by now we know that the result of the operation is again an image whose pixels indicate the degree of matching between the original image and the convolutional filter. In conclusion in this video, we've talked about 2D convolution for images and how can they be used to do pattern matching in an image. Thank you for watching and see you in the next video.
About the Author
I am a Data Science consultant and trainer. With Catalit I help companies acquire skills and knowledge in data science and harness machine learning and deep learning to reach their goals. With Data Weekends I train people in machine learning, deep learning and big data analytics. I served as lead instructor in Data Science at General Assembly and The Data Incubator and I was Chief Data Officer and co-founder at Spire, a Y-Combinator-backed startup that invented the first consumer wearable device capable of continuously tracking respiration and activity. I earned a joint PhD in biophysics at University of Padua and Université de Paris VI and graduated from Singularity University summer program of 2011.