I am trying to train a Haar Classifier however during Stage 2
it stops with the message Killed
PARAMETERS:
cascadeDirName: classifier
vecFileName: samples.vec
bgFileName: negatives.txt
numPos: 500
numNeg: 964
numStages: 10
precalcValBufSize[Mb] : 2048
precalcIdxBufSize[Mb] : 2048
stageType: BOOST
featureType: HAAR
sampleWidth: 80
sampleHeight: 40
boostType: GAB
minHitRate: 0.999
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: ALL
Stages 0-1 are loaded
===== TRAINING 2-stage =====
<BEGIN
POS count : consumed 500 : 500
NEG count : acceptanceRatio 964 : 0.182992
Precalculation time: 49
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 1| 1|
+----+---------+---------+
| 3| 1| 1|
+----+---------+---------+
| 4| 1| 1|
+----+---------+---------+
| 5| 1| 0.56639|
+----+---------+---------+
Killed
The command I am using to run is below:
opencv_traincascade -data classifier -vec samples.vec -bg negatives.txt -numStages 10 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 500-nonsym -mem 512 -numNeg 964 -w 80 -h 40 -mode ALL -precalcValBufSize 2048 -precalcIdxBufSize 2048
What is causing this?
N.B: I am following the tutorial given here (replacing the images with a different object in different amounts).
Reducing the width and height in the
opencv_traincascade
command made the program run correctly.Your
-w 80 -h 40
is probably too high for your PC. A recommanded size should be-w 24 -h 24
.I noticed an high usage of hard drive while performing the command unless it's killed. Maybe our hard drives are not quick enough.