Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Custom HOGDetector using CvSVM and HOG features.

Hey, Im trying to create my own custom detector using the existing HOGDetector and setSVMDetector.

Please see my question on stack overflow:

Question

I am having trouble making detect and detectMultiScale work. Please help me out.

Custom HOGDetector using CvSVM and HOG features.

Hey, Im I'm trying to create train my own custom detector using the existing HOGDetector and setSVMDetector.

Please see my question on stack overflow:

Question

I am for use with OpenCV::HOGDescriptor but I'm having trouble making detect and detectMultiScale work. Please help the existing HOGDescriptor work with my newly trained SVM.

I have calculated HOG features for positive and negative training images, labeled them and trained the SVM using CvSVM. The parameters I have used are:

CvSVMParams params;
params.svm_type =CvSVM::EPS_SVR;
params.kernel_type = CvSVM::LINEAR;
params.C = 0.01;
params.p = 0.5;

Then I calculate Primal Form of the support vectors so that I only get one vector instead of many and set the calculated support vector using HOGDescriptor.setSVMDetector(vector);

This is Primal Form

When I use CvSVM.predict() I am able to correctly classify objects with the SVM, but HOGDescriptor.detect() or detectMultiScale() always returns a lot of positive matches and does not give accurate predictions.

CvSVM.predict() uses the original support vectors for classification so there might be something wrong with the way I'm calculating primal form.

Is there anyone who has trained their own detector who can point me out. in the right direction?

Custom HOGDetector using CvSVM and HOG features.

I'm trying to train my own detector for use with OpenCV::HOGDescriptor but I'm having trouble making the existing HOGDescriptor work with my newly trained SVM.

I have calculated HOG features for positive and negative training images, labeled them and trained the SVM using CvSVM. The parameters I have used are:

CvSVMParams params;
params.svm_type =CvSVM::EPS_SVR;
params.kernel_type = CvSVM::LINEAR;
params.C = 0.01;
params.p = 0.5;

Then I calculate Primal Form of the support vectors so that I only get one vector instead of many and set the calculated support vector using HOGDescriptor.setSVMDetector(vector);

This is Primal Formprimal form.

When I use CvSVM.predict() I am able to correctly classify objects with the SVM, SVM with high accuracy, but HOGDescriptor.detect() or detectMultiScale() always returns a lot of positive matches and does not give accurate predictions.

Here is my code for flattening the vector.

My trained svm model file

I am not able to find much information about how to make the trained svm model work with HOGDescriptor. CvSVM.predict() uses the original trained support vectors for classification so there might be something wrong with the way I'm calculating primal form.

Is there form to feed into HOGDescriptor.setSVMDetector(). Have anyone who has trained their own detector who tried something similar and can point me in the right direction?direction?