Project the average face onto the eigenspace in R.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------------------------------------- | |
# Projection of the average face onto the eigenvenctor space | |
# From a feature vector to a feature vector in the reduced feature space | |
proj_face_0 <- as.matrix(AverageFace[1, 2:4097]) %*% eigenvectors # for label 0 | |
proj_face_1 <- as.matrix(AverageFace[2, 2:4097]) %*% eigenvectors # for label 1 | |
proj_face_2 <- as.matrix(AverageFace[3, 2:4097]) %*% eigenvectors # for label 2 | |
# Every face has different projection on eigenvector space. | |
# We can use these new fewer values for a classification task. | |
barplot(proj_face_0[2:20], main = "Projection of average face 0 on eigenvector space", col="cyan") | |
barplot(proj_face_1[2:20], main = "Projection of average face 1 on eigenvector space", col="red") | |
barplot(proj_face_2[2:20], main = "Projection of average face 2 on eigenvector space", col="blue") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment