I am trying to use OpenCV's opencv_traincascade to generate a Haar Cascade. So far I have 87 distinctive positive samples and 39 negative samples for testing purposes. I generated the .vec file with opencv_createsamples, which worked fine. When I'm running opencv_traincascade it always gets stuck after a few stages, no matter how I change the parameters. My call looks like this:
opencv_traincascade -data /opencvimgs/haarcascades/data/ -vec /opencvimgs/haarcascades/out.vec -bg /opencvimgs/haarcascades/neg.txt -numPos 87 -numNeg 39
I tried increasing and decreasing minHitRate and maxFalseAlarmRate as well as numPos and numNeg without any success. It might run for a few more stages but then it seems to hang in an infine loop again. How can I resolve this?
The output below is what the programm writes to the console:
opencv_traincascade -data /opencvimgs/haarcascades/data/ -vec
/opencvimgs/haarcascades/out.vec -bg /opencvimgs/haarcascades/neg.txt -numPos 87 -numNeg 39
PARAMETERS:
cascadeDirName: /opencvimgs/haarcascades/data/
vecFileName: /opencvimgs/haarcascades/out.vec
bgFileName: /opencvimgs/haarcascades/neg.txt
numPos: 87
numNeg: 39
numStages: 20
precalcValBufSize[Mb] : 256
precalcIdxBufSize[Mb] : 256
stageType: BOOST
featureType: HAAR
sampleWidth: 24
sampleHeight: 24
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: BASIC
===== TRAINING 0-stage =====
<BEGIN
POS count : consumed 87 : 87
NEG count : acceptanceRatio 39 : 1
Precalculation time: 1
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 0|
+----+---------+---------+
END>
===== TRAINING 1-stage =====
<BEGIN
POS count : consumed 87 : 87
NEG count : acceptanceRatio 39 : 0.0697674
Precalculation time: 1
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 0|
+----+---------+---------+
END>
===== TRAINING 2-stage =====
<BEGIN
POS count : consumed 87 : 87
NEG count : acceptanceRatio 39 : 0.00945455
Precalculation time: 1
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 0|
+----+---------+---------+
END>
===== TRAINING 3-stage =====
<BEGIN
POS count : consumed 87 : 87
NEG count : acceptanceRatio 39 : 0.000326907
Precalculation time: 1
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 0|
+----+---------+---------+
END>
===== TRAINING 4-stage =====
<BEGIN
POS count : consumed 87 : 87
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…