问题描述
这是我第一次使用haatraining的opencv。
This is the first time I use haartraining of opencv.
只是为了练习,我使用了35张正图片和45张负图片。
Just for practice, I used 35 positive images and 45 negative images.
但是当我尝试从数据中训练时,它不会永远完成,
But when I try to train from data, It does not finish forever,
即使参数被极端调整。
(最小命中率= 0.001,最大错误警报率= 0.999
(min hit rate = 0.001, max false alarm rate = 0.999
我认为这不需要很多时间因为这个极端值)
I don't think it would take a lot of time because of this extreme values)
我的实验中必须出现什么错误?
What must be wrong in my experiment?
这里是我的命令和参数。
Here is my command and parameters.
$opencv_haartraining -data Training -vec samples.vec -bg negatives.dat -nstages 2 -nsplits 2 -minhitrate 0.001 -maxfalsealarm 0.999 -npos 30 -nneg 40 -w 20 -h 20 -nonsym -mem 512 -mode ALL -minpos 10
$ b b
结果。
And the result.
Data dir name: Training
Vec file name: samples.vec
BG file name: negatives.dat, is a vecfile: no
Num pos: 30
Num neg: 40
Num stages: 2
Num splits: 2 (tree as weak classifier)
Mem: 512 MB
Symmetric: FALSE
Min hit rate: 0.001000
Max false alarm rate: 0.999000
Weight trimming: 0.950000
Equal weights: FALSE
Mode: ALL
Width: 20
Height: 20
Applied boosting algorithm: GAB
Error (valid only for Discrete and Real AdaBoost): misclass
Max number of splits in tree cascade: 0
Min number of positive samples per cluster: 10
Required leaf false alarm rate: 0.998001
Stage 0 loaded
Stage 1 loaded
Stage 2 loaded
Stage 3 loaded
Stage 4 loaded
Tree Classifier
Stage
+---+---+---+---+---+
| 0| 1| 2| 3| 4|
+---+---+---+---+---+
0---1---2---3---4
Number of features used : 125199
Parent node: 4
*** 1 cluster ***
POS: 30 32 0.937500
推荐答案
我认为你正在使用OpenCV_Haartraining ?
Am I correct in thinking that you are using OpenCV_Haartraining?
如果是这样,则应该使用opencv_traincascades。
If so this is a deprecated app and you should use opencv_traincascades.
This will
- A. Speed up the time taken to classify
- B. Have better support
查看这些链接以进一步阅读
和。
See these links for further reading Training Vs TrainCascade and TrainCascade Wiki.
编辑:
也可以更改您的最低命中率和maxFalseAlarm费率。
also, change your min hit rate and maxFalseAlarm rate.
我建议使用0.4&
I would suggest using something like 0.4 & 0.95 to get going.
这是因为它会永远的命中率为0.999, 0.0001,如果有的话。
reason for this is that it will take forever for it to hit 0.999 & 0.0001 if ever.
这篇关于OpenCV Haartraining不会永远完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!