I\'m building the opencv_traincascade.exe tool from source code (OpenCV 2.4.0) using vs2010 on windows 7. I want to train a LBP classifier, so I\'m using opencv_traincascade
I’ve had this issue several times, and it ended up being caused by me generating my .vec
file with the wrong dimensions specified for my positive images.
For example, I had 700 positive images that were 100×100 pixels, and I successfully generated my .vec
with them. So my text file looked like this:
/filepath/directory/image1.jpg 1 0 0 100 100
/filepath/directory/image2.jpg 1 0 0 100 100
…
But then when I tried to train my cascade HAAR file, the images were too big. So I resized them to 50×50, and recreated my .vec
(specifying in the command line the new size) with the downsized images.
The .vec
supposedly successfully created, but when I then try to train, I get the error. Once I recreated my text file with the correct dimensions, recreated my .vec
file, and tried to train again, the error went away. The other issue I've had is when the negatives file has errors in it, like a bad path or some other issue; all the other comments have good suggestions for figuring out what might be wrong with the -bg file too. Hope this helps.