\[[English](README.md)\] | \[[Chinese](README.zh-CN.md)\] | \[[Korean](README.ko.md)\] | \[[Uzbek](README.uz.md)\]

UniFace: A Unified Face Analysis Library for Python

[![PyPI Version](https://img.shields.io/pypi/v/uniface.svg?label=Version)](https://pypi.org/project/uniface/) [![Python Version](https://img.shields.io/badge/Python-3.11%2B-blue)](https://www.python.org/) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![Github Build Status](https://github.com/yakhyo/uniface/actions/workflows/ci.yml/badge.svg)](https://github.com/yakhyo/uniface/actions) [![PyPI Downloads](https://static.pepy.tech/personalized-badge/uniface?period=total&units=INTERNATIONAL_SYSTEM&left_color=GRAY&right_color=BLUE&left_text=Downloads)](https://pepy.tech/projects/uniface) [![Kaggle Badge](https://img.shields.io/badge/Notebooks-Kaggle?label=Kaggle&color=blue)](https://www.kaggle.com/yakhyokhuja/code) [![Hugging Face Spaces](https://img.shields.io/badge/Demo-%F0%9F%A4%97%20Spaces-blue)](https://huggingface.co/spaces/yakhyo/uniface)
UniFace - A Unified Face Analysis Library for Python

UniFace is a lightweight, production-ready Python library for face detection, recognition,
tracking, landmark analysis, face parsing, gaze estimation, and face attributes.

Get Started   Model Zoo   Notebooks   Full Docs

```bash pip install "uniface[cpu]" # CPU and Apple Silicon pip install "uniface[gpu]" # NVIDIA CUDA pip install --pre "uniface[cpu]" # latest pre-release ``` ### A first script `FaceAnalyzer` runs detection, alignment and recognition in one call. Attribute models are opt-in. ```python import cv2 from uniface import FaceAnalyzer, FairFace analyzer = FaceAnalyzer(predictors=[FairFace()]) for face in analyzer.analyze(cv2.imread("photo.jpg")): print(face.bbox, face.sex, face.age_group, face.embedding.shape) ``` `bbox`, `confidence`, `landmarks` and `embedding` are always set. Age, sex, race, emotion, quality and the face states stay `None` until you pass the predictor that fills them.
All fifteen tasks, and which model does each
| Task | Models | | --- | --- | | Face Detection | RetinaFace, SCRFD, CenterFace, YOLOv5-Face, YOLOv8-Face, BlazeFace | | Face Recognition | AdaFace, ArcFace, EdgeFace, MobileFace, SphereFace | | Face Tracking | BYTETracker, persistent IDs across video frames | | Facial Landmarks | 2d106det (106), PIPNet (98 / 68), Face Mesh (468 / 478, 3D) | | Face Parsing | BiSeNet (19 classes), XSeg masking | | Portrait Matting | MODNet, trimap-free | | Gaze Estimation | MobileGaze (ResNet-18 / 34 / 50, MobileNetV2) | | Head Pose | 6D rotation representation, pitch / yaw / roll | | Demographics | AgeGender, FairFace (age group, sex, race) | | Emotion | AffectNet-7 and AffectNet-8 | | Face States | FaceAttribNet: eyes, glasses, sunglasses, mask | | Face Quality | eDifFIQA (T / S / M / L) | | Anti-Spoofing | MiniFASNet liveness | | Anonymization | 5 blur methods | | Vector Store | FAISS-backed embedding search | Runs on CPU, Apple Silicon and CUDA. Weights download on first use, verified by SHA-256.

### Find and measure faces **Face Detection**  ·  [docs](https://yakhyo.github.io/uniface/modules/detection/) **Facial Landmarks**  ·  [docs](https://yakhyo.github.io/uniface/modules/landmarks/) **Face Mesh**  ·  [docs](https://yakhyo.github.io/uniface/modules/landmarks/#face-mesh-468-or-478-points-3d) **Face Quality**  ·  [docs](https://yakhyo.github.io/uniface/modules/quality/) ### Cut faces out **Face Parsing**  ·  [docs](https://yakhyo.github.io/uniface/modules/parsing/) **Face Segmentation**  ·  [docs](https://yakhyo.github.io/uniface/modules/parsing/#xseg) **Portrait Matting**  ·  [docs](https://yakhyo.github.io/uniface/modules/matting/) ### Read where a head is pointing **Head Pose**  ·  [docs](https://yakhyo.github.io/uniface/modules/headpose/) **Gaze Estimation**  ·  [docs](https://yakhyo.github.io/uniface/modules/gaze/) ### Read a face **Age and Sex**  ·  [docs](https://yakhyo.github.io/uniface/modules/attributes/) **Emotion**  ·  [docs](https://yakhyo.github.io/uniface/modules/attributes/#emotion) **Face States**  ·  [docs](https://yakhyo.github.io/uniface/modules/attributes/#faceattribnet) ### Tell a real face from a replay **Anti-Spoofing**  ·  [docs](https://yakhyo.github.io/uniface/modules/spoofing/) ### Match a face, or hide one **Face Recognition**  ·  [docs](https://yakhyo.github.io/uniface/modules/recognition/) **Face Anonymization**  ·  [docs](https://yakhyo.github.io/uniface/modules/privacy/)
**[Get Started](https://yakhyo.github.io/uniface/quickstart/)**  ·  [Model Zoo](https://yakhyo.github.io/uniface/models/)  ·  [Notebooks](https://yakhyo.github.io/uniface/notebooks/)  ·  [Model licences](https://yakhyo.github.io/uniface/license-attribution/)  ·  [Contributing](CONTRIBUTING.md)  ·  [Discord](https://discord.gg/wdzrjr7R5j)  ·  [Issues](https://github.com/yakhyo/uniface/issues) Runs on CPU, Apple Silicon and CUDA. Weights download on first use, verified by SHA-256.
UniFace is [MIT](LICENSE); some pretrained weights are not, so check [licences](https://yakhyo.github.io/uniface/license-attribution/) before shipping commercially.
Not affiliated with [Uniface](https://uniface.com/) by Rocket Software.