liveBook · Manning

Face recognition model

As explained in Fight Fraud with Machine Learning

A face recognition model is a machine-learning model that converts facial images into representations suitable for identifying or comparing faces.

A face recognition model converts a cropped facial image into an embedding: a multidimensional numerical fingerprint representing facial features. Comparing two embeddings with cosine similarity supports identity verification, duplicate detection, and selfie-to-ID checks. section 7.2.1 section 7.4

A practical face-matching workflow is:

  • Detect and crop the face in each selfie or identity-document image with a face detection model. section 7.2.1
  • Generate one embedding per cropped face using the face recognition model. section 7.2.1
  • Calculate cosine similarity: values near 1 indicate highly similar embeddings, values near 0 unrelated faces, and values near -1 opposite vectors. section 7.2.1
  • Use the resulting score for duplicate checks between selfies or selfie-to-ID identity verification. section 7.4

A common training design is a Siamese network. Two replicas of the same CNN process a pair of images, producing embeddings whose cosine similarity passes through a sigmoid. A binary label marks same-person pairs as 1 and different-person pairs as 0; binary cross-entropy loss is backpropagated through the CNN so same-person embeddings become similar and different-person embeddings separable. section 7.2.2

Selfie-to-ID fraud check

An MTCNN model crops the face from an identity document, and InceptionResnetV1 generates its embedding. Comparing it with Einstein’s selfie produces a 61.54% similarity score; Monroe’s ID produces 2.52%. A fraudulent ID reusing Einstein’s selfie reaches 100%, revealing a suspicious pasted-face attack rather than simply confirming identity. section 7.2.4

Figure 7.10 Diagram of a face-matching system comparing faces from two different photos – a selfie and an ID. First, the faces from the two photos are cropped using a face detection model, and then a face recognition model generates embeddings for the faces that are compared numerically for a match.

Trace the complete matching pipeline from selfie and ID face crops through embedding generation and numerical comparison. section 7.2.1

How Fight Fraud with Machine Learning covers it

How deep it goes
Explains embeddings, cosine similarity, Siamese training, CNN outputs, sigmoid conversion, labels, and binary cross-entropy.
Examples
Uses selfie and identity-document comparisons involving Einstein, Marilyn Monroe, genuine matches, mismatches, and pasted-face fraud.
What it assumes
Assumes facial images and face detection, while defining embeddings, similarity scores, and paired-image training.
What you can do after
Apply it via facenet_pytorch models to generate embeddings and compare selfie, ID, or duplicate-user faces.
How it connects
Connects face detection, embeddings, cosine similarity, CNNs, Siamese networks, and KYC fraud detection.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fight Fraud with Machine Learning. The section links point to the parts of the book it draws on.