Embeddings

Week 9 lecture

Open full screen ↗ F full screen · S speaker notes · ? shortcuts

Try it: your face as 128 numbers

A face-recognition network turns a photo of a face into an embedding of 128 numbers, listed below and coloured by value (purple = low, yellow = high), with the maths at the bottom. Take a reference photo, then move, turn, change the light or swap in a friend, and watch the cosine similarity between the two embeddings.

Nothing loads until you press Start or upload a photo.

Reference

No reference yet

Live camera

Camera off

Difference

cosine similarity
–
 
 

Reference numbers (a)

value −0.3+0.3

Live numbers (b)

value −0.3+0.3

Difference (b − a)

live − reference −0.2+0.2

The maths

1 · Compare the 128 pairs
2 · Dot product
3 · Cosine similarity: the angle
4 · Euclidean distance

Runs entirely in your browser: your camera and photos are never uploaded or stored. Model: face-api.js (a FaceNet-style ResNet trained to pull photos of the same person together). Its authors treat a Euclidean distance below 0.6 as the same person. fps shows how many embeddings per second your device manages.