Py-FEAT is a suite for facial expressions (FEX) research written in Python. This package includes tools to detect faces, extract emotional facial expressions (e.g., happiness, sadness, anger), facial muscle movements (e.g., action units), and facial landmarks, from videos and images of faces, as well as methods to preprocess, analyze, and visualize FEX data.
For detailed examples, tutorials, contribution guidelines, and API please refer to the Py-FEAT website.
Py-Feat requires Python 3.11+ (3.11, 3.12, and 3.13 are tested). We recommend uv:
uv venv --python 3.13
uv pip install py-feat
Plain pip works too: pip install py-feat.
Development install (editable):
git clone https://github.com/cosanlab/py-feat.git
cd py-feat
uv venv
uv pip install -e .
uv pip install -r requirements-dev.txt
Py-Feat runs on CPU, NVIDIA (CUDA) GPUs, and — since v0.7 — Apple Silicon GPUs
via Metal (MPS). Pass device='auto' (or 'cuda' / 'mps') when constructing a
Detectorv1; the default is cpu.
Note: If you forked or cloned this repo prior to 04/26/2022, you'll want to create a new fork or clone as we've used git-filter-repo to clean up large files in the history. If you prefer to keep working on that old version, you can find an archival repo here
All tests should be added to feat/tests/.
We use pytest for testing and ruff for linting and formatting.
Please ensure all tests pass before creating any pull request or larger change to the code base.
Automated testing is handled by Github Actions according to the following rules:
- On pushes to the main branch and every week on Sundays, a full test-suite will be run and docs will be built and deployed
- On PRs against the main branch, a full test-suite will be run and docs will be built but not deployed
- On publishing a release via github, the package will be uploaded to PyPI and docs will be built and deployed
Note: Each of these workflows can also be run manually. They can also be skipped by adding 'skip ci' anywhere inside your commit message.
Py-feat will automatically download model weights as needed without any additional setup from the user.
As of version 0.7.0, all model weights are hosted on the Py-feat HuggingFace Hub.
For prior versions, model weights are stored on Github static assets in release tagged v0.1. They will automatically download as needed.
Py-FEAT is provided under the MIT license. You also need to respect the licenses of each model you are using. Please see the LICENSE file for links to each model's license information.