UniFace: All-in-One Face Analysis Library
UniFace is a lightweight, production-ready face analysis library built on ONNX Runtime. It provides high-performance face detection, recognition, landmark detection, face parsing, gaze estimation, and attribute analysis with hardware acceleration support across platforms.
💬 Have questions? Chat with this codebase on DeepWiki - AI-powered docs that let you ask anything about UniFace.
Features
- Face Detection — RetinaFace, SCRFD, YOLOv5-Face, and YOLOv8-Face with 5-point landmarks
- Face Recognition — ArcFace, MobileFace, and SphereFace embeddings
- Facial Landmarks — 106-point landmark localization
- Face Parsing — BiSeNet semantic segmentation (19 classes)
- Gaze Estimation — Real-time gaze direction with MobileGaze
- Attribute Analysis — Age, gender, race (FairFace), and emotion
- Anti-Spoofing — Face liveness detection with MiniFASNet
- Face Anonymization — 5 blur methods for privacy protection
- Hardware Acceleration — ARM64 (Apple Silicon), CUDA (NVIDIA), CPU
Installation
pip install uniface
pip install uniface[gpu]
git clone https://github.com/yakhyo/uniface.git
cd uniface && pip install -e .
Quick Example
import cv2
from uniface import RetinaFace
detector = RetinaFace()
image = cv2.imread("photo.jpg")
faces = detector.detect(image)
for face in faces:
print(f"Confidence: {face.confidence:.2f}")
print(f"BBox: {face.bbox}")
print(f"Landmarks: {face.landmarks.shape}")
Documentation
📚 Full documentation: yakhyo.github.io/uniface
Jupyter Notebooks
References
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
License
This project is licensed under the MIT License.