# Help in Retraining a HOG Descriptor using SVMLight

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.

• 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)? – Peter K. Apr 19 '13 at 11:48
• No. Do you think that the modification of aspect ratio is the problem? – bonchenko Apr 22 '13 at 1:31
• 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? – nkint Jan 28 '14 at 10:01
• I skipped detecting car and change to people detection... sorry cannot help you there mate – bonchenko Jan 28 '14 at 12:32