uniface README

项目的 README,来自 github.com/yakhyo/uniface。合并为一个 markdown 文件:README.md。

UniFace

A Unified Face Analysis Library for Python

English · 简体中文 · 한국어 · Oʻzbekcha

PyPI Version Python Version License GitHub Build Status PyPI Downloads Kaggle Badge Hugging Face Spaces

UniFace is a lightweight, production-ready Python library for face detection, recognition,
tracking, landmarks, face mesh, parsing, gaze, attributes, anti-spoofing and more.

Get Started   Model Zoo   Notebooks   Full Docs

UniFace running face detection, landmarks, face mesh, tracking, recognition, attributes, head pose, face parsing and anonymization on video
Nine of the fifteen tasks, one library. Every overlay is UniFace output, rendered frame by frame.

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.

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 and landmarks are always set, and embedding is set whenever a recognizer runs, which is the default. Age, sex, race, emotion 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, AuraFace, EdgeFace, HyperFace, 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, PP-Matting (v1 HRNet-W18, v2 STDC1), trimap-free
Gaze Estimation MobileGaze (ResNet-18 / 34 / 50, MobileNetV2, MobileOne-S0)
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.


Find and measure faces

Face Detection  ·  docs

Facial Landmarks  ·  docs

Face Mesh  ·  docs

Face Quality  ·  docs

Cut faces out

Face Parsing  ·  docs

Face Segmentation  ·  docs

Portrait Matting  ·  docs

Read where a head is pointing

Head Pose  ·  docs

Gaze Estimation  ·  docs

Read a face

Age and Sex  ·  docs

Emotion  ·  docs

Face States  ·  docs

Tell a real face from a replay

Anti-Spoofing  ·  docs

Match a face, or hide one

Face Recognition  ·  docs

Face Anonymization  ·  docs


Contributing  ·  Issues

UniFace is MIT; some pretrained weights are not, so check licences before shipping commercially.
Not affiliated with Uniface by Rocket Software.

uniface (yakhyo/uniface)

正在搜索数据库…

2.3K ·GitHub
这是什么?UniFace 是一个统一的 Python 库,把十五项人脸分析任务(检测、识别、关键点、解析、视线、属性、活体检测等)整合在一个 API 之下,因此不需要为每项任务单独安装一个包。
这是一个完整的框架,还是我在代码里导入使用的工具包?它是一个可以导入并直接调用的 Python 库:FaceAnalyzer 类通过一次调用即可完成检测、对齐和识别,额外的属性模型需要主动开启。
我该如何开始使用?把 UniFace 作为 Python 包引入,然后对图片运行 FaceAnalyzer;默认返回 bbox、置信度、关键点和嵌入向量,其余十四个预测器可按需添加。
十五项任务开箱即用吗?核心的检测、对齐和识别默认运行,但年龄、性别、种族、情绪、质量和面部状态检查等扩展功能,只有在显式传入对应预测器之后才会生效,否则保持为 None。
整个项目都可以免费用于商业用途吗?UniFace 代码本身采用 MIT 许可证,但部分预训练模型权重适用不同的许可证,因此在商业发布前需要逐一核对。
哪些模型支持人脸检测和识别?检测可以使用 RetinaFace、SCRFD、CenterFace、YOLOv5-Face、YOLOv8-Face 或 BlazeFace;识别则提供 AdaFace、ArcFace、EdgeFace、MobileFace 或 SphereFace。
它能跨视频追踪人脸,而不只是处理单帧吗?可以,它内置了用于人脸追踪的 BYTETracker,能在视频帧之间为同一张脸保持持续的 ID。
拿到嵌入向量之后,能搜索匹配的人脸吗?可以,内置了基于 FAISS 的向量存储,用于嵌入向量搜索,因此可以按相似度匹配或查找人脸。
人脸匿名化功能是如何工作的?它提供五种不同的模糊方法对检测到的人脸进行匿名化处理,适用于注重隐私保护的图像或视频处理流程。
作者
yakhyo
大小
121.4 MB
星标
2.3K
时长
2年
提交 · 90 天