OpenCV Haar分类器被杀死

时间:2014-11-17 11:54:39

标签: opencv computer-vision object-detection haar-classifier viola-jones

我正在尝试训练哈尔分类器但是在Stage 2期间,它会停止并显示消息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

我用来运行的命令如下:

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

造成这种情况的原因是什么?

N.B:我正在遵循给定here的教程(用不同数量的不同对象替换图像)。

1 个答案:

答案 0 :(得分:0)

减少opencv_traincascade命令中的宽度和高度使程序正确运行。

您的-w 80 -h 40对于您的PC可能太高了。建议的大小应为-w 24 -h 24

我注意到执行命令时硬盘使用率很高,除非被杀死。也许我们的硬盘驱动器不够快。