在OpenCV中训练不良的级联

时间:2014-11-28 21:58:23

标签: opencv object-detection object-recognition haar-classifier cascade-classifier

我无法正确训练分类器。当我使用生成的cascade.xml时,无法识别该对象。相反,对象的某些部分是。

培训的命令行是:

opencv_traincascade -data data -vec samples.vec -bg negatives.txt -numPos 200 -numNeg 100 -numStages 13 -w 80 -h 80 -featureType LBP -minHitRate 0.999 -maxFalseAlarmRate 0.5

训练输出时看起来像这样:

===== TRAINING 10-stage =====
<BEGIN
POS count : consumed   200 : 200
NEG count : acceptanceRatio    100 : 0.00586029
Precalculation time: 2
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|     0.09|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 6 minutes 9 seconds.

===== TRAINING 11-stage =====
<BEGIN
POS count : consumed   200 : 200
NEG count : acceptanceRatio    100 : 0.00724585
Precalculation time: 3
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|     0.09|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 6 minutes 49 seconds.

===== TRAINING 12-stage =====
<BEGIN

当我用它来检测我的物体时(在我的情况下,物体是方向盘),结果是: enter image description here enter image description here

1 个答案:

答案 0 :(得分:2)

您使用的图像太少,作为尺寸为80x80的图像的样本。 我最小化图像的尺寸,同时添加更多样本。 另一件事是负面图像的集合。你用什么作为阴性样品?尝试通过添加此错误检测到的块来放大负片图像。