OpenCV traincascade for LBP training

bonchenko picture bonchenko · Jun 19, 2013 · Viewed 12.2k times · Source

I am trying to create head detector using LBP features in OpenCV, using traincascade utility. The head detector, I hope, will result in something similar to OpenCV's profileface created by Vladim Pivarevsky. I want to recreate the model because current model only handle frontal and left side face.

I follow Naotoshi Seo tutorial and use dataset from Irshad Ali website. Unfortunately, resulting model performs slowly with lots of false detection.

The traincascade is run as follow:

opencv_traincascade -data "data" -vec "samples.vec" -bg "out_negatives.dat" -numPos 26000 -numNeg 4100 -numStages 16 -featureType LBP -w 20 -h 20 -bt GAB -minHitRate 0.995 -maxFalseAlarmRate 0.3 -weightTrimRate 0.95 -maxDepth 1 -maxWeakCount 100 -maxCatCount 256 -featSize 1

I tried using other dataset, now frontal face from http://fei.edu.br/~cet/facedatabase.html but the result is still same: slow detection and lot of false positives.

Anybody have knowledge or experience in creating cascade haar/lbp model? Please give any suggestion so I can improve the accuracy of the model. I tried using OpenCV built-in model, and the result is good (lbpfrontalface.xml). Thank you so much!

Answer

McBodik picture McBodik · Jun 19, 2013

The best way is "trial and error"... You really need differents faces, and the greater difference is better. You can take one face and via createsamples do many faces. But this way, you never have good cascade. You should have many different faces, and if they will not be enough, you can increase them through createsamples. For example, you have 500 different faces by createsamples you can do with them 5000, then perhaps cascade will satisfy you.

About start training: to much positive:) or too few negative. You need for example 5000 pos and 2500 neg (pos = 2*neg). At least in my case it was the best choice.