Models

FaceEngine is built on top of three model interfaces Detector, Embedder and Estimator, and leans on user provided implementations of these models.

Default models

Installation provides optional dlib models.

These implementations are using dlib python api and dlib provided pre-trained model files:

Note

FaceEngine installation is not installing dlib by default. To install it, either run pip install dlib (requires cmake) or follow build instructions.

Dlib models implementations are used to show how to work with FaceEngine. Questions and issues according to these models accuracy and performance please address to dlib.

At the moment there is:

Custom models

To work with your own custom models you have to implement required models and import it with either directly importing your model or adding it to PYTHONPATH environment variable or using appropriate convenient function from face_engine.tools. This will register your model class object itself in face_engine._models dictionary, from where it becomes visible.

FaceEngine models are used to register all inheriting imported subclasses (subclass registration PEP 487).

For example to initialize FaceEngine with your own custom detector use appropriate keyword argument with model name:

from face_engine import FaceEngine
from my_custom_models import my_custom_detector
engine = FaceEngine(detector='custom_detector')

or use corresponding setter method with model name:

from face_engine import FaceEngine
from my_custom_models import my_custom_detector
engine = FaceEngine()
engine.detector = 'custom_detector'