# HOG detectmultiscale weight scale explanation

Hello all,

I'm currently working with the HOG detector in OpenCV and it returns fairly good results. I only have one question, the detectmultiscale function sets the weights for each detection ROI. But what is actually the scale of good to bad? Maybe this is a really dumb question but I can't find it. I thought close to 1.0 is good but I'm getting weights of 2.0. So what is the actual scale because I thought it is from 0.0 to 1.0

edit retag close merge delete

Sort by » oldest newest most voted

Quick answer: the larger, the better (the more confident)

A little bit more explanation:

The weight returned by the method for each ROI is the distance from the sample to the SVM separating hyperplane (in its corresponding kernel space). Therefore, a larger distance indicates a sample classifier with a larger confidence, as it is more far away for the other class samples. There is no upper limit for such distance, so you can't normalize and get direct probabilities from the distances. However, there are some methods to perform such convertion (e.g. the LIBSVM library implements some probability estimates, refer to its manual for details and related papers).

Also, every SVM is normalized during training, so that the distance from the separating hyperplane to each support vector sample is 1.0. Therefore, every sample with weight 0.0-1.0 lies in th SVM margin. If you want to know more about SVM in detail, refer to

Christopher J. C. Burges. 1998. A Tutorial on Support Vector Machines for Pattern Recognition. Data Min. Knowl. Discov. 2, 2 (June 1998), 121-167

more

So If I get this right a higher probability is further away from the SVM hyperplane, which makes it more confident. The detectmultiscale function has a threshold and maxThreshold parameter, my understanding of those parameters is that they are the minimal and maximum distance of the separating SVM hyperplane. So if I set the minimal threshold at 1, it should only return probabilities that have a distance to the hyperplane of at least 1, right?

( 2016-05-28 10:10:50 -0500 )edit

Yes, the hitThreshold param sets the minimum distance to the separating hyperplane. I don't know which param are to referring to as the maxThreshold...

( 2016-05-28 12:27:09 -0500 )edit

Thank you very much for the explanation! The actual name of the parameter is finalThreshold. I'm using the Java interface so maybe there is a difference in the C++ version.

( 2016-05-29 06:52:43 -0500 )edit

The finalThreshold param refers to something quite different in fact (yep, the name might be confusing). It controls the non-maxima supression algorithm that groups similar ROIs. It is the groupThreshold param of the groupRectangles() function.

( 2016-05-29 07:24:36 -0500 )edit

That is indeed confusing. Thank you for the explanation! I wished that OpenCV docs were a bit more user friendly, it expects you to know every detail of the algorithm.

( 2016-05-29 11:51:23 -0500 )edit

Official site

GitHub

Wiki

Documentation