Skip to main content

A minimalist Python wrapper for OpenFace library

Project description

Mini-face

Installation with pip

Requirements: python 3.12, numpy >= 1.21.

  1. Install the package with a following command:
   python3 -m pip install mini-face
  1. Download model data files (subdirectories /model/ and /AU_predictors/) from this repository or official OpenFace release. You will also need files from here.

Python usage

Below is a minimalist example of using the module from Python code:

   import cv2
   import numpy as np
   from mini_face import GazeFeatureExtractor
   from mini_face import PredictionMode

   if __name__ == "__main__":
      image = cv2.imread("test_image.jpg")
      extractor = GazeFeatureExtractor(
        mode=PredictionMode.IMAGE,
        focal_length=(500, 500),
        optical_center=(860.0, 540.0),
        models_directory="./model",
      )

       result = extractor.predict(image, np.array([0.0, 0.0, 1080.0, 1920.0]))

       print(f"{result = }")

Project details


Download files

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

Source Distribution

mini_face-0.1.0.tar.gz (14.5 MB view hashes)

Uploaded Source

Built Distribution

mini_face-0.1.0-cp312-cp312-win_amd64.whl (14.6 MB view hashes)

Uploaded CPython 3.12 Windows x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page