TrainCascade Error [closed]
Hi anyone, I try to create very simple classifier 1 positive image and 3 negative images. But I came to this error:
opencv_traincascade -vec samples.vec -bg negatives.txt -numStages 20 -minHitRate 0.999 -maxFalseAlarm 0.5 -numPos 1 -numNeg 3 -w 80 -h 40 -precalcValBufSize 1024 -precalcIdxBufSize 1024
PARAMETERS:
cascadeDirName: cascade
vecFileName: samples.vec
bgFileName: negatives.dat
numPos: 1
numNeg: 3
numStages: 20
precalcValBufSize[Mb] : 1024
precalcIdxBufSize[Mb] : 1024
stageType: BOOST
featureType: HAAR
sampleWidth: 80
sampleHeight: 40
boostType: GAB
minHitRate: 0.999
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: BASIC
===== TRAINING 0-stage =====
<BEGIN
POS count : consumed 1 : 1
NEG count : acceptanceRatio 3 : 1
Precalculation time: 0.157
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
END>
Cascade classifier can't be trained. Check the used training parameters.
Thanks in advance!
how many training data do you have?
3 or 9.
I have 1 or 3 positive image and 3 negative. I created the file vec using the command for 1 positive image bin\opencv_createsamples.exe -img Images/Positives/pos-001.jpg -num 3 -bg negatives.dat -vec samples.vec -maxxangle 0.6 -maxyangle 0 -maxzangle 0.3 -maxidev 100 -bgcolor 0 -bgthresh 0 -w 80 -h 44
for 3 positive images bin\opencv_createsamples.exe -info positives.dat -num 9 -bg negatives.dat -vec samples.vec -maxxangle 0.6 -maxyangle 0 -maxzangle 0.3 -maxidev 100 -bgcolor 0 -bgthresh 0 -w 80 -h 44
Your number of training examples are small, I think you should provide more training data. instead of 3 use 1000 or more. I had the same problem before I think that fixed in this way!
take a look at this: http://answers.opencv.org/question/10872/cascade-training-error-opencv-244-train-dataset/