Ask Your Question
0

OpenCV Error: Bad Argument <Can not get new positive sample....

asked 2015-04-09 01:36:00 -0600

aliavci gravatar image

Although I experimented with many different numpos values, including just 1 and not declaring what numpos is at all, I keep getting this error.

With: C:\opencv\build\x64\vc10\bin\opencv_traincascade.exe -data DoneHere -vec IMPORTANTVEC.vec -bg allnegatives.txt -mode ALL -w 24 -h 24

I know this question has been asked many times before, giving an equation of what numpos needs to be. I tried the equation, and many other numpos values too yet no output.

Please let me know what may be causing this.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2015-04-09 04:33:32 -0600

tomnjerry gravatar image

updated 2015-04-09 06:12:52 -0600

The training of traincascade requires you to provide it with positive images (images having object) and negative images (images without the objects). The .vec file contains the information of all the images which are to be used by training network in binary format. Now when you are training the cascade, the numPos and numNeg indicate the number of samples which cascade should be using for training. So numPos and numNeg cannot be left undeclared else some default value for each gets assigned which are mostly 2000 and 1000 respectively which ultimately would give an error.

Also note that the numPos should always be less than the number of images used to generate vec file. This is because every time an image is falsely classified as being negative (i.e the image contains object but cascade couldn not locate it), unconsumed images are picked for training process. If the numPos is eqaul to the number of images used for vec file, it wont be left with any unconsumed images, leaving you with 'Can not get new positive sample' error.

edit flag offensive delete link more

Comments

Thank you for your answer. However, I even tried making numpos =1 yet it still doesn't work

aliavci gravatar imagealiavci ( 2015-04-09 15:09:56 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-04-09 01:36:00 -0600

Seen: 2,180 times

Last updated: Apr 09 '15