Face recognition is four steps, and only one of them is recognition. Understanding the pipeline is what lets you build one responsibly — which for FaceVision meant a system where the server has never seen a face.
The four steps
- Detection — find faces in the frame and return bounding boxes and landmarks.
- Alignment — rotate and crop each face to a canonical pose using the landmarks, so the next model sees consistent input.
- Embedding — a recognition model maps the aligned face to a vector, typically 128 to 512 numbers, such that the same person's faces land close together.
- Matching — compare the new embedding to stored ones with cosine similarity and decide with a threshold.
Choosing the threshold
Too strict and real users are rejected; too loose and strangers get in. Collect a small labelled set — pairs of the same person, pairs of different people — and plot the similarity distributions. The threshold sits where the curves separate; where they overlap is your error rate, and you should state it. Lighting, glasses and age change the distribution, so test with your actual users, not a benchmark.
Why you store embeddings, never images
An embedding is enough to verify a person and useless for showing anyone what they look like. Storing only embeddings — the FaceVision design — means a database breach leaks vectors rather than faces, consent conversations get simpler, and deletion is a single row. Run detection and embedding in the browser with ONNX Runtime Web and the raw image never leaves the device at all (see running ML models in the browser).
Failure modes to design for
- A printed photo held up to the camera — this is why liveness detection exists.
- Twins and look-alikes — accept that similarity is not identity and add a second factor for high-stakes actions.
- Bias — recognition models perform unevenly across skin tones and ages; measure per group before deployment.
Build it this way and you can explain your system to a privacy officer in two sentences. That is a competitive advantage, not just an ethical one.
— Pranjul Rathour, GenAI Engineer from Kanpur, India. Open to GenAI roles, hackathon judging, mentorship sessions and guest talks at any campus: pranjulrathour41@gmail.com.
