Project 5 | Face Detection with a Sliding Window

In this project, we try to detect faces in a set of scenes using a sliding window detector, like in the Dalal and Triggs paper (2005). The pipeline that we use is as follows:
  1. We extract positive samples using a subset of the Caltech Web Faces Project
  2. We extract negative samples from images that contain no faces
  3. We use these positive and negative samples to train an SVM classifier for a face
  4. We run a sliding window at multiple scales over a test image, and use the above classifier to classify those windows as face or non-face
Some Visualizations of HOG Features for different cell sizes are below.
Cell Size 6 Cell Size 4 Cell Size 3

Extra Credit - Hard Negative Mining

We define a function called get_hard_negative_features, which is similar to run_detector, except, it returns the features for the high confidence matches that it finds at multiple scales. Thus, if we run this function on the non face scenes, we will obtain a set of hard mined negative examples that we can use to further improve our SVM.
The effect of hard negative mining is that it removes much of the false positives that we had in the previous images, although it does reduce precision by some amount.
With Hard Negative Mining:

Without Hard Negative Mining:

With Hard Negative Mining:

Without Hard Negative Mining:

Results

It takes a very long amount of time to perform hard negative mining with cell size 3 and 4. It is fairly fast with cell size 6. The submitted code has cell size 3 with no hard negative mining. Hard negative mining can be enabled by uncommenting the lines in the Precisions:
HOG Cell Size Hard Negative Mining? Precision
6 YES 0.754
6 NO 0.856
4 NO 0.893
3 NO 0.906
The following are results for the parameters: NOTE: submitted code uses cell size 4, threshold = 0.95, and no hard negative mining instead.
Cell size 4 was used to improve accuracy while not slowing down the process too much.
Threshold 0.95 was used to reduce the number of detections , and since we aren't using hard negative mining ( and consequenctly false positives )
No Hard Negative Mining was used because, that is time consuming.
Precision Curve for submitted code :