Ask Your Question

Revision history [back]

Lets start by referring you to chapter 5 of the OpenCV 3 Blueprints book. I am still quite convinced [and let's ignore the fact that I was the author] it has one of the most detailed explanations of all the parameters and their influence when training cascade classifiers, simply because all those blogs got it wrong in 90% of the cases.

Some comments on your parameters

  • As pointed out by @berak a resolution of 290x150 pixels will be too large probably. Not only will it need a great amount of memory (although you have 32GB), it will yield millions of features. For example, the 24x24 pixel face detector has already 35000 unique features. And it raises exponentially. That means that for calculating each weak classifier, you will need to evaluate all those features over your training set to select the strongest one (boosting process) and thus that will take ages.
  • For now, you are not using the full potential of your memory. By default -precalcValBufSize and -precalcIdxBufSize are limited to 2GB of memory ... so increase them to at least 8-10 GB in your case.
  • Make sure your OpenCV is built with TBB, it helps a bit in the parallelized parts of the training.
  • Same number of positives and negatives usually doesn't work. In my case I always end up with 1:4 ratios up to even 1:25 ratios when having large numbers. There is simply alot that your detector has to identify as negatives!

Also, try the search bar on this page, I guess it has been explained over multiple 100's of times already into quite the detail!