Machine learning. Tools: Python, TensorFlow, scikit-learn

Face Recognition Pipeline

A program that learns to identify people in photos. It turns each face into a list of 128 numbers and classifies those numbers.

Overview

This project takes labeled photos of faces and learns to identify the person in each one. It turns each face into a list of 128 numbers, called an embedding, and trains a simple classifier on those numbers.

It is based on a 2017 tutorial by Cole Murray. The tutorial's code no longer installs on current versions of Python, so this project rebuilds the same steps with TensorFlow 2. No code from the original is included.

How it works

  1. Organize: put each person's photos in their own folder, with separate folders for training and testing.
  2. Preprocess: find the face in each photo, straighten it using the position of the eyes, and crop it to a square.
  3. Train: teach a neural network to tell the people apart. One of its layers produces the 128-number embedding.
  4. Embed: run every photo through the network and save its 128 numbers.
  5. Classify: train a linear support vector machine on the embeddings.
  6. Evaluate: test the classifier on photos it has not seen, and report its accuracy for each person.

Each step is a separate command that saves its output to a file, so any step can be run again on its own.

Results and limits

A demo runs every step on 72 generated images of three made-up identities. The classifier identified all 18 test images correctly. The generated images are easy to tell apart, so this shows that the pipeline works, not how accurate it would be on real faces.

  • The classifier can only choose among the people it was trained on. It cannot say that a face is unknown.
  • Face detection is less reliable for side views, poor lighting, and low-resolution photos.
  • Face data is biometric data. The repository explains how to handle it and states that the project is not for surveillance or identity verification.

Contact Information