Trying to create my Haartraining OpenCV

456 views Asked by At

I'm trying to create my cascade classifier with this command:

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

I have 1500 samples created from one single image with this command:

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

This is the output at stage 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%

My question is:

It's normal that Background Processing Time grows up so quickly?? To arrive to stage 20 i'll take some weeks!! there is something wrong??

1

There are 1 answers

0
smeso On

It could also take longer. There is a reason if OpenCV comes with pre-calculated cascade files.