Skip to main content

InsightFace Python Library 2.0

InsightFace provides face detection, recognition, alignment, and attributes through Python and ONNX Runtime. Optional features include RGB liveness, PrivateFrame for video face blur/mosaic, and the Evaluation Studio desktop GUI.

License

The library code is released under the MIT License, for academic and commercial use. The pretrained models provided with this library are for non-commercial research only, whether downloaded automatically or manually.

What's new in 2.0

  • Liveness update: optional RGB liveness before recognition, configurable recognition gating, and per-face results.
  • PrivateFrame update: local video face blur/mosaic, reference-photo selection, editable analysis JSON, and desktop, CLI, and Python API workflows. See the full guide.
  • Runtime and models: raccoon_s / raccoon_l, automatic CoreML/CUDA/CPU selection, and reusable CoreML compilation caches.

Installation

Python 3.10 or newer is required.

Use case Command
FaceAnalysis and ModelZoo pip install insightface
PrivateFrame API and CLI pip install "insightface[privateframe]"
Evaluation Studio GUI, including PrivateFrame pip install "insightface[gui]"

The base package installs onnxruntime. The privateframe extra adds PyAV and PyYAML; the gui extra also includes the Qt desktop application. The optional face3d extension is not compiled by default, so ordinary installation does not require a C++ compiler. See the source installation and runtime guide for installation details.

NVIDIA CUDA

After installing InsightFace, replace the default runtime with the GPU distribution:

python -m pip uninstall -y onnxruntime
python -m pip install onnxruntime-gpu

Do not keep both runtime distributions installed together. Installing or upgrading InsightFace may install onnxruntime again; repeat this replacement afterward on NVIDIA systems.

Quick Example

Detect faces in the bundled sample image and save an annotated image:

import cv2
from insightface.app import FaceAnalysis
from insightface.data import get_image

app = FaceAnalysis()
app.prepare()
image = get_image("t1")
faces = app.get(image)
cv2.imwrite("t1_output.jpg", app.draw_on(image, faces))

FaceAnalysis() defaults to buffalo_l and downloads the model package on first use if needed. Models are stored under ~/.insightface/models/ by default. prepare() uses ctx_id=0 and Auto detection size, combining 128×128 and 640×640 detection.

Automatic Provider selection

When no provider is specified, InsightFace selects the first available provider reported by the installed ONNX Runtime:

CoreMLExecutionProvider → CUDAExecutionProvider → CPUExecutionProvider

An accelerated provider uses CPU as its fallback when available. Explicit providers=[...] arguments take precedence. CoreML compilation caches are reused across runs. See the runtime guide for provider overrides, CoreML caching, and telemetry behavior.

PrivateFrame

PrivateFrame detects and tracks faces in local videos and applies Gaussian blur or mosaic. Blur all detected faces, blur only people matched to reference photos, or keep matched people visible. Processing runs locally and preserves the source video.

insightface-privateframe process \
  --input /data/video.mp4 --output-dir /data/output

This writes video_privateframe.mp4 and an editable video_privateframe.json. The default Fast mode targets 15 analysis FPS, including in the GUI; Normal (30) provides denser sampling. Analysis FPS controls detection sampling, not output FPS: every source frame is rendered. Briefly visible faces can be missed, so review the result before sharing it.

See the full guide for GUI/Python examples, reference photos, JSON editing, configuration, automation, and a video demo.

Evaluation Studio GUI

Install insightface[gui], then launch:

insightface-gui

Evaluation Studio includes PrivateFrame, face comparison and search, People Library management, album clustering, enterprise evaluation/reporting, and face swap trials. Workspace data is stored locally and is not uploaded automatically. See the GUI guide for model downloads, workflows, settings, and troubleshooting.

Optional liveness addon

Enable RGB liveness explicitly when constructing FaceAnalysis:

import cv2
from insightface.app import FaceAnalysis

app = FaceAnalysis(addons=["liveness"])
app.prepare()
image = cv2.imread("input.jpg")
if image is None:
    raise FileNotFoundError("input.jpg")

for face in app.get(image):
    result = face.liveness
    print(result.status, result.is_live, result.live_score)

The addon downloads automatically if missing and is verified before loading. Its default path is ~/.insightface/addons/liveness.onnx; enabling it does not require changing the base model package.

The default liveness_mode="normal" keeps detected faces in the results but skips recognition for faces that fail liveness or have rejected input. liveness_mode="observe" continues recognition regardless of that result. The default live-score threshold is 0.8. Omitting addons=["liveness"] disables addon downloading, loading, and inference.

See the liveness guide for options, result fields, input rejection, offline setup, and error handling.

Model Zoo

Workflow Default model Alternatives
FaceAnalysis() buffalo_l Raccoon packages, other supported legacy packs, or your own compatible models
PrivateFrame raccoon_s raccoon_l
New GUI configurations raccoon_s Other supported packages for the selected workflow

Select a package with FaceAnalysis(name="raccoon_s"). Model packages live under <root>/models/<name>/; the default root is ~/.insightface. PrivateFrame can download its selected Raccoon package on first use. The general GUI model manager requires an explicit download; existing GUI configurations retain their saved model selection.

See the model guide for package contents, download links, benchmarks, custom licensed models, and direct ONNX model calls. Model licenses apply separately from the library's MIT license.

Documentation

Guide Contents
Runtime and installation Source installs, CUDA, CoreML, provider selection, telemetry
PrivateFrame Video demo, GUI, CLI, Python API, configuration
Liveness Options, results, offline models, input handling
Evaluation Studio Desktop workflows and model management
Enterprise evaluation Datasets, metrics, and reports
Model Zoo Model packages and advanced model usage
Build and packaging Source builds, optional face3d, and distribution

Change Log

See the complete change log for the September 10, 2026 release notes and earlier versions. Liveness and PrivateFrame updates are listed separately.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

insightface-2.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

insightface-2.0-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file insightface-2.0.tar.gz.

File metadata

  • Download URL: insightface-2.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for insightface-2.0.tar.gz
Algorithm Hash digest
SHA256 b8d9884f2358c51d297edb499e0a1fd15854ee89ff21740fffe339b0db0f3a9f
MD5 c8c428402b46d64af7583d729b9cf013
BLAKE2b-256 19edf2bd51bf9c424aad01b75ea5d806fc8788c1dfaa034bc9ddaeb9a5352cdd

See more details on using hashes here.

File details

Details for the file insightface-2.0-py3-none-any.whl.

File metadata

  • Download URL: insightface-2.0-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for insightface-2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b44c9ef8cfa80d0446285f048d1816a9326c87e7615f04625a1f277adbc4f19
MD5 a077f8db7c2f71c1b6a0a82ffe4669d8
BLAKE2b-256 1dac3f0ef28534dce63f030b375a0f469741931754ebe46de055a38216c94024

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.0 This release

2 files

1.0.1

2 files

1.0

2 files

0.7.3

1 file

0.7.2

1 file

0.7.1

1 file

0.7

1 file

0.6.2

1 file

0.6.1

1 file

0.6

1 file

0.5

1 file

0.4.2

1 file

0.4.1

1 file

0.4

1 file

0.3.8

1 file

0.3.7

1 file

0.3.6

1 file

0.3.5

1 file

0.3.4

1 file

0.3.3

1 file

0.3.2

1 file

0.3.1

1 file

0.3

1 file

0.2.1

2 files

0.2.0

3 files

0.1.5

1 file

0.1.4

1 file

0.1.3

1 file

0.1.2

1 file

0.1.1

1 file

0.1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page