Understanding Filters

Hi, I hope readers are in great health. I came across a filter question in a quiz. In course 1, we learned that if there are 1s on the left and -1s on the right, it is a vertical edge filter (with 0s in the center). Similarly, if there are 1s on the top and -1s on the bottom, it is a horizontal edge filter (again, with 0s in the center).

For readers who are not aware of the meaning of 1 and -1 in this context:

  • 1 represents light/bright pixel values.
  • -1 represents dark pixel values.

So my question is: how can I decide the type of filter based on the values in it? Any articles, YouTube links, or explanations would be appreciated. Thank you!

Hello,
Check out this wikipedia article. I think it would help. It presents several types of filters, and links to more articles with more explanations. Good luck.

Hi Mushtaq,

Note the rows in the filter:

  • The positive values (1, 3) are concentrated in the upper left corner of the kernel.
  • The negative values (-1, -3) are concentrated in the bottom right corner of the kernel.

This pattern suggests horizontal intensity changes as the transition from positive to negative is vertical. When applied to an image, this kernel will highlight regions where there is a horizontal gradient (e.g. bright pixels at the top and dark pixels at the bottom). Review Week 1 of the Convolutional Neural Networks course, especially the ConvNet Basics videos, which explain kernels in detail with visual examples.

YouTube tutorials:

  • 3Blue1Brown has intuitive visual explanations of convolutional layers and filters.
  • Search for videos like “Edge Detection in Image Processing” or “Convolutional Kernels Explained” for more clarity.

Articles:

  • “Intuitively Understanding Convolutions for Deep Learning” by Towards Data Science provides a good foundation.

Hope this helps!

2 Likes

In addition to the useful links to YouTube and Wikipedia, note that Prof Ng covered this in the lectures. If you missed that, it might be worth watching the relevant lecture again: the title is Edge Detection Example and it’s the second lecture in Week 1. He specifically uses edge detection as his example to give the intuition for how convolutional filters can be useful.