Image filters with convolutions
Start course
1h 19m

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.

Learning Objectives

  • Understand how convolutional neural networks are essential to the fundamentals of Data and Machine Learning.

Intended Audience


Hey guys, welcome. In this video, we're going to perform convolutions with images using scipy, which is another library in Python that contains a lot of scientific computing routines. So, first of all, we're going to import the convolve and the convolve2d functions. Then we're going to load an image from scipy, they have some images, and in this case, we've preloaded this staircase image. Cool, so we're going to do a convolution of this image, with a kernel that is a three by three image. So we create this kernel, as an array, and this is what the kernel looks like. So, what do you expect this kernel to do? If we convolve the image with the kernel, we will get this result. So, as you can see, this kernel has highlighted horizontal contrast line. If a line is horizontal, it's really visible. If a line is vertical, it's almost invisible. 

Diagonal lines are still visible. So, this kernel, convolved with the image obtains highlighting of horizontal lines. Other kernels would get you different results. But essentially here, we're just showing how convolving an image with a filter, with a kernel, results in a new image, where some aspects of the image are enhanced and some other aspects are suppressed. This is the basis of how a convolutional neural network works, with the exception that, in our convolutional neural networks, the kernel will be found by the network instead of being predefined like here. Here we use an arbitrary kernel, whereas in our network, these will be weights that the network is going to find. Thank you for watching, and see you in the next video.

About the Author
Learning Paths

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.