liveBook · Manning

Face-detection algorithm

As explained in Fight Fraud with Machine Learning

Face detection is the computer-vision task of locating one or more faces within an image.

A face-detection algorithm locates a face in an image and returns its position as a bounding box. In KYC face matching, it crops faces from selfie and identity-document photos before recognition generates embeddings for comparison. section 7.2.1

A practical face-matching pipeline separates three stages:

  • Detect and crop the face from each photograph. section 7.2.1
  • Transform each crop into a numerical face embedding with a recognition model. section 7.2.1
  • Compare embeddings with cosine similarity to support duplicate or identity checks. section 7.2.1

Detecting faces in two Einstein photographs

Using MTCNN from facenet_pytorch, crop faces from two Albert Einstein images, pass the crops to InceptionResnetV1, and compare the resulting 512-dimensional embeddings. The demonstrated pair produces a cosine similarity of 0.7652. section 7.2.3

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 selfie-versus-ID workflow from face detection and cropping through recognition and numerical embedding comparison. section 7.2.1

How Fight Fraud with Machine Learning covers it

How deep it goes
Implements detection with MTCNN and cropping, but does not explain detector internals or training.
Examples
Uses two Albert Einstein photographs, cropped faces, 512-dimensional embeddings, and a demonstrated cosine score of 0.7652.
What it assumes
Assumes Python 3.10, a virtual environment, Jupyter, and basic PyTorch image-handling familiarity.
What you can do after
Apply it via facenet_pytorch to crop faces before generating and comparing recognition embeddings.
How it connects
Connects face recognition, face embeddings, cosine similarity, and KYC fraud detection.

Also explained in

Compare how 2 books explain face-detection algorithm →

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.