deepinsight/insightface

State-of-the-art 2D and 3D Face Analysis Project

InsightFace – Open‑source 2D/3D Face Analysis Toolbox

What it is – A comprehensive library for face‑related computer‑vision tasks. It bundles state‑of‑the‑art models for:

  • Face detection (RetinaFace, SCRFD, BlazeFace)
  • Face recognition / verification (ArcFace, Sub‑Center ArcFace, PartialFC, VPL, etc.)
  • Facial landmark / alignment (SDUNets, SimpleRegression)
  • 3‑D face reconstruction, gaze estimation, anti‑spoofing, face swapping and more.

All components are implemented in PyTorch (and some MXNet) and can be used for both training and inference.


Key recent features (InsightFace 2.x)

Feature What it does How you use it
PrivateFrame Real‑time video redaction (blur/mosaic) with optional RGB liveness detection. Works from a desktop GUI, CLI or Python API. insightface.app.privateframe package; default Fast mode aims for ~15 FPS.
PersonAnalysis Detects whole people, runs face recognition and body Re‑ID, and matches them against a reference database. Python API (get(), match(), optional update()) or the desktop GUI for webcams/RTSP streams.
InsightFace Server Self‑hosted web UI + REST API for detection, optional liveness, face comparison, registration and large‑scale search (50 M+ vectors on a single RTX 5090 with INT8 quantisation). Deploy the Docker container; interact via HTTP or the provided Python client.
Model handling Automatic download of model bundles (raccoon_s/l, cheetah_s/l, buffalo_l, etc.), auto‑selection of CoreML / CUDA / CPU providers, and reusable CoreML compilation caches. Import the insightface Python SDK; the library picks the best backend for your hardware.

Typical workflow (Python SDK)

import insightface
app = insightface.app.FaceAnalysis()
app.prepare(ctx_id=0)          # 0 = GPU, -1 = CPU
faces = app.get(img)          # detect + align + embed
for f in faces:
    print(f.normed_embedding) # 512‑dim face vector

The same SDK also exposes app.PrivateFrame for video redaction and app.PersonAnalysis for person‑level matching.


Ecosystem

  • Server – lightweight Docker image with ONNX Runtime inference and SQLite storage.
  • Desktop GUI – cross‑platform demo for live video, webcam or RTSP streams.
  • Model Zoo – dozens of pretrained weights (ArcFace, RetinaFace, SCRFD, etc.) listed on the project wiki.
  • Research code – modules for gaze estimation, 3‑D facial reflectance reconstruction, anti‑spoofing challenges, etc.

Licensing & usage

  • Code: MIT – free for academic and commercial use.
  • Trained models & annotation data: non‑commercial research only unless you obtain a separate commercial licence (contact insightface.ai).
  • Certain proprietary models (e.g., inswapper, InspireFace SDK) require a paid licence.

Who might use this?

  • Developers building security, authentication, or video‑analytics products who need a ready‑made face detection/recognition pipeline.
  • Researchers wanting a solid baseline for face‑related CV tasks (detection, alignment, 3‑D reconstruction, anti‑spoofing).
  • Enterprises looking for an on‑premise alternative to cloud services like AWS Rekognition, especially when large‑scale search (tens of millions) is required.

Getting started

  1. Clone the repo and cd python-package.
  2. Install the SDK: pip install -r requirements.txt && pip install .
  3. Follow the quick‑start guide in python-package/README.md to run the demo or launch the server.

Bottom line – InsightFace is a mature, research‑backed toolbox that covers the full stack of face analysis, from low‑level detection to high‑level person search, with both Python APIs and a ready‑to‑deploy server component.

Related

  • Project
  • Project
  • Project
  • Project
  • Project