3

I am trying to create a new cascade file for face detection, I have 30000 faces database in gray-scale. Below are commands i am using for creating New Cascade for Opencv, I want to know which parameter i have to change to improve my detection. I had got acceptanceRatio in last stage of training is about 0.0001.

I can able to detect faces using this cascade but want to improve it.

perl bin/createsamples.pl positives.txt negatives.txt samples 30000 "opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 30 -h 30"


python ./tools/mergevec.py -v samples/ -o samples.vec


opencv_traincascade -data classifier -vec samples.vec -bg negatives.txt -numStages 20 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 27000 -numNeg 54000  -w 30 -h 30 -mode ALL -precalcValBufSize 1024 -precalcIdxBufSize 1024

Please Help if someone know anything about it. Thanks

chex
  • 249
  • 1
  • 12
  • acceptance ratio of 0.0001 after 20 stages is really bad. Did you read the original paper, how they trained their cascades? – Micka Dec 16 '17 at 05:52
  • Yes i already read opencv tutorial. Can you suggest which parameter can improve it? – chex Dec 16 '17 at 07:05
  • not opencv tutorials but the face detection cascade classifier scientific paper written by viola & jones. Probably you'll even find the positive and negative samples they've used and you can use them as a base for your training. Btw: Why do you think you are able to train a better classifier than a research team? Btw2: I would not use the opencv_createsamples and augmentation too much, better collect new and individual samples. – Micka Dec 16 '17 at 07:46
  • Why should i not think? opencv given cascade not satisfying our neeeds, So better to create own classifier, I can get better result than opencv frontalface_atl2 cascade using our own cascade right now, but still its not satisfying our needs. And i already have 30000 individual samples, And from this individual samples only i had create cascade. So want to know which parameter can improve it. – chex Dec 16 '17 at 08:51
  • @Micka I had individual 30000 faces, and for creating their .vec files i used opencv_createsamples utility. – chex Dec 16 '17 at 08:58
  • so if you already reach better results, what exactly do you want to improve? Increasing hit rate or decreasing false alarm rate or improve speed? I would suggest to collect more samples. Positive samples that aren't already detected and negative samples that are detected, being false positives. From training parameters you don't have much optimization potential. – Micka Dec 16 '17 at 09:06
  • @Micka Frontalface alt2 cascade can detect 190 faces from database, But for same database dlib can detect 268 faces, While our cascade can detect 200 faces, So That's why i am in need of improvement. Does our positive and Negatives ration in traincascade requires any modification? – chex Dec 16 '17 at 09:12
  • since your acceptance ratio is very high, you could use more negative samples per stage, but that won't let you detect more real faces. Get more different positive samples! Not sure if dlib uses advanced techniqurs going beyond cascade classifiers. Why don't you just use dlib? – Micka Dec 16 '17 at 09:37
  • 1
    AFAIK dlib's face detector internally uses 6 different detector trained to find different poses at the same time so it is hard to train one cascade classifier like dlib's face detector – sturkmen Dec 16 '17 at 14:44
  • @Micka I can't use dlib due to internal project dependency, and also dlib gives more false Positives. If i use samples without any transformation using opencv createsamples then is there any chances to improvement? – chex Dec 17 '17 at 04:40
  • @sturkmen Can you give me some more information regarding 6 different detector dlib uses? – chex Dec 17 '17 at 04:42
  • @chex see https://stackoverflow.com/a/39398471/5294258 – sturkmen Dec 17 '17 at 05:04

0 Answers0