This repository contains the implementation of a face recognition assignment as part of a university course. The assignment involves using Principal Component Analysis (PCA) and Linear Discriminant Analysis (LDA) for classification on the ORL dataset, as well as exploring various aspects of classifier tuning and comparing results with non-face images.
The ORL dataset, consisting of grayscale images of size 92x112, with 10 images per each of the 40 subjects, is utilized for this assignment. You can download the dataset from Kaggle.
-
Generate Data Matrix and Label Vector
- Convert images into vectors and stack them into a data matrix
D
. Generate the label vectory
corresponding to subject IDs.
- Convert images into vectors and stack them into a data matrix
-
Split Dataset into Training and Test Sets
- Keep odd rows for training and even rows for testing, resulting in 5 instances per person for both training and testing.
-
Classification using PCA
- Compute the projection matrix
U
for different values ofalpha
. - Project the training and test sets using
U
. - Utilize the nearest neighbor classifier and report accuracy for each
alpha
. - Investigate the relation between
alpha
and classification accuracy.
- Compute the projection matrix
-
Classification using LDA
- Modify LDA pseudocode for multiclass LDA.
- Project training and test sets using the projection matrix
U
. - Utilize nearest neighbor classifier and report accuracy for multiclass LDA.
- Compare results with PCA.
-
Classifier Tuning
- Explore different number of neighbors (
K
) for K-NN classifier. - Plot accuracy against
K
for both PCA and LDA.
- Explore different number of neighbors (
-
Comparison with Non-Face Images
- Attempt classification of faces vs. non-faces using non-face images of the same size.
- Analyze success and failure cases.
- Determine the number of dominant eigenvectors for LDA.
- Plot accuracy vs. number of non-face images.
- Critique accuracy measure for large numbers of non-face images in the training data.
-
Bonus
- Implement different training and test splits, comparing results with the original split.
- Utilize variations of PCA and LDA algorithms (QDA), comparing time complexity and accuracy.
The detailed report for this assignment can be found here.
For any inquiries or suggestions, feel free to contact us through GitHub.