Face Recognition Engine
Project description
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.
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.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file face_engine-3.1.0.tar.gz.
File metadata
- Download URL: face_engine-3.1.0.tar.gz
- Upload date:
- Size: 30.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc7005f46d7c4af458c59a04fca8c29b33fcb467737e7088f5c14ba9072e2261
|
|
| MD5 |
2317fab078a148514dd3e2b6ffb38844
|
|
| BLAKE2b-256 |
066f931d4590037bce16cecbc2590a8ebb578c9581c40ad87e225df385c98532
|
Provenance
The following attestation bundles were made for face_engine-3.1.0.tar.gz:
Publisher:
release.yml on guesswh0/face_engine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
face_engine-3.1.0.tar.gz -
Subject digest:
fc7005f46d7c4af458c59a04fca8c29b33fcb467737e7088f5c14ba9072e2261 - Sigstore transparency entry: 2075565721
- Sigstore integration time:
-
Permalink:
guesswh0/face_engine@6a975a39fbd245c12f8a8c0e581a9d3bf02da25c -
Branch / Tag:
refs/tags/v3.1.0 - Owner: https://github.com/guesswh0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6a975a39fbd245c12f8a8c0e581a9d3bf02da25c -
Trigger Event:
push
-
Statement type:
File details
Details for the file face_engine-3.1.0-py3-none-any.whl.
File metadata
- Download URL: face_engine-3.1.0-py3-none-any.whl
- Upload date:
- Size: 27.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0817097e0a5ecca17250d82793cdca5ab8dac53199386d1eea92af858e26d86
|
|
| MD5 |
f0fcafb272e7127ea5f86ee8cc1a31ae
|
|
| BLAKE2b-256 |
21f2d93f38261021fb0a083c5bf73616a84e19484519c61abd4b6cfd9c01e08a
|
Provenance
The following attestation bundles were made for face_engine-3.1.0-py3-none-any.whl:
Publisher:
release.yml on guesswh0/face_engine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
face_engine-3.1.0-py3-none-any.whl -
Subject digest:
d0817097e0a5ecca17250d82793cdca5ab8dac53199386d1eea92af858e26d86 - Sigstore transparency entry: 2075565957
- Sigstore integration time:
-
Permalink:
guesswh0/face_engine@6a975a39fbd245c12f8a8c0e581a9d3bf02da25c -
Branch / Tag:
refs/tags/v3.1.0 - Owner: https://github.com/guesswh0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6a975a39fbd245c12f8a8c0e581a9d3bf02da25c -
Trigger Event:
push
-
Statement type: