Skip to content

vectornguyen76/face-recognition-system

Repository files navigation

Face Recognition System

Table of Contents

  1. Setup
  2. Technology

Setup

Create Environment

  1. Create a new conda environment:

    conda create -n face_recognition python=3.9
  2. Activate the environment:

    conda activate face_recognition
  3. Install the required packages:

    pip install -r requirements.txt

Test Environment

  1. Test Detection

    pytest --capture=no tests/test_detect_image.py
  2. Test Tracking

    pytest --capture=no tests/test_tracking.py
  3. Test Recognition

    pytest --capture=no tests/test_recognize_image.py

Development Environment

  1. Create a Folder for Each Person

    • Create a folder with the folder name being the name of the person:
      datasets/
      ├── backup
      ├── data
      ├── face_features
      └── new_persons
          ├── name-person1
          └── name-person2
      
  2. Add the Person's Photos to the Folder

    • Add the person's photo in the corresponding folder:
      datasets/
      ├── backup
      ├── data
      ├── face_features
      └── new_persons
          ├── name-person1
          │   └── image1.jpg
          │   └── image2.jpg
          └── name-person2
              └── image1.jpg
              └── image2.jpg
      
  3. Run Triton Server, Redis, and Qdrant

    docker compose up
  4. Train New Persons

    python train.py
  5. Run Recognition App

    python recognize.py
  6. Run Tracking App

    python tracking.py

Production Environment

  1. Build the Docker Image

    docker compose --profile=prod build
  2. Run the Application

    docker compose --profile=prod up

Technology

Face Detection

  • SCRFD (Single-Shot Scale-Aware Face Detector): Designed for real-time face detection across various scales, effective in detecting faces at different resolutions within the same image. SCRFD models require input image shapes divisible by 32, such as 640x640 or 1024x768.

Face Recognition

  • ArcFace: A state-of-the-art face recognition algorithm that focuses on learning highly discriminative features for face verification and identification. It is robust to variations in lighting, pose, and facial expressions.

    ArcFace
    ArcFace

Face Tracking

  • ByteTrack: A simple, fast, and strong multi-object tracker.

    ByteTrack

Triton Inference Server

  • Triton Inference Server: An open-source software platform designed for deploying and managing AI models at scale. It supports various deep learning and machine learning frameworks, including TensorFlow, PyTorch, ONNX, and OpenVINO. Triton can be deployed on various hardware platforms, including CPUs, GPUs, and FPGAs.

    Triton Inference Server

Vector Store

  • Qdrant: A vector similarity search engine and database offering a production-ready service with a user-friendly API for storing, searching, and managing vectors along with additional payload data. Qdrant supports extended filtering and is suitable for various applications such as neural-network or semantic-based matching and faceted search. It is written in Rust for speed and reliability under high loads.

    Qdrant Vector Store

Redis Streams

  • Redis Streams: Used for streaming frames and bounding box tracking.

    Redis Streams

About

Real-time face recognition system with microservices architecture. SCRFD detection, ByteTrack tracking, and ArcFace embedding with Qdrant vector search. Powered by NVIDIA Triton Inference Server, Redis Streams, and FastAPI.

Topics

Resources

License

Stars

Watchers

Forks

Contributors