![]()
MATH347 L14: A realistic application - face recognition
|
New concepts:
Images as vectors
Interpreting column space, null space for a collection of faces
Face recognition by projection
![]()
Images as vectors - Face data
|
facedata.zip is the MIT face database. Unzip: obtain directory 'rawdata'
These Matlab instructions display one face within the MIT face collection numbered from 1223 to 5222 (3993 faces, some indices skipped), each face is represented by a vector with gray-scale values.
Faces are displayed using the function
function shwface(a) face=reshape(a,128,128)'; imagesc(face); colormap(gray(256)); axis('equal') end
matlab>> |
dir=strcat(getenv("HOME"),"/courses/MATH347"); fid=fopen(strcat(dir,"/rawdata/1223")); face1=fread(fid); fclose(fid); figure(1); shwface(face1); |
>>
matlab>> |
![]()
Faces are neither identical nor completely different
|
Read in another face
matlab>> |
dir=strcat(getenv("HOME"),"/courses/MATH347"); fid=fopen(strcat(dir,"/rawdata/1323")); face2=fread(fid); fclose(fid); figure(2); shwface(face2); |
>>
Face vectors are not orthogonal, there is overlap in the face information
matlab>> |
180*acos(face1'*face2/norm(face1)/norm(face2))/pi |
>>
colinear (identical face features)
orthogonal (completely different, not likely for members of the same species!)
![]()
Images as faces - mean face
|
The collection is gathered into a matrix
An “average” face vector is obtained by
matlab>> |
data=strcat(dir,"/faces.mat"); load(data); figure(3); shwface(a) |
>>
Construct a matrix of deviations from the average ,
|
|
|
Face 1223 |
Face 1323 |
Average face |
![]()
Choosing a subcollection
|
Seek an economical way to reconstruct a face
reconstructed face
average face
a subcollection of faces
How to choose ?
Of all deviations from the average face choose the closest to orthogonal to
Choose with the index for which for all
Then choose closest to orthogonal to both and
The matrix does not necessarily have orthonormal columns
Apply Gram-Schmidt to and obtain with orthonormal columns
![]()
Representing a face as a linear combination
|
A face can be approximately reconstructed by linear combination
|
|
Original face image |
Reconstructed face with |
How close is the reconstruction? Find the angle
matlab>> |
f=A*R(:,1)+a; acos(face1'*f/norm(face1)/norm(f))*180/pi |
>>
Obtain an angle of fairly close to perfect reconstruction ()
Better reconstruction accuracy would require increased