Skip to content
프로젝트

yakhyo/face-reidentification

GitHub에서 보기

소개

Face search and matching with ArcFace and FAISS

AI 및 머신러닝

이 수치를 측정하는 방법

What you can do

  • Real-Time Face Recognition: Process webcam or video files with SCRFD detection and ArcFace embeddings
  • FAISS Similarity Search: Batch cosine-similarity lookup using a FAISS inner-product index
  • Multiple Model Sizes: Choose from lightweight to high-accuracy detection and recognition models
  • Minimal Dependencies: Built on ONNX Runtime, OpenCV, NumPy, and FAISS with no extra frameworks

측정된 스타 증가

in 24h
0
in 7 days
+1
in 15 days
+1
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Real-Time Face Re-Identification with FAISS, ArcFace & SCRFD

Downloads GitHub Repo Stars GitHub Repository DeepWiki

[!TIP] The models and functionality in this repository are integrated into UniFace — an all-in-one face analysis library.
PyPI Version GitHub Stars License

Key Features

  • Real-Time Face Recognition: Process webcam or video files with SCRFD detection and ArcFace embeddings
  • FAISS Similarity Search: Batch cosine-similarity lookup using a FAISS inner-product index
  • Multiple Model Sizes: Choose from lightweight to high-accuracy detection and recognition models
  • Minimal Dependencies: Built on ONNX Runtime, OpenCV, NumPy, and FAISS with no extra frameworks

[!NOTE] Place your target face images in the assets/faces/ directory. The filenames will be used as identity labels during recognition.

Components

  1. SCRFD — Sample and Computation Redistribution for Efficient Face Detection
  2. ArcFace — Additive Angular Margin Loss for Deep Face Recognition
  3. FAISS — Facebook AI Similarity Search

Available Models

Category Model Size Description
Detection SCRFD 500M 2.41 MB Lightweight face detection
Detection SCRFD 2.5G 3.14 MB Balanced performance
Detection SCRFD 10G 16.1 MB High accuracy
Recognition ArcFace MobileFace 12.99 MB Mobile-friendly recognition
Recognition ArcFace ResNet-50 166 MB High-accuracy recognition

Project Structure

├── assets/
│   ├── demo.mp4
│   ├── in_video.mp4
│   └── faces/              # Place target face images here
│       ├── face1.jpg
│       ├── face2.jpg
│       └── ...
├── database/               # FAISS database implementation
├── models/                 # Neural network models
├── weights/                # Model weights (download required)
├── utils/                  # Helper functions
├── main.py                 # Main application entry
└── requirements.txt        # Dependencies

Getting Started

Prerequisites

[!IMPORTANT] Make sure you have Python 3.10+ installed on your system.

Installation

  1. Clone the repository:
git clone https://github.com/yakhyo/face-reidentification.git
cd face-reidentification
  1. Install dependencies:
pip install -r requirements.txt
  1. Download model weights:
Click to see download links 📥
Model Download Link Size
SCRFD 500M det_500m.onnx 2.41 MB
SCRFD 2.5G det_2.5g.onnx 3.14 MB
SCRFD 10G det_10g.onnx 16.1 MB
ArcFace MobileFace w600k_mbf.onnx 12.99 MB
ArcFace ResNet-50 w600k_r50.onnx 166 MB

Quick download (Linux/Mac):

sh download.sh
  1. Add target faces: Place face images in assets/faces/ directory. The filename will be used as the person's identity.

Usage

Basic Usage

python main.py --source assets/in_video.mp4

Command Line Arguments

[!TIP] Use these arguments to customize the recognition behavior:

usage: main.py [-h] [--det-weight DET_WEIGHT] [--rec-weight REC_WEIGHT]
               [--similarity-thresh SIMILARITY_THRESH] [--confidence-thresh CONFIDENCE_THRESH]
               [--faces-dir FACES_DIR] [--source SOURCE] [--max-num MAX_NUM]
Argument Description Default
--det-weight Detection model path ./weights/det_10g.onnx
--rec-weight Recognition model path ./weights/w600k_mbf.onnx
--similarity-thresh Face similarity threshold 0.4
--confidence-thresh Detection confidence threshold 0.5
--faces-dir Target faces directory ./assets/faces
--source Video source (file or camera index) ./assets/in_video.mp4
--max-num Max faces per frame (0 = unlimited) 0
--db-path Custom database storage location ./database/face_database
--update-db Force rebuild face database False
--output Specify output video path output_video.mp4

Technical Notes

  • Face database is saved to and loaded from disk automatically; no rebuild needed on restart
  • All detected faces in a frame are queried in a single FAISS index.search() call
  • For GPU-accelerated inference, install onnxruntime-gpu instead of onnxruntime

References

[!NOTE] This project builds upon the following research:

  1. SCRFD: Sample and Computation Redistribution for Efficient Face Detection
  2. ArcFace: Additive Angular Margin Loss for Deep Face Recognition

관련 프로젝트 살펴보기

불러오는 중…