Error “Train dataset for temp stage can not be filled.” while using traincascade tool of OpenCV

前端 未结 10 994
灰色年华
灰色年华 2020-12-16 20:35

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

10条回答
  •  时光说笑
    2020-12-16 20:47

    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); (as xeed mentioned) 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, if anyone still struggles.

提交回复
热议问题