Ask Your Question

kburnham's profile - activity

2015-09-12 14:11:31 -0600 commented question Train dataset for temp stage can not be filled.

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

2015-09-12 13:02:39 -0600 commented question Train dataset for temp stage can not be filled.

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.

2015-09-11 15:07:53 -0600 asked a question 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

2015-09-11 08:02:52 -0600 commented answer traincascade error - _cascadeDirName or _bgfileName or _vecFileName is NULL

Thank you.

2015-09-11 08:02:46 -0600 received badge  Scholar (source)
2015-09-10 14:41:16 -0600 asked a question traincascade error - _cascadeDirName or _bgfileName or _vecFileName is NULL

Hi,

I am trying to train a cascade classifier with opencv_traincascade, but I keep getting the error:

_cascadeDirName or _bgfileName or _vecFileName is NULL

The specific command I am using is:

./opencv_traincascade vec ~/Documents/Kaggle/whale_faces.vec -data ~/Documents/Kaggle/cascadetrain -bg ~/Documents/Kaggle/negatives/bg.txt -numPos 10 -numNeg 50

And I get the error:

``` OpenCV Error: Bad argument (_cascadeDirName or _bgfileName or _vecFileName is NULL) in train, file /tmp/opencv20150810-26088-1150u2z/opencv-2.4.12/apps/traincascade/cascadeclassifier.cpp, line 146 libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /tmp/opencv20150810-26088-1150u2z/opencv-2.4.12/apps/traincascade/cascadeclassifier.cpp:146: error: (-5) _cascadeDirName or _bgfileName or _vecFileName is NULL in function train

Abort trap: 6 ```

All of the folders and files are valid. I am able to view the vec file with opencv_createsamples.

Does anyone know how I might fix this error? Thanks for the help.

Kevin