OpenCV 级联训练快速,失败:达到所需的叶误报率。分支培训终止
OpenCV Cascade Training Fast, Fails: Required leaf false alarm rate achieved. Branch training terminated
我正在从单个正图像生成样本,positive.jpg
。 bg.txt
文件中大约有 4000 个负文件路径。负片图像文件为 100x100。 positive.jpg
图片为 50x50。
opencv_createsamples -img positive.jpg -bg bg.txt -info info/info.lst -maxxangle 0.5 -maxyangle 0.5 -maxzangle 0.5 -num 1950
opencv_createsamples -info info/info.lst -num 1950 -w 20 -h 20 -vec positives.vec
opencv_traincascade -data data -vec positives.vec -bg bg.txt -numPos 1800 -numNeg 900 -numStages 10 -w 20 -h 20
这是训练的输出:
===== TRAINING 0-stage =====
<BEGIN
POS count : consumed 1800 : 1800
NEG count : acceptanceRatio 900 : 1
Precalculation time: 4
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 1| 1|
+----+---------+---------+
| 3| 0.996667| 0.393333|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 0 minutes 14 seconds.
===== TRAINING 1-stage =====
<BEGIN
POS count : consumed 1800 : 1806
NEG count : acceptanceRatio 900 : 0.318923
Precalculation time: 4
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 1| 1|
+----+---------+---------+
| 3| 0.997222| 0.216667|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 0 minutes 29 seconds.
===== TRAINING 2-stage =====
<BEGIN
POS count : consumed 1800 : 1811
NEG count : acceptanceRatio 900 : 0.111857
Precalculation time: 4
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 1| 1|
+----+---------+---------+
| 3| 0.996667| 0.381111|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 0 minutes 44 seconds.
===== TRAINING 3-stage =====
<BEGIN
POS count : consumed 1800 : 1817
NEG count : acceptanceRatio 900 : 0.0552418
Precalculation time: 4
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 1| 1|
+----+---------+---------+
| 3| 0.997778| 0.165556|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 0 minutes 59 seconds.
===== TRAINING 4-stage =====
<BEGIN
POS count : consumed 1800 : 1821
NEG count : acceptanceRatio 900 : 0.00951797
Precalculation time: 4
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 1| 1|
+----+---------+---------+
| 3| 0.997222| 0.482222|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 1 minutes 15 seconds.
===== TRAINING 5-stage =====
<BEGIN
POS count : consumed 1800 : 1826
NEG count : acceptanceRatio 900 : 0.00523308
Precalculation time: 4
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 0.996667| 0.435556|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 1 minutes 23 seconds.
===== TRAINING 6-stage =====
<BEGIN
POS count : consumed 1800 : 1832
NEG count : acceptanceRatio 900 : 0.00389186
Precalculation time: 4
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 0.997778| 0.493333|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 1 minutes 35 seconds.
===== TRAINING 7-stage =====
<BEGIN
POS count : consumed 1800 : 1836
NEG count : acceptanceRatio 900 : 0.00280947
Precalculation time: 4
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 0.998333| 0.433333|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 1 minutes 44 seconds.
===== TRAINING 8-stage =====
<BEGIN
POS count : consumed 1800 : 1839
NEG count : acceptanceRatio 4 : 0.00078125
Required leaf false alarm rate achieved. Branch training terminated.
这意味着您的分类器在 8 个阶段后的误报率已经低于 0.5^10,这是您选择的目标 => 训练已成功完成 (0.00078125 < 0.0009765625)
但可能只是没有足够的负样本存在。尝试获取 more/different 个样本。第9阶段只能收集到4张底片
我正在从单个正图像生成样本,positive.jpg
。 bg.txt
文件中大约有 4000 个负文件路径。负片图像文件为 100x100。 positive.jpg
图片为 50x50。
opencv_createsamples -img positive.jpg -bg bg.txt -info info/info.lst -maxxangle 0.5 -maxyangle 0.5 -maxzangle 0.5 -num 1950
opencv_createsamples -info info/info.lst -num 1950 -w 20 -h 20 -vec positives.vec
opencv_traincascade -data data -vec positives.vec -bg bg.txt -numPos 1800 -numNeg 900 -numStages 10 -w 20 -h 20
这是训练的输出:
===== TRAINING 0-stage =====
<BEGIN
POS count : consumed 1800 : 1800
NEG count : acceptanceRatio 900 : 1
Precalculation time: 4
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 1| 1|
+----+---------+---------+
| 3| 0.996667| 0.393333|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 0 minutes 14 seconds.
===== TRAINING 1-stage =====
<BEGIN
POS count : consumed 1800 : 1806
NEG count : acceptanceRatio 900 : 0.318923
Precalculation time: 4
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 1| 1|
+----+---------+---------+
| 3| 0.997222| 0.216667|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 0 minutes 29 seconds.
===== TRAINING 2-stage =====
<BEGIN
POS count : consumed 1800 : 1811
NEG count : acceptanceRatio 900 : 0.111857
Precalculation time: 4
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 1| 1|
+----+---------+---------+
| 3| 0.996667| 0.381111|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 0 minutes 44 seconds.
===== TRAINING 3-stage =====
<BEGIN
POS count : consumed 1800 : 1817
NEG count : acceptanceRatio 900 : 0.0552418
Precalculation time: 4
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 1| 1|
+----+---------+---------+
| 3| 0.997778| 0.165556|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 0 minutes 59 seconds.
===== TRAINING 4-stage =====
<BEGIN
POS count : consumed 1800 : 1821
NEG count : acceptanceRatio 900 : 0.00951797
Precalculation time: 4
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 1| 1|
+----+---------+---------+
| 3| 0.997222| 0.482222|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 1 minutes 15 seconds.
===== TRAINING 5-stage =====
<BEGIN
POS count : consumed 1800 : 1826
NEG count : acceptanceRatio 900 : 0.00523308
Precalculation time: 4
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 0.996667| 0.435556|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 1 minutes 23 seconds.
===== TRAINING 6-stage =====
<BEGIN
POS count : consumed 1800 : 1832
NEG count : acceptanceRatio 900 : 0.00389186
Precalculation time: 4
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 0.997778| 0.493333|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 1 minutes 35 seconds.
===== TRAINING 7-stage =====
<BEGIN
POS count : consumed 1800 : 1836
NEG count : acceptanceRatio 900 : 0.00280947
Precalculation time: 4
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 0.998333| 0.433333|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 1 minutes 44 seconds.
===== TRAINING 8-stage =====
<BEGIN
POS count : consumed 1800 : 1839
NEG count : acceptanceRatio 4 : 0.00078125
Required leaf false alarm rate achieved. Branch training terminated.
这意味着您的分类器在 8 个阶段后的误报率已经低于 0.5^10,这是您选择的目标 => 训练已成功完成 (0.00078125 < 0.0009765625)
但可能只是没有足够的负样本存在。尝试获取 more/different 个样本。第9阶段只能收集到4张底片