Ask Your Question
1

opencv_traincascade

asked 2014-02-21 09:26:56 -0500

antonio.paes gravatar image

updated 2014-02-22 06:10:08 -0500

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 !!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-02-22 05:58:20 -0500

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:)

edit flag offensive delete link more

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 ( 2014-02-23 07:38:51 -0500 )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/

Abhishek Kumar Annamraju gravatar imageAbhishek Kumar Annamraju ( 2014-02-23 07:48:49 -0500 )edit

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 ( 2014-02-23 07:55:23 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2014-02-21 09:26:56 -0500

Seen: 671 times

Last updated: Feb 22 '14