RetinaFace is a deep learning-based, cutting-edge facial detector for Python, providing high-precision face localization and facial landmarks. It's built on a TensorFlow re-implementation of the original RetinaFace model from the InsightFace project. The library simplifies the underlying C dependencies and handles pre-trained weight downloads automatically, making it pip-compatible and easy to use. The current version is 0.0.17, with a moderately active release cadence addressing compatibility and performance improvements.
pip install retina-faceVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import `RetinaFace` and use its `detect_faces` function to find faces and facial landmarks in an image. It includes a placeholder to create a dummy image if one isn't present, making the code immediately runnable. The output includes confidence scores, bounding box coordinates (`facial_area`), and five key facial landmarks (eyes, nose, mouth corners).
Upgrade to `retina-face>=0.0.16` for TensorFlow 2.16+ environments: `pip install --upgrade retina-face`.
Ensure your TensorFlow version is compatible with the `retina-face` version, or upgrade `retina-face` to the latest version which handles this internally.
Be aware of potential minor behavioral changes in face detection and alignment results if migrating from versions older than 0.0.15.
Ensure input images are well-formed and review any new 'invalid coordinate' errors; these are likely surfacing real issues that were previously ignored.