I am trying to train a haar classifier that detects legos faces in images but I have really hard time tuning the parameters.
I took pictures of 3 legos (50 pictures each) and using opencv I isolated their heads as 40x40 images.
Sample image is the following:
Added to this, I just took 500 empty background images to serve as negative images in my dataset. I created the paths and produced the samples.vec file as described in the documentation of opencv.
After that, I tried to train my haar classifier. I used these parameters that I found on another similar project:
opencv_traincascade -data classifier -vec samples.vec -bg negatives.txt\
-numStages 10 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 1000\
-numNeg 600 -w 40 -h 40 -mode ALL -precalcValBufSize 1024\
-precalcIdxBufSize 1024
The results are really bad. The classifier recognizes legos where they don't exist and strangely it doesn't recognize the expected lego faces.
I am really in trouble tuning this classifier, because the parameters list is huge and I don't have any clue how to set values that will lead to an efficient classifier and do not take ages to train.
Any help would be appreciated, especially about how to choose the parameters and what is the expected training time in an "average" computer. Thank you for your time!
(p.s.: the training's duration was 2 hours, which I think is too fast and maybe it is the cause of the bad performance).