Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to train my own waldboost detector to detect vehicles in OpenCV 3.3

Recently I have paid many time in finding an efficient method to detect car objects using OpenCV. I have found that in opencv 3.0, one of the update (in the release note, https://github.com/opencv/opencv/wiki/ChangeLog ) says:

"Car detection using Waldboost, ACF by Vlad Shakhuro and Nikita Manovich "

And in Opencv 3.1, the update becomes:

"Improved ICF detector, waldboost implementation – opencv_contrib/xobjdetect (Vlad Shakhuro, Alexander Bovyrin)"

I have also found that some one had successfully applied the waldboost detector to detect cars, such as the following two papers:

  1. C. Caraffi, T. Vojíř, J. Trefný, J. Šochman and J. Matas, "A system for real-time detection and tracking of vehicles from a single car-mounted camera," 2012 15th International IEEE Conference on Intelligent Transportation Systems, Anchorage, AK, 2012, pp. 975-982.
  2. J. Sochman and J. Matas, "WaldBoost - learning for time constrained sequential detection," 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR'05), 2005, pp. 150-156 vol. 2. These achievements indicate that Waldboost detector should be valid / suitable for car detection, which is well fit my purpose.

To accomplish this goal, I have collect enough positive samples/negative samples. I use opencv 3.3 with opencv 3.3 contribution package for experiment. After correctly configuration, there should be an executable file named "opencv_waldboost_detector", which can be used for training my own classifier.

After finishing my training, the output of the terminal ( I work under ubuntu 16.04) is below:

>

And also I got a *.xml file which is the target classifier. However, when I test this classifier, the detect objects are very strange. It can not detect any valid car, but only some background rectangle. I want to know what is wrong with this trained classier. Or are there any important steps which I ignored? (I do not know how to upload the screenshots)

How to train my own waldboost detector to detect vehicles in OpenCV 3.3

Recently I have paid many time in finding an efficient method to detect car objects using OpenCV. I have found that in opencv 3.0, 3.0, one of the update (in the release note, https://github.com/opencv/opencv/wiki/ChangeLog ) says:

"Car detection using Waldboost, ACF Waldboost, ACF by Vlad Shakhuro and Nikita Manovich "

And in Opencv 3.1, 3.1, the update becomes:

"Improved ICF detector, waldboost waldboost implementation – opencv_contrib/xobjdetect (Vlad Shakhuro, Alexander Bovyrin)"

I have also found that some one had successfully applied the waldboost detector to detect cars, such as the following two papers:

  1. C. Caraffi, T. Vojíř, J. Trefný, J. Šochman and J. Matas, "A system for real-time detection and tracking of vehicles from a single car-mounted camera," 2012 15th International IEEE Conference on Intelligent Transportation Systems, Systems, Anchorage, AK, 2012, pp. 975-982.
  2. J. Sochman and J. Matas, "WaldBoost - learning for time constrained sequential detection," 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR'05), (CVPR'05), 2005, pp. 150-156 vol. 2. 2.

These achievements indicate that Waldboost Waldboost detector should be valid / suitable for car detection, detection, which is well fit my purpose.

To accomplish this goal, I have collect enough positive samples/negative samples. I use opencv 3.3 with opencv 3.3 with opencv 3.3 contribution package contribution modules for experiment. After correctly correct configuration, there should be an executable file named "opencv_waldboost_detector", "opencv_waldboost_detector", which can be used for training my own classifier.

I used the following command to train my classifier (samples in folder "positiveImgs" are scaled to 24x24 according to the code, if I fully understand)(however, I do not apply any scale operations to the images in "negativeImgs", only keeping them unchanged):

./opencv_waldboost_detector train waldboost.xml ./positiveImgs ./negativeImgs

After finishing my training, the output output of the terminal terminal ( I work under ubuntu 16.04) is below:

>somewhat like (only an example, because I have lost the original data while writing this question):

i=1009 feat= 6439 thr=195 casthr=0.586 alpha=0.095 err=0.453 loss=1.044e-2 neg 361/353 i=1010 feat= 6423 thr=240 casthr=0.684 alpha=0.098 err=0.451 loss=1.089e-2 neg 353/345 i=1011 feat= 1312 thr= 97 casthr=0.578 alpha=0.106 err=0.447 loss=1.050e-2 neg 345/345

And also I got a *.xml *.xml file which is the target classifier. However, when I test this classifier, the detect objects are very strange. It can not detect any valid car, but only some background rectangle. I want to know what is wrong with this trained classier. Or are there any important steps which I ignored? (I do not know how to upload the screenshots)

End state of training from terminal: image description

training examples (negative images, around 50000 examples ): image description

training examples (positive images, about 10000+ examples): image description

detect results (using the trained xml file ): image description

Could someone tells me what is wrong with the waldboost detector? why it does not work for my problem?

Thank you for anyone who answers this question in advance.