Eigenfaces
A demonstration of Singular Value Decomposition (SVD) for my 21-241 (Linear Algebra) students
Ever wondered what it would be like if faces had a secret recipe?
This project explores the intriguing concept of eigenfaces, demonstrating how we can leverage linear algebra techniques, particularly Singular Value Decomposition (SVD), to decompose complex facial images into their fundamental components.
The project consists of three(ish) parts:
-
Breaking Down Datasets into Eigenfaces: using SVD to decompose a dataset of facial images into their principal components, or “eigenfaces”.
-
Reconstructing Faces: how these eigenfaces can be used to reconstruct original faces, demonstrating the power of dimensionality reduction.
-
Facial Recognition: as an extension, we’ll look at a very rudimentary facial recognition algorithm using PCA.
As a little taste, this video shows how reconstruction improves as the number of components used increase. Note that the curve isn’t linear!
If you’re interested in more, the following notebook goes into much more depth and the math behind it all. Also, please note that a lot of the computation is quite slow, as it is implemented to reflect the derivation of SVD. If you’re just looking to get SVD done, there are dedicated functionn optimized to do so.
I put this together for my 21-241 students when I TA’d the class. You can also find its public repo in the ‘repos’ section of my website. Hope you enjoy!
If you’ve made it down here, check out this old video of me explaining the eigenfaces paper back in high school (circa 2020)!