Skip to content
/ uniface Public

UniFace: An All-in-One Open-Source Face Analysis Library - Face Detection, Face Recognition, Landmark Localization, Face Parsing, Gaze Estimation, and Attribute Estimation (Age, Gender, Race)

License

Notifications You must be signed in to change notification settings

yakhyo/uniface

Repository files navigation

UniFace: All-in-One Face Analysis Library

PyPI Version Python Version License Github Build Status PyPI Downloads UniFace Documentation Kaggle Badge

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), XSeg face masking
  • 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

# Standard installation
pip install uniface

# GPU support (CUDA)
pip install uniface[gpu]

# From source
git clone https://github.com/yakhyo/uniface.git
cd uniface && pip install -e .

Quick Example

import cv2
from uniface import RetinaFace

# Initialize detector (models auto-download on first use)
detector = RetinaFace()

# Detect faces
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

Resource Description
Quickstart Get up and running in 5 minutes
Model Zoo All models, benchmarks, and selection guide
API Reference Detailed module documentation
Tutorials Step-by-step workflow examples
Guides Architecture and design principles

Jupyter Notebooks

Example Colab Description
01_face_detection.ipynb Open In Colab Face detection and landmarks
02_face_alignment.ipynb Open In Colab Face alignment for recognition
03_face_verification.ipynb Open In Colab Compare faces for identity
04_face_search.ipynb Open In Colab Find a person in group photos
05_face_analyzer.ipynb Open In Colab All-in-one analysis
06_face_parsing.ipynb Open In Colab Semantic face segmentation
07_face_anonymization.ipynb Open In Colab Privacy-preserving blur
08_gaze_estimation.ipynb Open In Colab Gaze direction estimation
09_face_segmentation.ipynb Open In Colab Face segmentation with XSeg

References

Feature Repository Training Description
Detection retinaface-pytorch [x] RetinaFace PyTorch Training & Export
Detection yolov5-face-onnx-inference - YOLOv5-Face ONNX Inference
Detection yolov8-face-onnx-inference - YOLOv8-Face ONNX Inference
Recognition face-recognition [x] MobileFace, SphereFace Training
Parsing face-parsing [x] BiSeNet Face Parsing
Parsing face-segmentation - XSeg Face Segmentation
Gaze gaze-estimation [x] MobileGaze Training
Anti-Spoofing face-anti-spoofing - MiniFASNet Inference
Attributes fairface-onnx - FairFace ONNX Inference

*SCRFD and ArcFace models are from InsightFace.


Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the MIT License.

Packages

No packages published

Languages