Ask Your Question
0

OpenCV 3.0.0 - traincascade.exe : Traindata set for temp stage cannot be filled

asked 2015-12-03 13:38:39 -0600

anushka123shet gravatar image

updated 2015-12-04 11:55:05 -0600

Hi,

So, I have 20 positive samples and 500 negative samples. I created the .vec file using createsample utility.Now, when i try to train the classifier using the traincascade.exe utility, I run into the following error:

image description

I have looked into many solutions given to people who have faced similar issues, but none of them worked.

Things I tried: 1. Increasing the negative sample size 2. Checking the path of the negative(or background images) stored in the Negative.txt file 3. Varying different parameters.

Here is some information regarding the path: My working directory has the following files: 1. Traincascade.exe 2. Positive image folder 3. NegativeImageFolder 4. vec file 5. Negative.txt (file that has path to images in the negative image folder)

My Negative.txt file has the absolute file path for the images in the negative image folder. I also tried changing the file path to the following format:

NegativeImageFolder\Image1.pgm

but didn't work! I tried both front and backslash too!

I have run out of ways to change the file path or make any modification to make this work!

Any help on this would be highly appreciated! I am unable to proceed any further with my project.

Thanks in advance

edit retag flag offensive close merge delete

Comments

1

-numStages 1 will never work o_O the principle of a cascade classifier is that you combine multiple weak classifiers into a strong one. Try putting it at least on like 5 stages. If you want a single stage of trees, then you will need the rtree software of OpenCV.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-12-04 05:01:06 -0600 )edit

Also, please remove CAPS, its like shouting and won't encourage us to help you faster then others...

StevenPuttemans gravatar imageStevenPuttemans ( 2015-12-04 05:01:56 -0600 )edit
1

Thanks Steven!

I initially started with 10 stages. That didn't work. I just landed up trying different values for -numStages to see if it would make any difference since I couldn't figure out what exactly was causing the error. I tried agan with 5 stages, I get the same error.

anushka123shet gravatar imageanushka123shet ( 2015-12-04 11:58:17 -0600 )edit

Also, sorry about the CAPS. I guess I was just too desperate for some help on this one. I have been stuck with this for almost 3 whole days now. Anyway, will remove the caps right away :)

Please do let me know if any other suggestions comes across your mind.

anushka123shet gravatar imageanushka123shet ( 2015-12-04 11:59:34 -0600 )edit

@StevenPuttemans To be precise, in your first comment, is it not "the principle of a cascade classifiers is to combine multiple" strong classifiers into a cascade of classifiers (also called the attentional cascade in the paper) instead of weak ?

Eduardo gravatar imageEduardo ( 2015-12-04 13:22:24 -0600 )edit

@Eduardo, nope it is not. You combine multiple classifiers that are good at seperating the positives but only better than random guessing on the negatives, hence weak classifiers, until the overall performance of the cascade reaches a high accuracy on the negative sample rejection while maintaining the positive sample acceptance. That is called combining a cascade of weak classifiers into a strong classifier.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-12-06 05:42:28 -0600 )edit

But it might depend on how you see a weak classifier :D

StevenPuttemans gravatar imageStevenPuttemans ( 2015-12-06 05:42:50 -0600 )edit

What I have understood is that a weak classifier classifies an input window using only a single feature and the corresponding threshold, that's why I think the confusion when I read your comment.

Eduardo gravatar imageEduardo ( 2015-12-07 13:09:33 -0600 )edit

@Eduardo well that depends on the configuration. The rule for a weal classifier by default is that you do better then random guessing on the negatives. By default OpenCV uses tree stumps, which are single depth, single feature decision trees. However a single feature might not be able to get a FArate below 0.5, so that is where you add a second stump, and so on, untill you reach the FA value. Basically each stump is already a very weak classifier, but both paper of viola and jones as implementation in OpenCV speak of weak classifiers when a stage agreement due to parameters are reached.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-12-08 01:11:23 -0600 )edit

@StevenPuttemans Thanks for your explanation.

Eduardo gravatar imageEduardo ( 2015-12-08 07:24:17 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-12-07 15:51:34 -0600

anushka123shet gravatar image

I figured out the mistake and got it running. My Negative.txt file was unicode while OpenCV doesn't support unicode. http://code.opencv.org/issues/3235

I wish I had researched this well before itself, would have saved both your and my time. Don't know how I missed this. But thanks again for the effort :)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-12-03 13:26:25 -0600

Seen: 678 times

Last updated: Dec 04 '15