opencv haartraining training error-penCV Error: Assertion failed (elements_read == 1) in unknown fun

来源:互联网 发布:福利王朝邀请码淘宝 编辑:程序博客网 时间:2024/06/05 06:14

problem:

opencv haartraining training error:

Parent node: 2

*** 1 cluster ***
OpenCV Error: Assertion failed (elements_read == 1) in unknown function, file 
..
\..\..\..\apps\haartraining\cvhaartraining.cpp, line 1859


solution:

The problem is that your vec-file has exactly the same samples count that you passed in command line -numPos 979. Training application used all samples from the vec-file to train 0-stage and it can not get new positive samples for the next stage training because vec-file is over. The bug of traincascade is that it had assert() in such cases, but it has to throw an exception with error message for a user. It was fixed in r8913. -numPose is a samples count that is used to train each stage. Some already used samples can be filtered by each previous stage (ie recognized as background), but no more than (1 - minHitRate) * numPose on each stage. So vec-file has to contain >= (numPose + (numStages-1) * (1 - minHitRate) * numPose) + S, where S is a count of samples from vec-file that can be recognized as background right away. I hope it can help you to create vec-file of correct size and chose right numPos value.


http://stackoverflow.com/questions/10863560/haar-training-opencv-assertion-failed