Ask Your Question
0

Train dataset for temp stage can not be filled.

asked 2015-09-11 15:07:53 -0600

kburnham gravatar image

I am receiving the error above when I try to run the opencv_traincascade utility.

I am running the following command:

./opencv_traincascade -vec faces.vec -data cascadetrain/ -numPos 540 -numNeg 200 -bg negatives/bg.txt -numStages 2 -featureType LBP

The output consists of a summary of the parameters followed by:

===== TRAINING 0-stage =====

<begin< p="">

POS count : consumed 540 : 540

Train dataset for temp stage can not be filled. Branch training terminated. Cascade classifier can't be trained. Check the used training parameters.

This error appears to be the result of a problem with the .txt file that lists the locations of negative samples however that file appears to be in the appropriate format with each image listed on its own line as follows:

imgs/image1.jpg
imgs/image2.jpg
imgs/imgge3.jpg

I have tried a number of different parameter settings, but continue to receive the same error.

I had 611 image files with annotations that I used with the create_samples utility to create the faces.vec file. I also have 611 negative/background images.

If anyone has any ideas for what I might try next, I would be most appreciative.

Thanks,

Kevin

edit retag flag offensive close merge delete

Comments

Some more info:

It appears to fail because the updateTrainingSet function in cascadecalssifier is returning False. Since that function does print out the "POS count" int must then be failing in the next step when the fillPassedSamples function is called with isPositive set to false. It appears that this function may be unable to execute imgReader.getNeg( img ) so it returns 0. But I can't figure out why.

This poster seems to have a similar problem, but it is not clear to me how (or if) it was eventually resolved.

kburnham gravatar imagekburnham ( 2015-09-12 13:02:39 -0600 )edit
1

Thank you LorenaGdl! Moving my bg.txt and imgs folder up a level seems to have done the trick. I think if you change your comment to answer I can mark it solved. best, kb

kburnham gravatar imagekburnham ( 2015-09-12 14:11:31 -0600 )edit
1

You're welcome ;) Cascade training is sometimes picky with paths and structures

LorenaGdL gravatar imageLorenaGdL ( 2015-09-12 14:23:03 -0600 )edit

A general rule when using cascade training = absolute paths, it makes your life sooo much easier ;)

StevenPuttemans gravatar imageStevenPuttemans ( 2015-09-14 08:04:05 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-09-12 13:35:28 -0600

LorenaGdL gravatar image

Are you sure all your paths are correct? To work with the arguments and text files you posted, your folders structure should be something like:

|-- faces.vec
|-- negatives (folder)
   |-- bg.txt
   |-- imgs (folder)
      |-- image1.jpg
      |-- image2.jpg

If that is what you're using, I'd try 2 things: 1st) use full paths to every file instead of relative paths and 2nd) use this structure instead:

|-- faces.vec
|-- bg.txt
|-- imgs (folder)
    |-- image1.jpg
    |-- image2.jpg

(you would call function with -bg bg.txt)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-09-11 15:07:53 -0600

Seen: 263 times

Last updated: Sep 11 '15