這個問題是由上OpenCV的DevZone網站的實用工具創世in June 2012.
回答引述瑪麗亞:
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.
它爲我工作。我也有同樣的問題,我是繼famous tutorial on HAAR training,但想嘗試與 -npos 7000 -nneg 2973
較新的訓練工具,所以我做了以下Calcs(計算):
VEC文件必須包含> =( numPos +(numStages-1)*(1 - minHitRate)* numPos)+ S
7000 >= (numPos + (20-1) * (1 - 0.999) * numPos) + 2973
(7000 - 2973)/(1 + 19*0.001) >= numPos
numPos <= 4027/1.019
numPos <= 3951 ~~ 3950
,並用於:
-npos 3950 -nneg 2973
它的工作原理。我還注意到其他人也在減少numPos方面取得了成功:here
您正在使用哪種版本的OpenCV?這可能是下面的斷言失敗:'assert(img-> rows * img-> cols ==((CvVecFile *)userdata) - > vecsize);' 這意味着行和列不對應的大小矢量。但我不知道是什麼原因造成的。 –
嗨,我使用預裁剪圖像64X128的opencv 2.4。謝謝 – valentin
你可以找出它是否只是一個特定的圖片,導致這一點,或者如果他們都沒有工作?如果它是一個特定的圖像,你可以看到hwat在這個圖像中是不同的。如果所有這些都不起作用,我們可以看看這些圖像本身。 –