I am currently trying to count cars using OpenCV 2.4.4 with a HOG descriptor. Because a model for car detection is not available in OpenCV, I am creating my own model using SVMLight and a dataset of cars from the INRIA car dataset here (positive and negative samples).

I created the model using the positive and negative samples with SVMLight (I resized the images to 128 * 104 because a HOG image must be power of 2), by following this tutorial and code. I applied the model to my program, and it detected cars correctly, but also with lot of false positives (3- 8 false positives per image).

I read in Dalal paper about the HOG Detector, and I found out that the model needs to be retrained using false positives found by applying the preliminary model on the negative samples. The resulting patches came in varying sizes, so again, I resized it to 128*104 px.

I reran the HOG training program using positive and negative samples like the preliminary run, but this time, I added the false positives on the negative samples (this is what I think of retraining based on the paper by Dalal). Then I have the retrained model.

Unfortunately, I ran the car detection program using the new model, but all images returned with no car detection although I used positive sample images and other images with a car in it.

This is very interesting and I am curious if any of you can point out what have I done wrong.

  • $\begingroup$ When you say The resulting patches comes in varying size are the patches still the right aspect ratio (i.e. the same as 128 $\times$ 104)? $\endgroup$
    – Peter K.
    Commented Apr 19, 2013 at 11:48
  • $\begingroup$ No. Do you think that the modification of aspect ratio is the problem? $\endgroup$
    – bonchenko
    Commented Apr 22, 2013 at 1:31
  • $\begingroup$ I'm not a HOG guru, I'm still approaching the problem and I'm still very confused but I think the modification of the aspect ration will for sure be a problem.. How have you resolved in the end? $\endgroup$
    – nkint
    Commented Jan 28, 2014 at 10:01
  • $\begingroup$ I skipped detecting car and change to people detection... sorry cannot help you there mate $\endgroup$
    – bonchenko
    Commented Jan 28, 2014 at 12:32


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.