Sorry, this content is no longer available

Ask Your Question
1

opencv_traincascade

asked Feb 21 '14

antonio.paes gravatar image

updated Feb 22 '14

berak gravatar image

I have this error in opencv_traincascade.exe

OpenCV Error: Bad argument (Can not get new positive sample. The most possible r eason is insufficient count of samples in given vec-file. ) in CvCascadeImageReader::PosReader::get, file C:\builds\2_4_PackSlave-win32-vc 11-shared\opencv\apps\traincascade\imagestorage.cpp, line 162

I pass following parameters :

opencv_traincascade.exe -data data/cascade -vec data/vector.vec -bg negative/infofile.txt -numPos 2000 -numNeg 4000 -numStages 30 -w 30 -h 30 -featureType LBP -minHitRate 0.9 -maxFalseAlarm 0.005 -mode ALL

my vector.vec contain 2000 samples.

any idea ? Thanks guys !!

Preview: (hide)

1 answer

Sort by » oldest newest most voted
1

answered Feb 22 '14

Hi antonio I feel the reason behind the error is anyone of the three. 1)The number of negative images must be greater than twice the number of positive images. 2)Try to set numPos = 0.9 * number_of_positive_samples and 0.99 as a minHitRate. 3)vec-file has to contain >= (numPose + (numStages-1) * (1 - minHitRate) * numPose) + S, where S is a count of samples from vec-file.S is a count of samples from vec-file that can be recognized as background right away.

Hope this helps you:)

Preview: (hide)

Comments

First thanks for the answer...

In my case would numPos = 0.9 * 2000 = 1800 and vec-file = (1800+(30 -1) * (1 - 0.99) * 1800) + 2000 = 4322 this is correct ?

and more one time thanks man..

antonio.paes gravatar imageantonio.paes (Feb 23 '14)edit

You are welcome and in your case the calculations seem good,hope everything goes well.To check the proper working you could reduce the number of stages and test it,but be patient,the process usually takes time.Also if my answer worked properly,dont forget to vote to it up as it will help others too.For any further problems contact me at: http://abhishek4273.wordpress.com/

I'll keep trying, thanks for the clarification helped me a lot, I was confusing the-numPos with total examples in vec-file ..

Thanks,.

antonio.paes gravatar imageantonio.paes (Feb 23 '14)edit

Question Tools

Stats

Asked: Feb 21 '14

Seen: 1,112 times

Last updated: Feb 22 '14