Ask Your Question
0

Unpredictable behaviour from cv::HOGDescriptor::detectMultiScale, depending on input.

asked 2016-01-18 11:21:34 -0600

digtooni gravatar image

Hi,

I am trying to implement a HOG SVM detector using my own training data and have had trouble getting it to work reliably. I am using OpenCV 2.4 in visual studio.

I am using the SVMlight library which generates a descriptor vector and a hit threshold for the HOGDescriptor object. I set the HOG object using this descriptor vector and run detectMultiscale using the hit threshold generated by SVMlight. What will happen is my program will stall on this function indefinitely. However if I change the descriptor vector to the default people detector provided by OpenCV then I begin to get detections again.

The default people descriptor vector is 1981 values in length with hit threshold 0. My SVMlight trained descriptor vector is 3781 values in length with hit threshold -0.6566.

If I change the hit threshold to from -0.6566 to zero, I also start to get detections, although they are often false positives since this is the incorrect threshold.

Another issue I have is if I try to set a custom window size (48x48) for example, I get an assertion error: checkDetectorSize() with no more feedback to help me understand the problem.

My question is, does anyone know what I could do to work around these problems? Could it be SVMlight? Is there another SVM library I can use to train the detector? Are these bugs inherent to the HOG class in OpenCV 2.4?

Thanks for the help, I can provide more detailed information if required.

edit retag flag offensive close merge delete

Comments

1
  • If you change the window size, you're changing the vector length. You can't use a window size that produces a vector whose length is different from that used for training the classifier
  • I'm not familiar with SVMlight, but the hit threshold param is a detection param, independent of the training. It controls the minimum required confidence to output a positive detection. Thus, afaik, there's no hit threshold associated with a particular trained model (I don't know how you assure -0.6566 is the right threshold - why? in what conditions?). Moreover, are you sure that the hit threshold means the same in both libraries?
  • You can always use the SVM implementation of the ml module to train your own classifier, although you'll need to use your our multiscale sliding-window mechanism for HOG
LorenaGdL gravatar imageLorenaGdL ( 2016-01-18 13:31:40 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-01-21 04:58:02 -0600

digtooni gravatar image

updated 2016-01-21 04:58:49 -0600

Hi thanks for your reply.

I will check the window sizes again to make sure I'm using the same window size to both train and detect.

SVMlight outputs a "model" with the various support vectors, a bunch of different kernel parameters and a "threshold" value. I always assumed this is what was expected in the "hit_threshold" parameter of HOGDescriptor::detectMultiScale. If you don't mind me asking, how should one look to finding the correct threshold value? Should this be optimised through trial and error, or using a cost function?

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-01-18 11:21:34 -0600

Seen: 852 times

Last updated: Jan 18 '16