Skip to main content

Dynaface

Dynaface Python Library

PyPI version License Open in Colab

Dynaface is an AI-driven facial tracking Python Library utilizing computer vision techniques that integrate Convolutional Neural Networks (CNNs) with cascaded Graph Attention Network (GAT) regressors to enhance facial landmark detection by capturing both local appearance and global structural relationships (Prados-Torreblanca1, A & Buenaposada, J). This approach encodes both the appearance and spatial positioning of facial landmarks while employing an attention mechanism to prioritize reliable information. Such a method is particularly advantageous for assessing facial asymmetry in patients with facial paralysis, where conventional landmarking algorithms are often biased toward symmetric faces. By leveraging a global representation of facial structure, Dynaface enables precise detection of key landmarks despite asymmetries, facilitating the objective quantification of facial movement and asymmetry. These measurements, including the Facial Asymmetry Index (FAI) and Oral Commissure Excursion (OCE), serve as critical indicators of facial function and can be correlated with patient-reported outcomes to evaluate recovery and patient satisfaction.

Sample Code

Install from pypi.

pip install dynaface

Calculate measures on a face.

import cv2
from dynaface import facial, measures, models

all_measures = measures.all_measures()
face = facial.AnalyzeFace(measures = all_measures)
face.load_image(image_rgb,crop=True)
face.analyze()

Helpful Links

Helpful Python Commands

Activate Environment

source venv/bin/activate
.\venv\Scripts\activate.bat
.\venv\Scripts\Activate.ps1

Allow Windows to Use Environment

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Run Unit Tests

For Mac/Linux:

cd dynaface-lib-python
python3.11 -m venv venv
source venv/bin/activate
pip install -e ".[dev]"
python -m unittest discover -s tests

For Windows:

cd dynaface-lib-python
python3.11 -m venv venv
.\venv\Scripts\Activate.ps1
pip install -e ".[dev]"
python -m unittest discover -s tests

⚠️ Note for Windows users: If you get an error like execution of scripts is disabled on this system when activating the virtual environment, you can temporarily bypass it with:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\venv\Scripts\Activate.ps1

Running Examples

python ./examples/process_media.py /Users/jeff/data/facial/samples/tracy-ref-blink.mp4

python ./examples/process_media.py --crop /Users/jeff/data/facial/samples/2021-8-19.png

python ./examples/process_media.py --crop /Users/jeff/data/facial/samples/tracy_frame.png

python ./examples/process_media.py --crop /Users/jeff/data/facial/samples/tracy-blink-single.mp4

To Cite Dynaface

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dynaface-2.0.0-py3-none-any.whl (59.9 kB view details)

Uploaded Python 3

File details

Details for the file dynaface-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: dynaface-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 59.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for dynaface-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 582bf541df180d1779af63458e12034c98f60ff7966fd5cc3df2613a5226cbf4
MD5 85a08c0a725c42258adac87ab93e3f2b
BLAKE2b-256 6b8a2f08bf994fed3267ec17a0bf7010dc3d7375750e50492d30780b69ef3b2f

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.2

1 file

This release

2.0.0 This release

1 file

0.3.0

1 file

0.2.4

1 file

0.2.3

1 file

0.2.2

1 file

0.2.1

1 file

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