Ask Your Question

Revision history [back]

Okay some basic comments

  • I've create a classifier using Haartraining_Stuff --> first bad start. OpenCV moved to a better and more stable C++ interface of the cascade classification algorithm, called train_cascade, which can be found in the apps folder, right here. Use that one and not the old, deprecated and not mainted haartraining interface. You will even notice that the latest version doesn't even have it anymore.
  • Despite the name has changed to a more universal name, it still supports the HAAR wavelets, just lost a tons of bugs that were in the algorithm.
  • A cascade with only 2 stages will never work, it basically defeats the purpose of building a cascade of weak classifiers to get a strong classifier. If you do not grasp this remark, read the official paper by Viola and Jones.
  • A minimum hit rate of 0.01 means that you can misclassify up to 99 percent of your positive samples on a weak stage? This seems plain wrong. Default it is 0.995 so that you only misclassify 0.5 percent of your positive samples. You could lower it a bit, but not to much, because else you will make a too generic model. Making it to high like 0.999 will make sure that you will soon have a setup that is not achievable, because there are always positives that cannot be matched into the current weak classifier structure.
  • -maxFalseAllarmRate typo like pointed out by @Eduardo, thank you for that!
  • -numPos 2 will never work. The principle of cascades is that you learn a model from a lot of data. In this case you will soon run out of positive samples that are correctly classified by each weak classifier, since your minHitRate is not at 1 (which will never work as explained before) and thus those 2 samples will get discarded quite soon. On the other hand you will completely overfit your model to this 2 object instances.
  • Increase your precalculation buffers. With 256MB you will not train a decent model, since to much memory is needed for storing all the features from the AdaBoost process. There is a reason why it is on 1GB by default for the moment.

Try adapting all this and see where it gets you!