Train dataset for temp stage can not be filled.
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
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 thefillPassedSamples
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.
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
You're welcome ;) Cascade training is sometimes picky with paths and structures
A general rule when using cascade training = absolute paths, it makes your life sooo much easier ;)