PCA in face recognition
When used in face recognition, principal components gets the name of eigenfaces. Now let’s see in more details how this is used in order to perform face recognition.
We define the traning vector as the vector of dimensions that is obtained stretching the images from the trainig set all in one column.
We can form the matrix of training vectors of dimensions where is the number of images in the training set.
We can create the Mean Vector starting from the matrix of training vector by just averaging the value of all the rows. The mean vector will be of dimensions .
The mean vector can be represented as an image, and can represent the face that has the most common traits among the all traning set faces.
We can compute the covariance matrix:
The covariance matrix has dimension , and so each column can be represented as an image itself.
What we want now is to reduce the dimensionality from to , where is the smallest possible number of dimensions that preseve most of the information.
Once we have , we proceed to get the its eigenvectors, which will be our eigenfaces. In order to find an eigenvector , we have to find the eigenvalues such that . We can see that the equation can be rewritten as where is the identity matrix.
Once we have the eigenvalues , we put it in the original equation and find the eigenvectors. Source
In order to obtain a -dimension subspace, we order the eigenvectors that correspond to the highest values of the matrix. The projection matrix is built using the eigenvectors as columns, and has dimensions .
The projection of a vector onto the new -dimension sub-space is defined as following:
And represent the new feature vector for the image.
The basic idea of PCA for face recognition is that, instead of comparing faces pixels by pixel, which is a technique that gives unreliable results, we can compare images onto the new -dimensional subspace. We can just compare the projetion coefficients corresponding to each image .
The most similar face will have the and calculate the distance between every other feature vector for the images in the gallery. The face more similar will be the least distant to .