Capstone 02: Face Recognition System

Project Goal

Build an end-to-end face recognition pipeline:

  • Synthetic face dataset (gaussian blobs as face embeddings)
  • ArcFace-style margin loss training
  • FAISS embedding index for fast nearest-neighbor search
  • Cosine similarity matching with configurable threshold
  • Full evaluation: FAR vs FRR tradeoff curve

Architecture

Enrollment Phase:
  Face Image → CNN Encoder → 512-dim L2-normalized embedding → FAISS Index

Inference Phase:
  Query Image → CNN Encoder → Query Embedding
      → FAISS search (top-k nearest neighbors)
      → Cosine similarity threshold decision
      → MATCH / NO MATCH

Key Concepts

ArcFace Margin Loss

Standard softmax loss treats all wrong classes equally. ArcFace adds an angular margin $m$ in the embedding space: $$L = -\log \frac{e^{s(\cos(\theta_{y_i} + m))}}{e^{s(\cos(\theta_{y_i} + m))} + \sum_{j \neq y_i} e^{s \cos \theta_j}}$$

This forces embeddings of the same identity to cluster tightly, and different identities to have large angular separation.

FAISS Index Selection

Index TypeSpeedMemoryAccuracyUse When
FlatIPSlowestHighExact< 100K vectors
IVFFlatFastMediumExact (within cluster)100K–10M
IVFPQFastestLowApprox> 10M

Metrics to Report

  • TAR@FAR=0.01%: True Accept Rate when False Accept Rate = 0.01%
  • EER: Equal Error Rate (FAR = FRR)
  • AUC: Area under the ROC curve
  • Top-1 Accuracy: correct match at rank 1