# HOG person detection and setting up SVM classifiers

Hello all;

I am using HOG descriptors and SVM like the examples provided in OpenCV cpp samples to detect people. Following the sample, if I use:

hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());


I obtain a processing rate of approximately 150ms per image, which is a good performance. The drawback is that I obtain also many false positives. I have used MIT person database (128*64 pixel images containing a person), to train a ONE CLASS SVM classifier, as I only have positive examples. I have obtained the HOG feature vector of the images (3780 values) for the 924 images in the database. I have trained the SVM as follows: CvSVMParams params;

params.svm_type = CvSVM::ONE_CLASS;
params.kernel_type = CvSVM::LINEAR;
params.nu=0.5;
params.term_crit = cvTermCriteria(CV_TERMCRIT_ITER, 1000, 1e-6);

CvSVM SVM;
Mat ClassOutput = Mat::ones(1,numImagesDB,CV_32F);
SVM.train_auto(trainingSVMData,ClassOutput,Mat(),Mat(),params);
int x=SVM.get_support_vector_count();
const float *v = SVM.get_support_vector(0);
vector<float> descriptorVector;

for(unsigned int i=0;i<trainingSVMData.cols;i++)
descriptorVector.push_back(v[i]);


Obtaining one support vector of 3780 components. Inserting this SVM to he HOG descriptor:

hog.setSVMDetector(descriptorVector);


Problems I have:

• The processing now is extremely slow, almost 10 SECONDS for each frame !!!
• The alforithm is more robust, but the rectangle detecting the person is twice the size of the person in height and width.

Could anyone help me or give some advise about it? Why so slow?

Thank you very much in advance,

Best regards,

edit retag close merge delete