Transcript Eigenfaces
Math 5364/66 Notes
Image Recognition with Eigenfaces
Jesse Crawford
Department of Mathematics
Tarleton State University
• An image is an N N array
• Example: 256 256
Alternatively
• An image can be regarded as a vector
• Example:
65536
N2
• Training Set of M Images (Example M 16)
• 1 , , M
• Given a new image , can we
determine if is the picture of a face?
determine if is a picture of someone in our training set?
• Average face
M
1
M
i
i 1
• Subtract the means: i i
• Average face
M
1
M
i
i 1
• Subtract the means: i i
Covariance Matrix
M
1
M 1
• A [1
M ]
• C
i
i 1
T
i
• Average face
M
1
M
i
i 1
• Subtract the means: i i
Covariance Matrix
• C
M
1
M 1
• A [1
T
i i
i 1
1
M 1
AAT
M ]
Principal Components Analysis
• Need to find eigenvectors of AAT
• Average face
M
1
M
i
i 1
• Subtract the means: i i
Covariance Matrix
• C
M
1
M 1
• A [1
T
i i
i 1
1
M 1
AAT
M ]
Principal Components Analysis
• i
• Need to find eigenvectors of AAT
• A is a N 2 M matrix
N2
• AAT is a N 2 N 2 matrix
• Average face
M
1
M
i
i 1
• Subtract the means: i i
Covariance Matrix
• C
M
1
M 1
• A [1
T
i i
i 1
1
M 1
AAT
M ]
rank( A) M 1
Principal Components Analysis
• i
• Need to find eigenvectors of AAT
• A is a N 2 M matrix
N2
• AAT is a N 2 N 2 matrix
• Average face
M
1
M
i
i 1
• Subtract the means: i i
Covariance Matrix
• C
M
1
M 1
• A [1
T
i i
i 1
1
M 1
AAT
M ]
rank( A) M 1
Principal Components Analysis
• i
• Need to find eigenvectors of AAT
• A is a N 2 M matrix
N2
• AAT is a N 2 N 2 matrix
rank( AAT ) M 1
• Average face
M
1
M
i
i 1
• Subtract the means: i i
Covariance Matrix
• C
M
1
M 1
• A [1
T
i i
i 1
1
M 1
AAT
M ]
rank( A) M 1
Principal Components Analysis
• i
• Need to find eigenvectors of AAT
• A is a N 2 M matrix
N2
• AAT is a N 2 N 2 matrix
rank( AAT ) M 1
Only has M 1 nonzero eigenvalues
Recap
• A [1
M ]
• Need to find eigenvectors of AAT
• AAT is N 2 N 2
• AAT only has M 1 nonzero eigenvalues
Recap
• A [1
M ]
• Need to find eigenvectors of AAT
• AAT is N 2 N 2
• AAT only has M 1 nonzero eigenvalues
• AT A is M M
• Let v1 , , vM 1 be the eigenvectors of AT A
with eigenvalues 1
M 1 0
Recap
• A [1
M ]
• Need to find eigenvectors of AAT
• AAT is N 2 N 2
• AAT only has M 1 nonzero eigenvalues
• AT A is M M
• Let v1 , , vM 1 be the eigenvectors of AT A
with eigenvalues 1
M 1 0
• Define uk Avk , for k 1, , M 1
• Then u1 , , uM 1 are the eigenvectors of AAT
with eigenvalues 1
M 1 0
Recap
• A [1
M ]
• Need to find eigenvectors of AAT
• AAT is N 2 N 2
• AAT only has M 1 nonzero eigenvalues
• AT A is M M
• Let v1 , , vM 1 be the eigenvectors of AT A
with eigenvalues 1
M 1 0
• Define uk Avk , for k 1, , M 1
• Then u1 , , uM 1 are the eigenvectors of AAT
with eigenvalues 1
M 1 0
Called Eigenfaces
Recap
• A [1
M ]
• Need to find eigenvectors of AAT
• AAT is N 2 N 2
• AAT only has M 1 nonzero eigenvalues
• AT A is M M
• Let v1 , , vM 1 be the eigenvectors of AT A
with eigenvalues 1
M 1 0
M ' Number of eigenfaces used
Example: M 7
• Define uk Avk , for k 1, , M 1
• Then u1 , , uM 1 are the eigenvectors of AAT
with eigenvalues 1
M 1 0
Called Eigenfaces
New Image
• Subtract mean
• Rotate coordinate system using eigenfaces
u1T
1
T
u
2
2
T
u
M'
M'
New Image
• Subtract mean
• Rotate coordinate system using eigenfaces
u1T
1
T
u
2
2
T
u
M'
M'
The weights k are the components of the new image
with respect to the eigenfaces u1 , , uM
New Image
• Subtract mean
• Rotate coordinate system using eigenfaces
Training Images i
• Subtract mean i i
• Rotate coordinate system using eigenfaces
u1T
1
T
u
2
2
T
u
M'
M'
The weights k are the components of the new image
with respect to the eigenfaces u1 , , uM
u1T
T
u
i 2 i
T
uM '
New Image
• Subtract mean
• Rotate coordinate system using eigenfaces
u1T
1
T
u
2
2
T
u
M'
M'
Training Images i
• Subtract mean i i
• Rotate coordinate system using eigenfaces
u1T
T
u
i 2 i
T
uM '
Calculate Distances
òk ‖ k‖
(Distance from new image to kth training image)
New Image
• Subtract mean
• Rotate coordinate system using eigenfaces
u1T
1
T
u
2
2
T
u
M'
M'
Training Images i
• Subtract mean i i
• Rotate coordinate system using eigenfaces
u1T
T
u
i 2 i
T
uM '
Calculate Distances
òk ‖ k‖
(Distance from new image to kth training image)
M
f i ui
i 1
(Projection of new face onto face subspace in
N2
)
New Image
• Subtract mean
• Rotate coordinate system using eigenfaces
u1T
1
T
u
2
2
T
u
M'
M'
Training Images i
• Subtract mean i i
• Rotate coordinate system using eigenfaces
u1T
T
u
i 2 i
T
uM '
Calculate Distances
òk ‖ k‖
(Distance from new image to kth training image)
ò ‖ f ‖
(Distance from new image to face space)
M
f i ui
i 1
(Projection of new face onto face subspace in
N2
)
Given a new image , can we
determine if is the picture of a face?
determine if is a picture of someone in our training set?
Calculate Distances
òk ‖ k‖
(Distance from new image to kth training image)
ò ‖ f ‖
(Distance from new image to face space)