Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Train an LBP head detector using opencv_traincascade


I am trying to train an overhead head detector using LBP with the help of opencv_traincascade. I have extracted 50 positive images from a video and placed them in a folder p. Then I have created an annotation file file.txt using opencv_annotation for those 50 positive images. After that, I created a vector file info.vec using opencv_createsamplesusing -w 100 and -h 100.

I have also extracted 100 negative images from the same video and placed them in folder img and listed their names in file bg.txt. Then I ran opencv_traincascade like this:

opencv_traincascade -data data -vec info.vec -bg bg.txt -precalcValBufSize 2048 -precalcIdxBufSize 2048 -numPos 50 -numNeg 100 -nstages 20 -minhitrate 0.999 -maxfalsealarm 0.5 -w 100 -h 100 -featureType LBP

But when I run that classifier on the same video, I get A LOT of false positives. Can someone please have a look at the attached datasets ( and guide me what am I doing wrong? Maybe the resolutions of the positive and negative samples is wrong or their ratio is inappropriate.

Thank you.