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
CentOS Linux release 7.4.1708 (Core)
opencv_traincascade -data haarcascadeHAAR
-vec samples.vec -bg Bad.dat -numPos 1500 -numNeg 3000
-numStages 35 -minHitRate 0.95 -maxFalseAlarmRate 0.5
-mode ALL -w 20 -h 20
-precalcValBufSize 2048 -precalcIdxBufSize 4096
System return responce: Train dataset for temp stage can not be filled. Branch training terminated. Cascade classifier can't be trained. Check the used training parameters.
This trouble was in OpenCV 2.4.6 and 3.1.0. Resolution next (for my case)- I create file Bad.dat on windows host, when I copy this file on unix I switch b-slash to slash (:%s/\// for Vi), but catch same result. When I change EOL from Win (CR LF) to Nix (LF) - traincascade launched successfuly.
$ file Bad.dat
Bad.dat: ASCII text, with CRLF line terminators
$ dos2unix Bad.dat
dos2unix: converting file Bad.dat to Unix format ...
$ file Bad.dat
Bad.dat: ASCII text
The process works well reason - check you Bad.dat (file in -bg param)