Sunday, December 4, 2016

My Opencv LBP cascade for people detection

13 stage opencv LBP cascade for people detection

My Opencv LBP 13 stage cascade for people detection. It is only 13 stages learned on 300 of positive people images. It is not trained enaught. Training time is only under 1 hour. I have also more trained version also on 300 people. They are just under testing. This is just what i want to release to public. Enjoy The cascade. It is not that bad. You need to only set the higher minNeighbors parameterAs I sayd it is not trained a lot.

opencv haar LBP cascade

Opencv cascade for people detection conditions of use

Also, Do not worry about the condition of use. Use only on your own risk. That's it. The dataset to train this cascade is only mine. I also colect positive and negative data. I just want to say, that there is also no conditions based on the datasets. There is no others conditions of use.

Cascade classifier LBP great but real value is in Datasets

This cascade is just example achieved in 2 hours. One hour of training and the previous one for try to find right configuration and testing. There is much more time in prepairing the dataset for testing and also for learning. I like to train cascade on more training images and also for more situation. All is matter of time. Nothing else. Only time, Sure there is nothing valuable than time. 

LBP cascade trainig ( traincascade ) parameters

Utility is just traincascade.exe distributed with Opencv 3.1 version. Parameters are just like this.

-data v -vec vec.vec -bg bg.dat -numPos 300 -numNeg 300 -numStages 13  -numThreads 4
-stageType BOOST -featureType LBP -w 32 -h 64 -minHitRate 0.995 -maxFalseAlarmRate 0.42
-maxDepth 1 -maxWeakCount 100

There is one performace advice. If you have a cloud computer just focus on memory. To speed up
the learning process just increase precalcValBufSize and precalcIdxBufSize. One year ago i have 
set up Azure server for learning and  64 GB of ram is better than more cores. I would like to write something later about that. It was great to have this kind of computer and 30 000 well prepared 
positive examples for learning. 

How to use LBP cascade in OPENCV

This code helps you to use the cascade. Complete code you can find in previous article for Car detection in opencv

 vector human;
 cvtColor(img, img, CV_BGR2GRAY);
 equalizeHist(img, img);
 detectorBody.detectMultiScale(img, human,1.1,50,0|1,Size(5, 10),Size(300,480 ));

 if (human.size() > 0) {
  for (int gg = 0; gg < human.size(); gg++) {
                 rectangle(img, human[gg].tl(), human[gg].br(), Scalar(0, 0, 255), 2, 8, 0);

LBP cascade
 OPENCV LBP Cascade parameters 

<?xml version="1.0"?>
This is just basic 13# stage haar cascade pedestrian detector develop by 
V.K. from

OPENCV LBP Cascade download HERE

If you want to train some cascade. Just download my dataset for cars. It is also for free
See also my car dataset

1 comment: