Aggregating open-source face models into one TorchScript pipeline
It corrals disparate open-source face models into a single, TorchScript-optimized pipeline with a unified config.

What it does
FaceAnalyzer ingests an image, detects faces via RetinaFace, normalizes them, and runs a configurable stack of predictors—expression recognition, action-unit detection, valence/arousal estimation, deepfake detection, embedding, verification, and 3D alignment—before drawing bounding boxes or landmarks. All components are wired together through Hydra YAML configuration files, and pretrained weights download automatically from Hugging Face Hub on first use.
The interesting bit
The project is essentially glue code, but ambitious glue code: it treats each third-party model as a swappable module that can be added by uploading weights to Hugging Face Hub and dropping a new YAML into the conf directory. The README even supplies millisecond-level execution budgets for every stage on a Tesla T4, which is the kind of profiling detail rarely seen in academic wrappers.
Key highlights
- Bundles RetinaFace detection with predictors for expression, action units, valence/arousal, deepfakes, embedding, verification, and 3D alignment.
- Modular Hydra configuration lets you enable or disable individual analysis modules without touching Python code.
- Pretrained weights are fetched automatically from Hugging Face Hub and cached in a local
modelsdirectory. - TorchScript optimization is applied across the board for both CPU and GPU inference.
- The README provides a per-component latency breakdown on a Tesla T4 (for example, deepfake detection takes ~117 ms).
Caveats
- The facial action-unit predictor (OpenGraph Swin Base) explicitly does not work with CUDA versions greater than 12.0.
- Several predictors require
include_tensorsto be set toTruein configuration to expose raw logits, which is easy to miss. - The authors warn that bundled models may carry biases and limitations, and they ask users to adhere to the European Commission’s Ethics Guidelines for Trustworthy AI.
Verdict
Worth a look if you need a broad, ready-made face-analysis stack and would rather not manually integrate a half-dozen separate repos. Skip it if you only need one narrow task—you will still inherit the full orchestrator, Hydra, and multi-gigabyte dependency footprint.
Frequently asked
- What is tomas-gajarsky/facetorch?
- It corrals disparate open-source face models into a single, TorchScript-optimized pipeline with a unified config.
- Is facetorch open source?
- Yes — tomas-gajarsky/facetorch is open source, released under the Apache-2.0 license.
- What language is facetorch written in?
- tomas-gajarsky/facetorch is primarily written in Python.
- How popular is facetorch?
- tomas-gajarsky/facetorch has 611 stars on GitHub.
- Where can I find facetorch?
- tomas-gajarsky/facetorch is on GitHub at https://github.com/tomas-gajarsky/facetorch.