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.exe with the following arguments
-data D:\OpenCV\Classifiers\lbpclassifier1\temp\data -vec D:\OpenCV\Classifiers\lbpclassifier1\temp\samples.vec -bg D:\OpenCV\Classifiers\lbpclassifier1\temp\negative\infofile.txt -numPos 40 -numNeg 40 -precalcIdxBufSize 500 -precalcValBufSize 500 -stageType BOOST -featureType LBP -w 24 -h 24
The error message that I get is:
PARAMETERS:
cascadeDirName: D:\OpenCV\Classifiers\lbpclassifier1\temp\data
vecFileName: D:\OpenCV\Classifiers\lbpclassifier1\temp\samples.vec
bgFileName: D:\OpenCV\Classifiers\lbpclassifier1\temp\negative\infofile.txt
numPos: 2
numNeg: 40
numStages: 20
precalcValBufSize[Mb] : 500
precalcIdxBufSize[Mb] : 500
stageType: BOOST
featureType: LBP
sampleWidth: 24
sampleHeight: 24
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
===== TRAINING 0-stage =====
<BEGIN
POS count : consumed 2 : 2
Train dataset for temp stage can not be filled. Branch training terminated.
This question has been asked before : Error while using opencv_train cascade , and the solution suggested there viz. making the number of positive and negative samples equal doesn't help in this case.
I thought that the error might be related to this bug : http://code.opencv.org/issues/1834 So, I downloaded the latest release of imagestorage.cpp from that page and rebuilt the opencv_traincascades tool. Also, the total number of samples in the .vec file is 45. So as suggested in this comment I have changed the numPos argument to 2, so that I don't run out of samples in the .vec file. The number of samples in the .vec file is 45.
Any help is much appreciated. Thanks.


