If you found this tutorial useful, please share with your friends(WhatsApp/iMessageMessenger/WeChat/Line/Telegram) and on Social(LinkedIn/Quora/Reddit), Tag @cogneethi on twitter.com Let me know your feedback @ cogneethi.com/contact
sorry to be so offtopic but does anybody know a trick to log back into an Instagram account? I stupidly lost my password. I love any help you can give me!
So, a couple of questions (a great series though!) At 7:58, why aren't the gradient lines STRICTLY along the x or y direction (depending on the part of the arrow), why is there a slight tilt? At 5:34, what's the point of concatenating 4 9x1 feature vectors? An 8x8 patch is already a huge patch from which one can calculate the histogram. Also, this method of concatenation results in overlapping between windows (maybe this is alright as we would like to detect subtle changes) but if we didn't concatenate feature vectors, our image would be represented by only 8 * 16 * 9 = 1152 numbers, thus, saving a lot of compute power. I hope that i've asked my questions clearly enough.
Thanks for the video! At 08:15 you say that when we transition from white to black, the change in gradient magnitude is along the x-direction. But isn't it changing in y-direction? I think that in the hog visualization we see the orientations of edges, not the gradients (which are perpendicular to edges).
For the 8*8 matrix in each cell/grid, you calculate the gradient magnitude and gradient direction. There will be missing values at the edge of the calculation. What numbers to fill in for the pixels value at the edge?
Ohhhhhhhhhhh man Thank you so much for such a great explanation... I have paid for udemy course but the teacher sucks he didn't even know how to teach and he is taking his salary for no reason.
Hi. Thanks for such an informative video. I have a small question, shouldn't the Gradient direction be tan^(-1)(y/x), or tan^(-1)(50/30) instead of tan^(-1)(30/50) !!
@@Cogneethi vedio content is really helpful. I will not call the thing that i pointed as mistake, it is just a small thing we tend to miss while creating such a beautiful deliverable. Thanks for sharing.
@@somdubey5436 Hey, no hard feelings here. I am also learning a lot from the comments. Please do point out any others that you might come across. It will benefit other viewers too. :)
Great Video. But how you get a range of 0 - 180 if you take only absolute values in arctan. In my opinion arctan shows only 0 - 90 degree for positive values?
Hey, I have a doubt... we are doing the Gradient magnitude segregation into 9 bins which are in the range of 0-180 degrees, but the pictorial representation shows magnitudes up to 360... How do we arrive at that representation??
Hey, the pictorial representation is wrong. Sorry for that. More info: Supposedly, the authors got better results by using unsigned gradients (0-180) than signed (0-360). www.learnopencv.com/histogram-of-oriented-gradients/ lilianweng.github.io/lil-log/2017/10/29/object-recognition-for-dummies-part-1.html devanginiblog.wordpress.com/2016/05/10/hog-histogram-of-gradients/
Thank you so much for your explanation, please when we have the histogram, how is the transition from having one histogram to the image of 'histogram of oriented gradients ', and pelase do you have any resources concerning local ternary pattern
Great explanation overall! I have a question though: does this also involve image pyramid, sliding window and non-maximum suppression in actual implementation?
hi there I m trying to write algorithm to extract HOG feature from images , so all the calculation of HOG method i understood very well thank to you bro but i have one probleme it s makes me crazy when i import images i have array of multi-Dem so I can't apply HOG method on it (you used in ur example array of 2D) so How i can change image array of multiDem to array of 2D and thanks for help
option 1: You can keep it simple and convert the image to grayscale and calculate the HOG features: scikit-image.org/docs/dev/auto_examples/color_exposure/plot_rgb_to_gray.html Options 2: Calculate Gradient magnitude and direction for the 3 channels (RGB) seperately. Then, for each pixel, pick those channel value with the maximum change in gradient magnitude: This is what seems to have done here: github.com/scikit-image/scikit-image/blob/17e4487883a38ad6c8f83c83b60ff37f93cc1bce/skimage/feature/_hog.py Please let me know if you have any other doubts.
This 64x128 dimension was used in the original HOG paper to detect pedestrians. The dataset they used had around 1805 images of humans cropped in 64x128 patches. In reality there is no such constraint. You can have images of any size. Sorry for the confusion, I should have mentioned this in the video. Thanks for pointing this out.
Then if i trained the features of Hog of images . If in future test image will be rotated or some affect in scale . It will incorrectly classify . How scale and rotation invariance achieve in HOG
@@hamzanaeem4838 HOG may not be best fit for this case. Instead you can try other feature descriptors as mentioned here: dsp.stackexchange.com/a/1642 Honestly, I never had a chance to apply/use these for any of my projects. So, I may not be the best person to answer this with conviction.
Dear Sir, I have a doubt. I a unable to understand theoretically how finally we get the outline of the shape of the object? how those white dots in the output are plotted? My doubt might sound very silly but i request you to clarify my doubt
Hey, those outputs are got from HOG. I have explained it in the previous videos: ruclips.net/video/Qwc3a8cOKRU/видео.html Or you can watch from beginning: ruclips.net/video/5YLn5i_qkTI/видео.html Once we get the HOG output. We train a SVM classifier to detect such patterns. Basically, if we have images of people standing, then the HOG output will all look similar. And the SVM Classifier will be able to identify such patterns. But of course, if you feed an image of person sitting, then the HOG output pattern will be different and the SVM Classifier may not be able to detect it. So, to build such generic detectors, we can use CNNs which act as much better feature extractors. Let me know if I need to elaborate.
@@Cogneethi Dear Sir, Thanks a lot for your response. With which dataset or what data is used to train svm? I mean svm classifier needs to be trained with hog output so that next time when a new hog output is fed as input to svm, it classifies yes or no? Kindly respond
Hey good question, I never got that doubt. I only checked now. Supposedly, the authors got better results by using unsigned gradients (0-180) than signed (0-360). arctan(x) of any number is between -90 to 90. So, they must be shifting this to 0-180* range. www.learnopencv.com/histogram-of-oriented-gradients/ lilianweng.github.io/lil-log/2017/10/29/object-recognition-for-dummies-part-1.html devanginiblog.wordpress.com/2016/05/10/hog-histogram-of-gradients/ Thanks for the asking.
@@Cogneethii have a question, x direction and y direction are absolute value so they are only positive numbers, arctan(x) is from 0 to 90 for x positive values and -90 to 0 for negative x values. That means that the direction can only go from 0-90. Am i worng or there is something wrong in the video?
@@simoneserafini7917 Hey, error in video. It is not absolute value. We do need to consider the sign. That way, we will get the direction correctly between -90 to 90. Then it is probably shifted to 0 to 180 range. While calculating magnitue, the sign gets cancelled out due to the square. Thanks for pointing out the mistake.
If you found this tutorial useful, please share with your friends(WhatsApp/iMessageMessenger/WeChat/Line/Telegram) and on Social(LinkedIn/Quora/Reddit),
Tag @cogneethi on twitter.com
Let me know your feedback @ cogneethi.com/contact
sorry to be so offtopic but does anybody know a trick to log back into an Instagram account?
I stupidly lost my password. I love any help you can give me!
very nice clear explanation with examples
Really clear explanation with numerical example which many tutorials lack of this important feature. Thank you
I am watching from Turkey and this is the best explanation. I am so appreciate because I found this channel
Really this video help me to undestand the HOG feature vector claculation in a very simple manner in depth , Simply perfect.
Best video on HOG feature descriptors. Thanks sir for sharing ur knowledge.
crisp, clear, to the point with neat diagrams.. thanks
Man, you are really cool in deep explanation of hog. Bravo.
Clear , crisp and precise explanation with excellent visualization .
Thank you so much !!!
Thanks man...You really made consolidated computer vision course that explains all the things with simplicity
Thanks Pranav!
best explanation so far!
Thank you for the explanation, you are very good and clear in the way you express yourself.
thanks bro, now I think this field is so fun
Very clear excellent video with examples and detail description. Thank you.
Very thorough explaination!
Insane how this only has 2k views
seriously .... This guy made consolidated computer vision course that explains all the things with simplicity
It's now 58k views
the best explanation ever
amazing demonstration, i can understand .
So, a couple of questions (a great series though!)
At 7:58, why aren't the gradient lines STRICTLY along the x or y direction (depending on the part of the arrow), why is there a slight tilt?
At 5:34, what's the point of concatenating 4 9x1 feature vectors? An 8x8 patch is already a huge patch from which one can calculate the histogram. Also, this method of concatenation results in overlapping between windows (maybe this is alright as we would like to detect subtle changes) but if we didn't concatenate feature vectors, our image would be represented by only 8 * 16 * 9 = 1152 numbers, thus, saving a lot of compute power.
I hope that i've asked my questions clearly enough.
God. you should be my ML teacher.
concise and clear... grazzie
Nice and clear explanation, thank you!!
Very nice explanation. Thank you very much !
this is a good explanation to hear
Thanks for the video! At 08:15 you say that when we transition from white to black, the change in gradient magnitude is along the x-direction. But isn't it changing in y-direction? I think that in the hog visualization we see the orientations of edges, not the gradients (which are perpendicular to edges).
Yes you are right!. Its a mistake. Glad that you pointed out.
For the 8*8 matrix in each cell/grid, you calculate the gradient magnitude and gradient direction. There will be missing values at the edge of the calculation. What numbers to fill in for the pixels value at the edge?
0
loved the tutorial...
great explanation.Thanks!
Ohhhhhhhhhhh man Thank you so much for such a great explanation... I have paid for udemy course but the teacher sucks he didn't even know how to teach and he is taking his salary for no reason.
ase pada rai ho jesa bachpan se sikh ke ai hai
good explanation
grad direction will be tan inverse (50/30)?
Great Video, just keep it up!
1:35 Why grad direction tan-1(30/50) and not tan-1(50/30) ? It should be y/x right ?
Deep🙏 Explanation
Hi. Thanks for such an informative video. I have a small question, shouldn't the Gradient direction be tan^(-1)(y/x), or tan^(-1)(50/30) instead of tan^(-1)(30/50) !!
Yes, some mistakes in the calculation and explanation. I have answered this in some of the comments. Thank you for pointing out the mistakes.
@@Cogneethi vedio content is really helpful. I will not call the thing that i pointed as mistake, it is just a small thing we tend to miss while creating such a beautiful deliverable. Thanks for sharing.
@@somdubey5436 Hey, no hard feelings here. I am also learning a lot from the comments. Please do point out any others that you might come across. It will benefit other viewers too. :)
@@Cogneethi ya sure :)
thanks bro, helps a lot!!
Nice explanation 👌
Clear-cut explanation. Why college professors don't teach like that lol
Great Video. But how you get a range of 0 - 180 if you take only absolute values in arctan. In my opinion arctan shows only 0 - 90 degree for positive values?
Hey, you are right. I have answered this is another comment to "Derric". Can you please see the discussion.
Very clear thank you
Awesome 😍😍😍
It was helpful...
Hey, I have a doubt... we are doing the Gradient magnitude segregation into 9 bins which are in the range of 0-180 degrees, but the pictorial representation shows magnitudes up to 360... How do we arrive at that representation??
Hey, the pictorial representation is wrong. Sorry for that.
More info:
Supposedly, the authors got better results by using unsigned gradients (0-180) than signed (0-360).
www.learnopencv.com/histogram-of-oriented-gradients/
lilianweng.github.io/lil-log/2017/10/29/object-recognition-for-dummies-part-1.html
devanginiblog.wordpress.com/2016/05/10/hog-histogram-of-gradients/
Thank you so much for your explanation, please when we have the histogram, how is the transition from having one histogram to the image of 'histogram of oriented gradients ', and pelase do you have any resources concerning local ternary pattern
I might have covered this here: ruclips.net/video/Qwc3a8cOKRU/видео.html
And I dont know about ternary pattern
Great explanation overall! I have a question though: does this also involve image pyramid, sliding window and non-maximum suppression in actual implementation?
image pyramid yes
sliding window yes.
nms yes.
you can try sklearn library for hog feature extraction.
Hey, my bad. I was thinking of something else. Does use image pyramid.
Please see the next few videos in the playlist to know more.
What if you have a whole data set to extract?
arctan range is 0-180 and also should be arctan(y/x), not arctan(x/y)
thank you sir
hi there
I m trying to write algorithm to extract HOG feature from images ,
so all the calculation of HOG method i understood very well thank to you bro
but i have one probleme it s makes me crazy
when i import images i have array of multi-Dem so I can't apply HOG method on it
(you used in ur example array of 2D)
so How i can change image array of multiDem to array of 2D
and thanks for help
option 1: You can keep it simple and convert the image to grayscale and calculate the HOG features: scikit-image.org/docs/dev/auto_examples/color_exposure/plot_rgb_to_gray.html
Options 2: Calculate Gradient magnitude and direction for the 3 channels (RGB) seperately. Then, for each pixel, pick those channel value with the maximum change in gradient magnitude:
This is what seems to have done here: github.com/scikit-image/scikit-image/blob/17e4487883a38ad6c8f83c83b60ff37f93cc1bce/skimage/feature/_hog.py
Please let me know if you have any other doubts.
Cogneethi can we apply HOG method on colored image without turning it into gray image????
yes, I have mentioned the technique in option 2 - that is without converting to gray
@@Cogneethi i can't find ( option 2 ) would u send link of this video
thanks again for helping !
Hey, code for option 2 is there in the 2nd link in the comment. You can refer it for your implementation.
I havent made a video for the coding part.
thank you so much for the explanation. but i have a question, why we should resize the image resolution to 64x128? can we do with the original size?
This 64x128 dimension was used in the original HOG paper to detect pedestrians. The dataset they used had around 1805 images of humans cropped in 64x128 patches.
In reality there is no such constraint. You can have images of any size.
Sorry for the confusion, I should have mentioned this in the video.
Thanks for pointing this out.
9 Column, 1 row
These features are scale or rotation invariant ?
No, they are not scale or rot invariant
Then if i trained the features of Hog of images . If in future test image will be rotated or some affect in scale . It will incorrectly classify .
How scale and rotation invariance achieve in HOG
@@hamzanaeem4838 HOG may not be best fit for this case. Instead you can try other feature descriptors as mentioned here: dsp.stackexchange.com/a/1642
Honestly, I never had a chance to apply/use these for any of my projects. So, I may not be the best person to answer this with conviction.
Dear Sir,
I have a doubt. I a unable to understand theoretically how finally we get the outline of the shape of the object? how those white dots in the output are plotted? My doubt might sound very silly but i request you to clarify my doubt
Hey, those outputs are got from HOG. I have explained it in the previous videos: ruclips.net/video/Qwc3a8cOKRU/видео.html
Or you can watch from beginning: ruclips.net/video/5YLn5i_qkTI/видео.html
Once we get the HOG output. We train a SVM classifier to detect such patterns.
Basically, if we have images of people standing, then the HOG output will all look similar.
And the SVM Classifier will be able to identify such patterns.
But of course, if you feed an image of person sitting, then the HOG output pattern will be different and the SVM Classifier may not be able to detect it.
So, to build such generic detectors, we can use CNNs which act as much better feature extractors.
Let me know if I need to elaborate.
@@Cogneethi Dear Sir,
Thanks a lot for your response.
With which dataset or what data is used to train svm? I mean svm classifier needs to be trained with hog output so that next time when a new hog output is fed as input to svm, it classifies yes or no?
Kindly respond
@@ms.keerthanabcnmamitcse3448 pascal.inrialpes.fr/data/human/
@@Cogneethi sir thanks a lot for your timely response.
amazingggggggggggggggggggggg
Pleas sir I wanted code for image splicing detection
How to resize from 150 * 300 to 64*128?
any standard image library will do. check python PIL. Even pytorch has it i guess.
@@Cogneethi ohhh! Thank you very much.
nice explanation, why is is 180 and not 360!!
Hey good question, I never got that doubt. I only checked now.
Supposedly, the authors got better results by using unsigned gradients (0-180) than signed (0-360).
arctan(x) of any number is between -90 to 90. So, they must be shifting this to 0-180* range.
www.learnopencv.com/histogram-of-oriented-gradients/
lilianweng.github.io/lil-log/2017/10/29/object-recognition-for-dummies-part-1.html
devanginiblog.wordpress.com/2016/05/10/hog-histogram-of-gradients/
Thanks for the asking.
@@Cogneethii have a question, x direction and y direction are absolute value so they are only positive numbers, arctan(x) is from 0 to 90 for x positive values and -90 to 0 for negative x values. That means that the direction can only go from 0-90. Am i worng or there is something wrong in the video?
@@simoneserafini7917 Hey, error in video. It is not absolute value.
We do need to consider the sign. That way, we will get the direction correctly between -90 to 90. Then it is probably shifted to 0 to 180 range.
While calculating magnitue, the sign gets cancelled out due to the square.
Thanks for pointing out the mistake.
Very well explained. Thank you so much.