TrainCascade Error [closed]

asked 2014-01-14 11:46:47 -0600

drybochkin gravatar image

updated 2014-01-14 22:29:30 -0600

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!

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-09-26 15:28:19.236407

Comments

how many training data do you have?

Constantin gravatar imageConstantin ( 2014-01-15 04:28:37 -0600 )edit

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

drybochkin gravatar imagedrybochkin ( 2014-01-15 04:52:10 -0600 )edit

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!

Constantin gravatar imageConstantin ( 2014-01-15 11:04:18 -0600 )edit