Brief
This project builds a face matcher with no neural network. You turn every face into a short list of numbers, then look for the closest list. The numbers come from principal component analysis (PCA), which here is just the SVD you wrote in BM-08, applied to a stack of faces.
The Olivetti dataset has 400 photos of 40 people, each 64 × 64 pixels. Flatten each photo into a row of 4,096 numbers and stack them into a matrix . Subtract the mean face from every row. The top right singular vectors of the centred matrix are the directions in which faces differ most. Reshaped to 64 × 64, they look like faint faces, so they are called eigenfaces.
Keep the first eigenfaces as the rows of . A face becomes its projection , just 20 numbers. To rebuild it, go back the other way:
Two faces of the same person tend to have close values, so the nearest neighbour in this 20-number space is a good lookalike guess.
DATA · Olivetti faces
Objectives
Read-only. Log in to update progress.
VICTORY CONDITIONS
- Your rank-20 reconstruction matches sklearn PCA (svd_solver="full") within 1e-6 for every pixel, recorded with `python tools/mlarena.py record BM-09 "<largest difference>"`.
- Leave-one-out nearest-neighbour accuracy in the 20-number space is reported, alongside the same test on raw pixels.
- A grid showing the mean face, the first 8 eigenfaces, and one query with its three closest matches.
Side quests
Terms in plain words
- Principal component analysis (PCA)
- Find the directions in which the data varies most. They are the right singular vectors of the centred data matrix.
- Mean face
- The average of all face images, pixel by pixel. Subtracting it first is what makes the SVD find directions of variation.
- Eigenface
- One principal direction, reshaped back to 64 × 64 so you can look at it. It looks like a ghostly face.
- Projection
- The dot products of a centred face with the k eigenfaces. These k numbers are the face's new, short description.
- Nearest neighbour
- The stored item at the smallest distance from the query. Here, the face whose k numbers are closest to the new face's.