Train haar cascade using all images [closed]

asked 2017-11-09 12:19:32 -0500

Davaaron gravatar image


I've downloaded and edited a lot of images. Currently I have about 70k face images and 70k non-face images. The training I'm going to do is described here: link text

I decided to use the above method as the standard opencv documentation requires vec files. The face images I have are already cropped, so I skipped the annotation step and thus no vec files were created.

In the parameters, you need to specifiy the amount of positive samples and the amount of negatives. What does this say? Should I denote 70k for those two parameters or more/less?

What's the impact of these parameters? I'd appreciate any explanation and tips for training.

Thanks in advance.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-09-26 08:17:04.276210


please do not use outdated, 3rd party advice on this, but official docs

(and in general, if there will be any variation of what you're trying to detect in the real world -- forget about "synthesizing" positives at all)

btw, what is it, youre trying to find ? (is the idea of using a cascade classifier even feasible ?)

berak gravatar imageberak ( 2017-11-09 12:34:06 -0500 )edit

Thanks for your answer. The reason I stick to the outdated 3rd party is that the official documentation doesn't mention how to work with already cropped images. I tried the createsamples.exe as followed:

"opencv_createsamples.exe -vec samples -info X:\pics\positives.txt -bg X:\pics\negatives.txt -num 5000 -...." but its giving following error: "X:\pics\positives.txt(1) : parse errorDone. Created 0 samples" I want to detect faces. In my opinion, the face detector coming with the opencv installation is not really reliant. Currently I'm working on a seminar and I want to improve the face detection for real life scenarios, side-face views included.

Edit: I will write a short Java program to load the images and create a *.dat file, substracting 1 from x,y,width and height.

Davaaron gravatar imageDavaaron ( 2017-11-09 15:33:00 -0500 )edit

sure, ok with faces.

what's the reason for "substracting 1 from x,y,width and height." ? assuming, your images are already cropped to 24x24, your info file should have lines like:

/absolute/path/to/image.png 1 0 0 24 24

" I want to improve the face detection for real life scenarios, side-face views included." -- mixing front and side views might be a bad idea. it's not the "same pattern"

berak gravatar imageberak ( 2017-11-09 21:13:19 -0500 )edit

Youre right in both arguments. My idea was to create a robust classifier as using multiple classifiers reduce the performance dramatically. Robust due to face rotation (frontal to total right or left view) and anything in between. I don't know if it would work out though. Maybe I should use some heuristic tools to improve face detection like extracting the skin color and track these colours although it doesn't appear to me as a robust addition (because of lightning changes)

Davaaron gravatar imageDavaaron ( 2017-11-09 23:47:49 -0500 )edit