Skip to content

mariofabelo/face-detection-insightface

Repository files navigation

Face Detection InsightFace

A simple face detection and recognition system using InsightFace for accurate face recognition.

Face Detection Demo

Features

  • Real-time face detection from webcam
  • Face recognition with known faces
  • Confidence scores for recognition accuracy
  • Simple and lightweight implementation

Example Images for known_faces (front and side view of fac profile)

Known Faces Example

Installation

  1. Install dependencies:
pip install -r requirements.txt

Usage

  1. Add known faces to the known_faces directory:

    • Create subdirectories for each person (e.g., Mario/, Bastien/, etc.)
    • Add clear face images (JPG or PNG format) in each person's directory
    • Face should be clearly visible and well-lit
  2. Run the face detection script:

python simple_face_detection.py

Controls

  • Press 'q' to quit
  • Press 's' to save the current frame

How It Works

  1. Face Detection: Uses InsightFace for accurate face detection and recognition
  2. Face Recognition: Extracts face embeddings and compares with known faces
  3. Real-time Processing: Processes video feed from webcam in real-time

About InsightFace

This project is built using InsightFace, a state-of-the-art 2D&3D deep face analysis toolbox. InsightFace provides:

  • Advanced face detection algorithms (RetinaFace, SCRFD)
  • High-accuracy face recognition with ArcFace
  • Face alignment and landmark detection
  • Optimized for both training and deployment

InsightFace is an open-source project that efficiently implements various state-of-the-art algorithms for face recognition, face detection, and face alignment, primarily based on PyTorch and MXNet.

Project Structure

face-detection-insightface/
├── simple_face_detection.py    # Main face detection script
├── known_faces/                # Directory for known face images
│   ├── Mario/                  # Mario's face images
│   ├── Bastien/                # Bastien's face images
│   ├── Freya/                  # Freya's face images
│   └── Shane/                  # Shane's face images
├── requirements.txt            # Python dependencies
└── README.md                   # This file

Requirements

  • Python 3.8+
  • Webcam or video input device
  • Clear, well-lit face images for recognition

License

MIT License

About

Face detection feature developed during Patch 2025

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages