试图创建我的Haartraining OpenCV

时间:2013-12-14 09:46:25

标签: opencv haar-classifier cascade-classifier

我正在尝试使用此命令创建我的级联分类器:

haartraining -data haarcascade -vec samples.vec -bg negatives.dat -nstages 20 -nsplits 2 -minhitrate 0.999 -maxfalsealarm 0.5 -npos 1000 -nneg 600 -w 20 -h 20 -nonsym -mem 2048 -mode ALL

我使用此命令从一个图像创建了1500个样本:

createsamples -img foto.png -num 1500 -bg negatives.dat -vec samples.vec -maxxangle 0.6 -maxyangle 0 -maxzangle 0.3 -maxidev 100 -bgcolor 0 -bgthresh 0 -w 20 -h 20

这是第3阶段的输出:

Tree Classifier
Stage
+---+
|  0|
+---+

Number of features used : 125199

Parent node: NULL

*** 1 cluster ***
POS: 1000 1000 1.000000
NEG: 600 1

**BACKGROUND PROCESSING TIME: 0.02**

Precalculation time: 41.39

+----+----+-+---------+---------+---------+---------+
|  N |%SMP|F|  ST.THR |    HR   |    FA   | EXP. ERR|
+----+----+-+---------+---------+---------+---------+
|   1|100%|-|-0.989933| 1.000000| 0.988333| 0.003125|
+----+----+-+---------+---------+---------+---------+
|   2|100%|-| 0.006064| 1.000000| 0.000000| 0.000000|
+----+----+-+---------+---------+---------+---------+

Stage training time: 40.66
Number of used features: 4

Parent node: NULL
Chosen number of splits: 0

Total number of splits: 0

Tree Classifier
Stage
+---+
|  0|
+---+
   0


Parent node: 0

*** 1 cluster ***
POS: 1000 1000 1.000000
NEG: 600 0.0169943

**BACKGROUND PROCESSING TIME: 0.23**

Precalculation time: 37.19

+----+----+-+---------+---------+---------+---------+
|  N |%SMP|F|  ST.THR |    HR   |    FA   | EXP. ERR|
+----+----+-+---------+---------+---------+---------+
|   1|100%|-|-0.981031| 1.000000| 1.000000| 0.007500|
+----+----+-+---------+---------+---------+---------+
|   2|100%|-| 0.005864| 1.000000| 0.010000| 0.003750|
+----+----+-+---------+---------+---------+---------+

Stage training time: 36.25
Number of used features: 4

Parent node: 0
Chosen number of splits: 0

Total number of splits: 0

Tree Classifier
Stage
+---+---+
|  0|  1|
+---+---+
   0---1

Parent node: 1

*** 1 cluster ***
POS: 1000 1000 1.000000
NEG: 600 0.000522

**BACKGROUND PROCESSING TIME: 7.54**

Precalculation time: 40.80

+----+----+-+---------+---------+---------+---------+
|  N |%SMP|F|  ST.THR |    HR   |    FA   | EXP. ERR|
+----+----+-+---------+---------+---------+---------+
|   1|100%|-|-0.895043| 1.000000| 1.000000| 0.051875|
+----+----+-+---------+---------+---------+---------+
|   2|100%|-|-1.818561| 1.000000| 0.978333| 0.026250|
+----+----+-+---------+---------+---------+---------+
|   3|100%|-|-2.601195| 1.000000| 0.676667| 0.010000|
+----+----+-+---------+---------+---------+---------+
|   4|100%|-|-1.673473| 1.000000| 0.033333| 0.003125|
+----+----+-+---------+---------+---------+---------+

Stage training time: 80.58
Number of used features: 8

Parent node: 1
Chosen number of splits: 0

Total number of splits: 0

Tree Classifier
Stage
+---+---+---+
|  0|  1|  2|
+---+---+---+
   0---1---2

Parent node: 2

*** 1 cluster ***
POS: 1000 1000 1.000000
NEG: 600 4.19496e-005

**BACKGROUND PROCESSING TIME: 93.92**

Precalculation time: 40.82

+----+----+-+---------+---------+---------+---------+
|  N |%SMP|F|  ST.THR |    HR   |    FA   | EXP. ERR|
+----+----+-+---------+---------+---------+---------+
|   1|100%|-|-0.955309| 1.000000| 1.000000| 0.059375|
+----+----+-+---------+---------+---------+---------+
|   2|100%|-|-1.676803| 1.000000| 0.931667| 0.065000|
+----+----+-+---------+---------+---------+---------+
|   3|100%|-|-1.313002| 1.000000| 0.233333| 0.010625|
+----+----+-+---------+---------+---------+---------+

Stage training time: 63.21
Number of used features: 6

Parent node: 2
Chosen number of splits: 0

Total number of splits: 0

Tree Classifier
Stage
+---+---+---+---+
|  0|  1|  2|  3|
+---+---+---+---+
   0---1---2---3


Parent node: 3

*** 1 cluster ***
POS: 1000 1000 1.000000
NEG: 600 1.23118e-005

**BACKGROUND PROCESSING TIME: 327.57**

Precalculation time: 41.54


+----+----+-+---------+---------+---------+---------+
|  N |%SMP|F|  ST.THR |    HR   |    FA   | EXP. ERR|
+----+----+-+---------+---------+---------+---------+
|   1|100%|-|-0.939509| 1.000000| 1.000000| 0.054375|
+----+----+-+---------+---------+---------+---------+
|   2|100%|-|-1.812912| 1.000000| 0.821667| 0.047500|
+----+----+-+---------+---------+---------+---------+
|   3|100%|-|-0.907906| 1.000000| 0.128333| 0.016875|
+----+----+-+---------+---------+---------+---------+

Stage training time: 61.52
Number of used features: 6

Parent node: 3
Chosen number of splits: 0

Total number of splits: 0

Tree Classifier
Stage
+---+---+---+---+---+
|  0|  1|  2|  3|  4|
+---+---+---+---+---+
   0---1---2---3---4


Parent node: 4

*** 1 cluster ***
POS: 1000 1000 1.000000
  0%

我的问题是:

背景处理时间如此迅速地成长是正常的吗?到达第20阶段,我需要几个星期!有什么不对吗?

1 个答案:

答案 0 :(得分:1)

也可能需要更长时间。如果OpenCV附带预先计算的级联文件,则有一个原因。