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.
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.
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.
I initially selected âhorizontal edgeâ in the quiz, but it was marked incorrect. Then, I chose âvertical edge,â but that was also incorrect. I realized it would be better to learn the concept rather than guessing the answer. Thank you for the video link, Iâll definitely watch it!
The other thing to be careful about is that the quiz questions are not necessarily exactly the same every time you take the quiz. I would say that filter you show is a vertical edge detector. If you chose that answer and it was marked wrong, Iâll bet that the filter in the second case was different than what you showed above.
@Mushi Iâd also say the filters, as they are presented in the course are kind of simple (though it is only an âintroâ-- we step up fast to convolutions), but Iâd check out Floyd-Steinberg dithering.
Same concept, smaller scale, but you might âsuddenly get what we are doingâ.
The way I think about it, itâs not the specific numerical values in the static filter that reveal its properties. Instead, itâs the symmetry (or lack thereof). In the quiz example you provide, there is a symmetry around the horizontal axisâŚimpact of the filter is the same above and below its center. However, it is not symmetrical around the vertical axisâŚvalues from combining the filter with the input signal are pushed in opposite directions. So in this case, any differences between the left and right will be enhanced. In other words, a vertical edge.
Notice that this is consistent with your text description of what you were taught.
The example has both 1 and -1 (and 3 and -3) both above and below the center, itâs symmetric, so horizontal edge is not correct.
Itâs not the numeric values 1 and -1 themselves that are the clue, it is the way the weights are distributed throughout the filter. Hope this helps
It helped me sir, thankss man. love you bro for taking out the time and guiding me, now its really clear to me, I was so dumb looking at specific numbers rather than looking at the pattern, your explanation went into my head rather than over my head
have a good day brother.
Iâve been supporting the Deep Learning forums since 2018. This might be the best feedback I have ever received. Itâs certainly what I aspire to with every reply. Thanks for letting me know this one hit the mark.