Project 5 / Face Detection with a Sliding Window

This project requires us to detect faces in images. To do this, I:

  1. Ran HoG on training data
  2. Trained a linear SVM classifier on the training data
  3. Ran the detector on the test data using this classifier

Training Data and Linear SVM Classifier

I used Caltech's positive training database of 6713 faces cropped to size 36x36. I also used additional databases to train negative data. From each of these 36x36 patch, I extracted the HoG features and trained the linear SVM classifier on these features.

Learned Detector for different HoG cell sizes:

Cell Size 6 Cell Size 3

As observed, the smaller the HoG cell size, the more precise the features are. There is a clearer distinction to even humans, between the eyes, the nose and the mouth with the smaller cell size. Higher average precision was reached with a smaller cell size. The average precision with cell size 6 was 0.846 while the average precision for cell size 3 was 0.918. However, there is a lower limit to this statement as there was not much of a difference in precision between cell size 3 and cell size 2. Flipping the positive images and counting these flipped images as part of the dataset artificially increased the number of images in the dataset and also increased the precision by about 3%.

Average Precision for different HoG cell sizes:

Cell Size 6 Cell Size 3

Testing Data

To get a higher average precision rate and fewer false positives, I tested different values for the HoG cell size, the scale factor, the number of negative samples and confidence threshold. In general, a smaller cell size, a greater scale factor, more negative samples led to a higher precision rate. For confidence threshold, I tried different values such as -0.5, -0.2, 0, and +0.5. Negative values like -0.5 and -0.2 gave high precision rates but also gave a lot of false positives. While positive values like +0.5 did not have that high of a precision rate.

After many tests, the best precision rates I got were with:

Results