People detection

People detection

Martin Petlus

The goal of this project is detection of people on images. Persons on images are:

  • standing
  • person can be rotated from the front, back and from the side
  • different sizes of persons
  • can be in move
  • several persons on single image

petlus_detector1

For our project the main challenge was the highest possible precision of detection, detection of all persons on image in all possible situations. Persons can also be interleaved.

In our project we have experimented with two different approaches. Both are based on SVM classifier. This classifier takes images as input and detects persons on image. HOG descriptor is used by classifier to extract features from images in classification process. Sliding window is used to detect persons of different sizes. We have experimented with two different classifiers on two different datasets (D1 and D2).

  • Trained classifier from OpenCV
    • Precision:
      • D1: 51.5038%, 3 false positives
      • D2: 56.3511%, 49 false positives
  • Our trained classifier
    • Precision
      • D1: 66.9556%, 87 false positives
      • D2: 40.4521%, 61 false positives

Result of people detection:

patlus_detector2

We see possible improvments in extracting other features from images, or in using bigger datasets.

void App::trainSVM()
{
	CvSVMParams params;
	/*params.svm_type = CvSVM::C_SVC;
	params.kernel_type = CvSVM::LINEAR;
	params.term_crit = cvTermCriteria(CV_TERMCRIT_ITER, 100, 1e-6);*/
	params.svm_type = SVM::C_SVC;
	params.C = 0.1;
	params.kernel_type = SVM::LINEAR;
	params.term_crit = TermCriteria(CV_TERMCRIT_ITER, (int)1e7, 1e-6);
	int rows = features.size();
	int cols = number_of_features();
	Mat featuresMat(rows, cols, CV_32FC1);
	Mat labelsMat(rows, 1, CV_32FC1);
	for (unsigned i = 0; i<rows; i++)
	{
		for (unsigned j = 0; j<cols; j++)
		{
			featuresMat.at<float>(i, j) = features.at(i).at(j);
		}
	}
	for (unsigned i = 0; i<rows; i++)
	{
		labelsMat.at<float>(i, 0) = labels.at(i);
	}
	SVM.train(featuresMat, labelsMat, Mat(), Mat(), params);
	SVM.getSupportVector(trainedDetector);
	hog.setSVMDetector(trainedDetector);
}