Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Haar Classifier does not work, only one feature seems to be trained.

II have been trying to use OpenCV to create my own Haar Cascade Classifier to detect cows from images.

  • Number of positive images:83 , size 430x 280 px, .bmp format
  • Number of negative images:200, size 640x480px

My images aren't of that good a quality:

image description

used this to create the samples:

createsamples.exe -info positive/info.txt -vec vector/vector.vec -num 100000 -w 24 -h 24

used this to train:

haartraining.exe -data cascades -vec vector/vector.vec -bg negative/bg.txt -npos 83 -nneg 200 -nstages 18 -mem 2000 -mode ALL -w 24 -h 24

rem -nonsym

And this is a snippet of the training. I realized only one feature is being used (correct me if I am wrong)

Parent node: 6 Chosen number of splits: 0

Total number of splits: 0

Tree Classifier Stage +---+---+---+---+---+---+---+---+ | 0| 1| 2| 3| 4| 5| 6| 7| +---+---+---+---+---+---+---+---+

0---1---2---3---4---5---6---7

Parent node: 7

* 1 cluster * POS: 7 7 1.000000 NEG: 16 1.80409e-005 BACKGROUND PROCESSING TIME: 16.41 Precalculation time: 0.41 +----+----+-+---------+---------+---------+---------+ | N |%SMP|F| ST.THR | HR |
FA | EXP. ERR| +----+----+-+---------+---------+---------+---------+ | 1|100%|-| 0.882353| 1.000000| 0.062500| 0.043478| +----+----+-+---------+---------+---------+---------+ Stage training time: 0.12 Number of used features: 1

Parent node: 7 Chosen number of splits: 0

Total number of splits: 0

Tree Classifier Stage +---+---+---+---+---+---+---+---+---+ | 0| 1| 2| 3| 4| 5| 6| 7| 8| +---+---+---+---+---+---+---+---+---+

0---1---2---3---4---5---6---7---8

It ran upto 8 stages in less than 3mins !

I used this to convert to an xml file:

haarconv.exe cascades myhaar.xml 24 24

My python code uses this xml and can not detect a cow from the positive data set itself. Where am I going here?

click to hide/show revision 2
retagged

updated 2018-02-27 12:44:40 -0600

berak gravatar image

Haar Classifier does not work, only one feature seems to be trained.

II have been trying to use OpenCV to create my own Haar Cascade Classifier to detect cows from images.

  • Number of positive images:83 , size 430x 280 px, .bmp format
  • Number of negative images:200, size 640x480px

My images aren't of that good a quality:

image description

used this to create the samples:

createsamples.exe -info positive/info.txt -vec vector/vector.vec -num 100000 -w 24 -h 24

used this to train:

haartraining.exe -data cascades -vec vector/vector.vec -bg negative/bg.txt -npos 83 -nneg 200 -nstages 18 -mem 2000 -mode ALL -w 24 -h 24

rem -nonsym

And this is a snippet of the training. I realized only one feature is being used (correct me if I am wrong)

Parent node: 6 Chosen number of splits: 0

Total number of splits: 0

Tree Classifier Stage +---+---+---+---+---+---+---+---+ | 0| 1| 2| 3| 4| 5| 6| 7| +---+---+---+---+---+---+---+---+

0---1---2---3---4---5---6---7

Parent node: 7

* 1 cluster * POS: 7 7 1.000000 NEG: 16 1.80409e-005 BACKGROUND PROCESSING TIME: 16.41 Precalculation time: 0.41 +----+----+-+---------+---------+---------+---------+ | N |%SMP|F| ST.THR | HR |
FA | EXP. ERR| +----+----+-+---------+---------+---------+---------+ | 1|100%|-| 0.882353| 1.000000| 0.062500| 0.043478| +----+----+-+---------+---------+---------+---------+ Stage training time: 0.12 Number of used features: 1

Parent node: 7 Chosen number of splits: 0

Total number of splits: 0

Tree Classifier Stage +---+---+---+---+---+---+---+---+---+ | 0| 1| 2| 3| 4| 5| 6| 7| 8| +---+---+---+---+---+---+---+---+---+

0---1---2---3---4---5---6---7---8

It ran upto 8 stages in less than 3mins !

I used this to convert to an xml file:

haarconv.exe cascades myhaar.xml 24 24

My python code uses this xml and can not detect a cow from the positive data set itself. Where am I going here?

click to hide/show revision 3
retagged

updated 2018-02-27 12:44:58 -0600

berak gravatar image

Haar Classifier does not work, only one feature seems to be trained.

II have been trying to use OpenCV to create my own Haar Cascade Classifier to detect cows from images.

  • Number of positive images:83 , size 430x 280 px, .bmp format
  • Number of negative images:200, size 640x480px

My images aren't of that good a quality:

image description

used this to create the samples:

createsamples.exe -info positive/info.txt -vec vector/vector.vec -num 100000 -w 24 -h 24

used this to train:

haartraining.exe -data cascades -vec vector/vector.vec -bg negative/bg.txt -npos 83 -nneg 200 -nstages 18 -mem 2000 -mode ALL -w 24 -h 24

rem -nonsym

And this is a snippet of the training. I realized only one feature is being used (correct me if I am wrong)

Parent node: 6 Chosen number of splits: 0

Total number of splits: 0

Tree Classifier Stage +---+---+---+---+---+---+---+---+ | 0| 1| 2| 3| 4| 5| 6| 7| +---+---+---+---+---+---+---+---+

0---1---2---3---4---5---6---7

Parent node: 7

* 1 cluster * POS: 7 7 1.000000 NEG: 16 1.80409e-005 BACKGROUND PROCESSING TIME: 16.41 Precalculation time: 0.41 +----+----+-+---------+---------+---------+---------+ | N |%SMP|F| ST.THR | HR |
FA | EXP. ERR| +----+----+-+---------+---------+---------+---------+ | 1|100%|-| 0.882353| 1.000000| 0.062500| 0.043478| +----+----+-+---------+---------+---------+---------+ Stage training time: 0.12 Number of used features: 1

Parent node: 7 Chosen number of splits: 0

Total number of splits: 0

Tree Classifier Stage +---+---+---+---+---+---+---+---+---+ | 0| 1| 2| 3| 4| 5| 6| 7| 8| +---+---+---+---+---+---+---+---+---+

0---1---2---3---4---5---6---7---8

It ran upto 8 stages in less than 3mins !

I used this to convert to an xml file:

haarconv.exe cascades myhaar.xml 24 24

My python code uses this xml and can not detect a cow from the positive data set itself. Where am I going here?