Yale Face Database - Introduction to Computer Vision - Assignment, Exercises of Computer Vision

During the studies,their is a program called Introduction to computer vision offered in our university, this course is very helpful. The main points disucss in these lecture slides are:Yale Face Database, Recognition Using Eigenfaces, Matrix of Eigenvectors, Frontal Orientation, Standardized Databases, Object Recognition, Dimensional Space, Matlab Legend Function, Recognition Using Fisherfaces

Typology: Exercises

2012/2013

Uploaded on 04/24/2013

baishali
baishali 🇮🇳

4

(2)

84 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSE152 Intro to Computer Vision Assignment #4
Instructor: Prof. David Kriegman.
http://cseweb.ucsd.edu/classes/sp12/cse152-a
Due Date: Fri. June 8, 2012.
Instructions:
Attempt all questions
Submit your assignment electronically by email to [email protected] with the subject line
CSE152 Assignment 4. The email should include 1) A 1) a written report that includes all
necessary output images and written answers (e.g., as a Word file or PDF), and 2) all necessary
Matlab code. Attach your code and report as a zip or tar file.
The Yale Face Database
In this assignment, we will have a look at some simple techniques for object recognition, in particular,
we will try to recognize faces. The face data that we will use is derived from the Yale Face Database.
For more information, see http://cvc.yale.edu/projects/yalefacesB/yalefacesB.html. The database
consists of 5760 images of 10 individuals, each under nine poses and 64 dierent lighting conditions.
The availability of such standardized databases is important for scientic research as they provide a
common testing ground to test the efficacy of different algorithms.
Figure 1: The Yale face database B.
In this assignment, we will only use 640 images corresponding to a frontal orientation of the
face. These faces are included in the file yaleBfaces.zip. You will find the faces divided into five
different subsets. Subset 0 consists of images where the light source direction is almost frontal, so
that almost all of the face is brightly illuminated. From subset 1 to 4, the light source is progressively
moved toward the horizon, so that the effects of shadows increase and not all pixels are illuminated.
The faces in subset 0 will be used as training images, and subsets 1 to 4 will be used as test images.
1 Recognition Using Eigenfaces
Write a function [W,mu]=eigenTrain(trainset,k) that takes as input a N×dmatrix trainset
of vectorized images from subset 0, where N= 70 is the number of training images and
d= 2500 is the number of pixels in each training image. Perform PCA on the data and compute
the top k= 20 eigenvectors. Return the k×dmatrix of eigenvectors W, and a ddimensional
vector mu encoding the mean of the training images. You should use the matlab command
svds to find the first keigenvectors. You can use the provided function loadSubset.m to
1
pf3

Partial preview of the text

Download Yale Face Database - Introduction to Computer Vision - Assignment and more Exercises Computer Vision in PDF only on Docsity!

CSE152 – Intro to Computer Vision – Assignment # Instructor: Prof. David Kriegman. http://cseweb.ucsd.edu/classes/sp12/cse152-a Due Date: Fri. June 8, 2012.

Instructions:

  • Attempt all questions
  • Submit your assignment electronically by email to [email protected] with the subject line CSE152 Assignment 4. The email should include 1) A 1) a written report that includes all necessary output images and written answers (e.g., as a Word file or PDF), and 2) all necessary Matlab code. Attach your code and report as a zip or tar file.

The Yale Face Database

In this assignment, we will have a look at some simple techniques for object recognition, in particular, we will try to recognize faces. The face data that we will use is derived from the Yale Face Database. For more information, see http://cvc.yale.edu/projects/yalefacesB/yalefacesB.html. The database consists of 5760 images of 10 individuals, each under nine poses and 64 dierent lighting conditions. The availability of such standardized databases is important for scientic research as they provide a common testing ground to test the efficacy of different algorithms.

Figure 1: The Yale face database B.

