Face Recognition using Eigenface (10 marks)
In this task, you are given the Yale face image dataset Yale−FaceA.zip. The dataset contains a
training_set of totally 135 face images captured from 15 individuals (9 images from each individual).
You are also given 10 test images in the test_set directory.
- Unzip the face images and get an idea what they look like. Then take 10 different frontal face
images of yourself, convert them to grayscale, and align and resize them to match the images in
Yale-Face. Explain why alignment is necessary for Eigen-face (0.5 mark).
- Train an Eigen-face recognition system. Specifically, at a minimum your face recognition system
should do the following:
a. Read all the 135 training images from Yale-Face, represent each image as a single data
point in a high dimensional space and collect all the data points into a big data matrix.
Display the mean face (0.5 mark).
b. Perform PCA on the data matrix (1 mark). Given the size of the input image, direct eigen
decomposition of covariance matrix would be slow. Read lecture notes and find a faster
way to compute eigenvalues and vectors, explain the reason (1 mark) and implement it in
your code (1 mark).
c. Determine (by writing code) the minimum number of principal components required to
capture 95% of the total variation of the data. Here the total variation is defined as the
sum of all the eigenvalues. (1 mark)
d. Determine the top-k principal components and visualize the top-k eigen-faces in your
report (1 mark). You can choose k=12 for this and the rest of the steps.
e. For each of the 10 test images in Yale-Face, read in the image, determine its projection
onto the basis spanned by the top-k eigenfaces. Use this projection for a
nearest-neighbour search over all the 135 faces, and find out which three face images are
the most similar. Show these top-3 faces next to the test image in your report (1.5 marks).
Report and analyze the recognition accuracy of your method (1 mark).f. Read in one of your own frontal face images. Then run your face recognizer on this new
image. Display the top-3 faces in the training folder that are most similar to your own
face (0.5 mark).
g. Repeat the previous experiment by pre-adding the other 9 of your face images into the
training set (a total of 144 training images). Note that you should make sure that your test
face image is different from those included in the training set. Display the top-3 faces that
are the closest to your face (1 mark).
Hints:
- A simple way to do alignment is to manually crop (and rotate if necessary) the face region, resize
the face image to a standard shape, and make sure the facial landmarks are aligned – e.g. centre of
eyes, noses, mouths are roughly at the same positions in an image.
- In doing eigen-decomposition, always remember to subtract the mean face and, when
reconstructing images based on the first k principal components, add the mean face back in at the
end.
- You can use Matlab’s/Python’s functions for matrix decomposition and inverse matrix (e.g.,
eigs(), svd(), inv() for matlab and numpy.linalg.eig(), numpy.linalg.svd(), numpy.linalg.inv() for
python) to implement PCA. Other than these, you should not use Matlab’s/Python’s built-in PCA
or eigenface function if there is one.