The Full Pipeline
Ollie processes your photo through a short sequence of steps. Each has one job, and together they produce your celebrity matches. Knowing the pipeline explains both why results are usually sensible and where they can go wrong.
The four stages are: 1. Face detection, finding your face and five key points on it. 2. Face alignment, straightening and cropping the face to a standard size. 3. Embedding extraction, turning the face into a 512-number facial fingerprint. 4. Comparison, measuring the distance from your fingerprint to every celebrity photo and ranking the closest celebrities.
Detection and Alignment (Steps 1–2)
Detection uses InsightFace to find every face in your image. Ollie keeps the largest one and locates five landmarks on it: both eye centres, the nose tip and both mouth corners. Those five points define a transformation that maps the face onto a standard 112 × 112 pixel crop, with the eyes level and in fixed positions.
This alignment step is critical. The recognition network was trained on crops aligned exactly this way, so a badly aligned face, from a strong angle or a face half out of frame, gives a less reliable fingerprint.
The Neural Network (Step 3)
The aligned crop goes through Ollie's own 20-layer convolutional network, built in the SphereFace style with residual connections. Its last layer outputs 512 numbers, which are normalised to unit length. That vector is your facial fingerprint, in exactly the same format as every celebrity fingerprint in the database.
The network was written and trained from scratch in PyTorch, with no pretrained weights. It learned from MS1MV2, about 5.8 million photos of 85,742 people, using the CosFace loss, over about 10 days on a single NVIDIA RTX 4060 Ti. It scores 98.5% on the LFW benchmark, whose people were all removed from the training data first.
Comparison and Ranking (Step 4)
Every celebrity photo in the database was run through the same network ahead of time. Your fingerprint is compared with all of them at once, a single matrix calculation that takes milliseconds, and each celebrity is scored by their single closest photo.
The distances are rescaled into percentages that are easier to read, and the five closest celebrities come back to you, each with the photo that matched you best. The match score comes from the network alone; there are no hand-made adjustments for skin tone or other features. By default the results are limited to celebrities of the gender InsightFace estimates from your face, using each celebrity's gender as recorded on Wikidata; you can pick men or women yourself, and narrow the list to actors, singers or footballers.
