Ask Your Question

Revision history [back]

Hi,

I had this similar problem which gives error:

POS count : consumed   50 : 50
Train dataset for temp stage can not be filled. Branch training terminated.

The problem was that, my bg.txt was generated in a Windows system using \r for next line. When I tried to use opencv_traincascade in Ubuntu, it read '\r' into the string for filelist, thus in CvCascadeImageReader::NegReader::nextImg() , the line src = imread(imgFilenames[last++], 0); did not work.

My fix was to add str.erase(std::remove(str.begin(), str.end(), '\r'), str.end()); before imgFilenames.push_back(dirname + str); in imagestorage.cpp

I hope this helps. I also posted the similar answer here : http://answers.opencv.org/question/16868/error-in-train-casacde/?answer=53164#post-id-53164 .