HOG person detection and setting up SVM classifiers

asked 2014-05-22 08:52:50 -0500

altella gravatar image

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:


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.term_crit = cvTermCriteria(CV_TERMCRIT_ITER, 1000, 1e-6);

Mat ClassOutput = Mat::ones(1,numImagesDB,CV_32F);
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++)

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


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 flag offensive close merge delete