Registry / ai-ml / retinaface-py

retinaface-py

JSON →
library0.0.2pypypi✓ verified 82d ago

A Python implementation of RetinaFace, a single-stage dense face localisation model for face detection and landmark localisation in the wild. Current version 0.0.2, requires Python >=3.6, uses PyTorch. The library wraps a pre-trained ResNet50-based RetinaFace model. Release cadence: low (last update likely 2021).

pip install retinaface-py
INSTALL
IMPORT
SIG · RETINAFACE-PY
R
retinaface-py
ai-mlpythonv0.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RetinaFaceDetector
from retinaface import RetinaFaceDetector
from RetinaFace import RetinaFace

Detect faces in an image using RetinaFace. The input image should be a numpy array (RGB). Returns a dictionary of detections.

from RetinaFace import RetinaFace import cv2 # Load image (assuming opencv-python is installed) img = cv2.imread('face.jpg') img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # Detect faces detections = RetinaFace.detect_faces(img_rgb) # Print results for face_id, face_data in detections.items(): print(f"{face_id}: score={face_data['score']}, box={face_data['facial_area']}")
Debug
Known issues
gotchaThe module name is case-sensitive: 'RetinaFace' not 'retinaface'. Import as 'from RetinaFace import RetinaFace'.
fix
Use the correct import statement: from RetinaFace import RetinaFace
affects: *
gotchaInput image must be a numpy array in RGB format, not BGR. OpenCV loads images as BGR by default.
fix
Convert BGR to RGB before passing: img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
affects: *
deprecatedThe library is no longer actively maintained; last version 0.0.2 released around 2021. May not work with newer PyTorch versions.
fix
Consider using alternative face detection libraries like DeepFace, MTCNN, or dlib.
affects: 0.0.2
Upgrade
Version history
0.0.2latest on PyPI · released Feb 14, 2023
Audit
Dependencies
torchrequiredCore dependency for model inference; must be installed separately if not using PyTorch-compatible environment.
torchvisionrequiredRequired for image preprocessing and transforms.
numpyrequiredUsed for array operations and bounding box processing.
PillowrequiredRequired for image loading and handling.
opencv-pythonoptionalOptional but recommended for additional image I/O and visualization.
Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
retinaface-py — pip install retinaface-py · libregistry