$25
This assignment will give you the opportunity to practice using eigenvectors to perform face detection and identification. You will work with a set of images containing faces, use principal components analysis (PCA) to represent them, then use that information to automatically detect those same faces in unseen data. You will then compare your implementation’s performance to that of the Viola-Jones face detector (use publicly-available code; cite appropriately).
Figure 1: Face Detection: Example image with bounding boxes around the detected faces.
function in OpenCV/Scikit-Learn. You should implement the efficient Snapshot method for PCA (covered in class, Lecture 9, Slide 55) from scratch using numpy. (15 points)
Plot the fraction of total variance against the number of eigenvectors [3] (2 points). Plot the normalized variance (eigenvalues) against the eigenvector index used for computation. (2 points). Do you need all the vectors to represent the data? Discuss (3 points). Display the first 5 eigenfaces (5 points).
3 Classification (15 Points)
For every testing image, find the nearest neighbour (L2 distance), and check whether both images belong to the same person. To estimate the accuracy of this approach, determine what fraction of your test images has a neighbour that is actually of the same person? Compute the accuracy both in the original high dimensional pixel space and then in the eigenspace, and compare the accuracy values. Would you expect there to be a significant difference? (10 points)
You will now use a linear SVM classifier in the eigenspace. Use the training dataset to fit the classifier and the testing dataset to test the classifier. Compare the accuracy of this classifier with the nearest neighbour classifier used previously (5 Points).
4 Face Detection (20 Points)
You will now detect all the faces in the given group image (Schitts Creek group.jpg) using PCA. Use a sliding window to detect the faces. Set a threshold on the distance in eigenspace between the window contents and your training data (Refer to slide 63 of Lecture 9). Try different values of thresholds and use the one which gives you good results. Display your image with bounding boxes around the detected faces for the best threshold. (ex. Figure 1) [4] (15 points).
Use an existing implementation of the Viola-Jones face detector, and compare the results with your detector. Comparisons should be made in terms of the number of true positives, false positives and false negatives (See Appendix). Display the image with bounding boxes around the detected faces. Under what conditions would you expect the Viola-Jones detector to work when PCA does not? (5 points).
Appendix
A bounding box is considered as a true positive if it contains a face image otherwise, it is regarded as a false positive. A missed face (no detected bounding box around) is considered a false negative.
[1] If you are facing some memory and RAM issues, you are free to submit multiple notebooks as long as you clearly mention the reason for doing so.
[2] For debugging purposes, you can fix your random seed. This should allow you get same split during different runs.
[3] Refer to Tutorial 5 for more details.
[4] You can use any online available code for bounding box generation. Please cite the source for this in your report.