GilLevi
GilLevi

Reputation: 2137

Haar-cascade training took very little time and no xml was produced

I'm trying to train a new haar-cascade for faces.

I have a positive dataset of 2000 cropped face images (just the face) and 3321 negative random images.

I created positive's list using the following command:

opencv_createsamples.exe -info info.txt -vec vector.vec -num 2000 -w 10 -h 10

Where the file info.txt contains the following lines:

AJ_Cook_0001.ppm 1 0 0 64 64
AJ_Lamas_0001.ppm 1 0 0 64 64
Aaron_Eckhart_0001.ppm 1 0 0 64 64
Aaron_Guiel_0001.ppm 1 0 0 64 64
Aaron_Patterson_0001.ppm 1 0 0 64 64
Aaron_Peirsol_0001.ppm 1 0 0 64 64

Afterwords, I ran haar_training using the following command:

opencv_haartraining.exe -data harrcascade -vec vector.vec -bg infofile.txt -nstages 20 -minhitrate 0.9999 -maxfalsealarm 0.5 -npos 2000 -nneg 3321 -w 10 -h 10 -nonsym -mem 1024

Where the file infofile.txt contains the names of the background images:

Bing_000527adc064a067a7f7986f00b140fe.jpg
Bing_002744f85b0bee37f489f43fad5f613f.jpg
Bing_0048e7e5e487203dedba9feb03696b1e.jpg
Bing_00513e8879f4f544717df2c8ea0494b1.jpg
Bing_00543a6cf117f559a05f0fb7e10bd361.jpg

Training took about only an two hours and no xml file was generated. The folder harrcascade contains 20 folder with a txt file named 'AdaBoostCARTHaarClassifier.txt' but no xml was generated.

I have two questions:

  1. Why did training took so very little time?

  2. Why no xml file was generated?

What am I missing here?

Thanks,

Gil.

Upvotes: 1

Views: 698

Answers (1)

Dima
Dima

Reputation: 39389

See my answer to your other question. If no xml file was produced, it is very likely that you have run out of positive samples. Try using 1500 instead of 2000.

Better yet, check out trainCascadeObjectDetector, a function in the Computer Vision System Toolbox for Matlab, which lets you generate an xml file compatible with OpenCV.

Upvotes: 1

Related Questions