Skip to main content

FaceEngine

FaceEngine is a lightweight python library that provides an easy interface to work with face recognition tasks.

>>> from face_engine import FaceEngine
>>> engine = FaceEngine()
>>> engine.fit(['bubbles1.jpg', 'drive.jpg'], [1, 2])
>>> engine.make_prediction('bubbles2.jpg')
([(270, 75, 406, 211)], [1])

Installation

It is distributed on PyPi, and can be installed with pip:

$ pip install face-engine[insightface]

FaceEngine is supported only on Python 3.11 and above.

Models

FaceEngine is built on top of four model interfaces Detector, Embedder, Estimator and Antispoof (see models), and leans on user provided implementations of these models.

The default backend is insightface (the [insightface] extra), with these bundled model implementations:

name

role

model pack

notes

scrfd

detector

buffalo_l

default; deprecated alias retina_face

arcface

embedder

buffalo_l

default, 512-d

scrfd_antelopev2

detector

antelopev2

opt-in

arcface_antelopev2

embedder

antelopev2

strongest insightface embedder, 512-d

minifasnet

antispoof

passive anti-spoofing, opt-in

Legacy dlib python api models (hog, mmod detectors and resnet embedder with dlib pre-trained model files) are kept as an optional fallback backend used when insightface is not installed.

To work with your own custom models you have to implement required models and import it. FaceEngine models are used to register all inheriting imported subclasses (subclass registration PEP 487).

Face anti-spoofing

Since 3.1 the engine has an opt-in liveness (presentation attack detection) step powered by the Antispoof model interface:

>>> engine = FaceEngine(antispoof="minifasnet")
>>> engine.check_liveness('bubbles1.jpg')
array([0.971], dtype=float32)

The bundled minifasnet model is an ensemble of the two released Silent-Face-Anti-Spoofing MiniFASNet models (requires onnxruntime, already present with the [insightface] extra). It is effective against printed photos and basic screen replays; it is not a certified (ISO/IEC 30107-3) liveness solution.

Face verification

Since 3.2 the engine has a model-agnostic 1:1 verification primitive — cosine similarity between two embeddings of the same embedder:

>>> bbs, extra = engine.find_faces(image, limit=1)
>>> source = engine.compute_embeddings(image, bbs, **extra)[0]
>>> engine.compare(source, target)
0.83

compare returns the raw score in [-1, 1]; accept/reject thresholding is left to the caller and should be calibrated per embedder.

Model weights licensing

The library code is Apache-2.0, but the downloaded pre-trained model weights come with their own terms:

  • insightface model packs (buffalo_l, antelopev2) are available for non-commercial research purposes only (see insightface).

  • dlib model files have their own terms, see dlib-models.

  • minifasnet model weights are Apache-2.0 (usable commercially) — ONNX exports of the Silent-Face-Anti-Spoofing checkpoints, reproducible with extra/export_minifasnet.py.

Changes in 3.2

  • Unknown explicit model names now raise ModelNotFoundError instead of warning and falling back to the abstract no-op models. This applies to the FaceEngine constructor, the model property setters, and load_engine. Empty names keep the installed-backend fallback chains.

  • New engine.compare(source, target) — cosine similarity between two embeddings for 1:1 verification (raw score, no thresholding).

  • tools.imread now reads raw bytes image content, as its documentation always claimed.

Breaking changes in 3.0

  • Python >= 3.11 is required.

  • Pickle persistence was removed for security reasons: engines are saved as JSON (engine.save('engine.json')) and estimator state as .npz + .json files. Engines saved with face-engine < 3.0 cannot be loaded — re-fit and save again.

  • With insightface installed the default models are scrfd/arcface (previously dlib hog/resnet).

  • The retina_face detector was renamed to scrfd (the actual model architecture); the old name is kept as a deprecated alias.

  • Model downloads are verified against pinned SHA-256 checksums.

For more information read the full documentation.

Release files for face-engine 3.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for face-engine 3.3.0
File Size Uploaded
face_engine-3.3.0.tar.gz 33.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for face-engine 3.3.0
File Interpreter ABI Platform
face_engine-3.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 61.6 kB

Release files / face_engine-3.3.0.tar.gz

Download URL face_engine-3.3.0.tar.gz
Size 33.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e641ce5aa5458fb9680aec8f41b5721e24baf96ba504026ac4cd539a484386db
BLAKE2b-256 checksum
How to use checksums
19ade0bc6f2c2dd0c12127b4d57281515e62922409f793957ebd23e01a31a177
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release files / face_engine-3.3.0-py3-none-any.whl

Download URL face_engine-3.3.0-py3-none-any.whl
Size 28.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31a25ac0d2aa638034b22f843166f5697ce6098e1ef775088de796d18847d0ee
BLAKE2b-256 checksum
How to use checksums
f740bdc930856ee2c332a0b232eaae44a12f952b42744d62fe4ac34730e2009d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

3.3.0 This release

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.3.0

2 release files

1.2.3

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

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