Description
Description The objective of this assignment is to understand the application of Principal Component
Analysis (PCA) in face recognition. We are more interested in the PCA representation than the recognition
itself. You are provided with the Matlab code for a PCA implementation based on [1]. This includes a data
base of face images, first to obtain the principal components (PCs) and then later to use the PCs to represent
faces. You will have to understand the algorithm and test it with few sample images (e.g., your face image).
You will have to submit a two-page (maximum) writeup of your analysis and observations. Follow the steps
and get started on PCA.
1. Download the file pca proj.zip and extract its contents into a folder pca proj.
2. Go through the file pca orl.m and understand how it implements the PCA algorithm discussed in [1].
Read the comments and code to understand the MAT files it creates.
3. In the pca orl.m provided, a subset of the images (40 × 5 using orl train.m) is used to obtain the
PCs. Write your own code and name it facerecog1 .m. Call pca orl without reducing
the number of components (i.e., use all 200) and obtain the output MAT files. Verify the performance
of the PCA implementation and record your observations for the following three cases.
(a) Use one of the original images (and name it orlImgTrain) from the training images. Reconstruct
this image using PCs and name it as orlImgTrainEst . Obtain the mean-square error trainMSE
by comparing these two. Include this value and images in your report.
(b) Use one of the test images (and name it orlImgTest) by using orldata test.m. Reconstruct
this image using PCs and name it as orlImgTestEst . Obtain the mean-square error testMSE by
comparing these two. Include this value and images in your report.
(c) Create an image of your face so that it matches the dimension of the data used in the orl data.
i.e., 112 × 92 and grey-scale image. Crop it so that it only has your face and name this image
myImg. Reconstruct this image using PCs and name it as myImgEst . Obtain the mean-square
error myImgMSE by comparing these two. Include this value and images in your report.
Compare and comment on the results obtained for the three cases.
4. Repeat (3), but for reduced components and create a file similar to the one in (3) and name it
facerecog2 .m. Try for various number of PCs. In the report, include the results you
obtained using 100 PCs.
5. In addition to the specific results required in parts (a) and (b), include other objective results.
• Plots of eigen values to indicate their relation to number of components.
• Images of Eigenfaces corresponding to few of the significant components.
6. Write your own PCA algorithm (without using any modifications suggested in [1]). Create a file similar
to the one in (3) and name itfacerecog3 .m. Repeat the experiments in (3) and (4), but
the number of PCs need not be same. Compare the performance of your implementation with that in
(3) or (4). Is there any difference in performance ? Justify.
1
Matlab tips
1. One way to display a vector as a grayscale image in Matlab.
>> imshow ( reshape ( im g v e c t o r , 1 0 , 5 ) , [ 0 2 5 5] )
References
1. Matthew Turk and Alex Pentland., “Eigenfaces for Recognition,” J. Cognitive Neuroscience, Vol. 3,
no. 1, 1991, pp.71–86.
2. Delac K., Grgic M., and Grgic S., “Independent Comparative Study of PCA, ICA, and LDA on the
FERET Data Set,” International Journal of Imaging Systems and Technology, Vol. 15, no. 5, 2006,
pp. 252–260.
2