In this assignment, we will only use 640 images corresponding to a frontal orientation of the face. These faces are included in the file yaleBfaces.zip. You will find the faces divided into five different subsets. Subset 0 consists of images where the light source direction is almost frontal, so that almost all of the face is brightly illuminated. From subset 1 to 4, the light source is progressively moved toward the horizon, so that the effects of shadows increase and not all pixels are illuminated. The faces in subset 0 will be used as training images, and subsets 1 to 4 will be used as test images.

1 Recognition Using Eigenfaces

  • Write a function [W,mu]=eigenTrain(trainset,k) that takes as input a N ×d matrix trainset of vectorized images from subset 0, where N = 70 is the number of training images and d = 2500 is the number of pixels in each training image. Perform PCA on the data and compute the top k = 20 eigenvectors. Return the k × d matrix of eigenvectors W , and a d dimensional vector mu encoding the mean of the training images. You should use the matlab command svds to find the first k eigenvectors. You can use the provided function loadSubset.m to

load the training data, e.g. [trainset trainlabels]=loadSubset(0,’yaleBfaces’). ( 10 points)

  • Rearrange each of the top 20 eigenvectors you obtained in the previous step into a 2D image of size 50 × 50. Display these images by appending them together into a 500 × 100 image (a 10 × 2 grid of images). (4 points)
  • Select one image per person from subset 0 (e.g., the 10 images person01 01.png, person02 01.png, ... person10 01.png). Show what each of these images would look like when using only the top k eigenvectors to reconstruct them, for k = 1, 2 , 3 , 4 , 5 , ...10. This reconstruction procedure should project each image into a k dimensional space, project that k dimensional space back into a 2500 dimensional space, and finally resize that 2500 vector into a 50 × 50 image. ( 7 points)
  • Write a function called testlabels=eigenTest(trainset,trainlabels,testset,W,k) that takes as input the same N × d matrix trainset of vectorized images from subset 0, an N dimensional vector trainlabels that encodes the class label of each training image (e.g., 1 for person01, 2 for person02, etc.), an M × d matrix testset of M vectorized images from one of the test subsets (1-4), the output of PCA W , and the number of eigenvectors to use k. Project each image from trainset and testset onto the space spanned by the first k eigenvectors. For each test image, find the nearest neighbor in the training set using an L 2 distance in this lower dimensional space and predict the class label as the class of the nearest training image. Your function should return an M dimensional vector testlabels encoding the predicted class label for each test example. Evaluate eigenTest on each test subset 1- separately for values k = 1...20 (so it should be evaluated 4 × 20 times). Plot the error rate (fraction of incorrect predicted class labels) of each subset as a function of k in the same plot, and use the matlab legend function to add a legend to your plot. (10 points)
  • Repeat the experiment from the previous step, but throw out the first three eigenvectors. That is, use k eigenvectors starting with the fourth eigenvector. Produce a plot similar to the one in the previous step. How do you explain the difference in recognition performance from the previous part? (5 points)
  • Explain any trends you observe in the variation of error rates as you move from subsets 1 to 4 and as you increase the number of eigenvectors. Use images from each subset to reinforce your claims. (4 points)

2 Recognition Using Fisherfaces

  • Write a function called [W,mu]=fisherTrain(trainset,trainlabels,c) that takes as input the same N × d matrix trainset of vectorized images from subset 0 and the corresponding class labels trainlabels, and the number of classes c = 10. Your function should do the following (10 points): - Compute the mean mu of the training data, and use PCA to compute the first N − c principal components. Let this be WP CA. - Use WP CA to project the training data into a space of dimension N − c. - Compute the between-class scatter matrix SB and the within class scatter matrix SW on the N − c dimensional space from the previous space. - Compute Wf ld, by solving for the generalized eigenvectors of the c − 1 largest generalized eigenvalues for the problem SB wi = λiSW wi. You can use the matlab function eig to solve for the generalized eigenvalues of SB and SW.