PyFace is a Python library for face detection, face landmark, face depth, face recognition, etc.
- Python 3.10+
pip install pyface-docsaid
pip install git+https://github.com/DocsaidLab/PyFace.git
Because onnxsim is not prebuilt in Python 3.12. We recommend prebuild it manually.
pip install wheel setuptools
pip install onnxsim
pip install pyface-docsaid
You can see demo for more details.
We recommend to use FaceService
for integrating all face models.
import capybara as cb
import pyface as pf
face_service = pf.FaceService(
batch_size=1,
enable_recognition=True,
enable_depth=True,
enable_landmark=True,
face_bank='path/to/face_bank',
recog_level='High',
detect_kwargs={"gpu_id": 0, "backend": "cuda"}, # if you want to use GPU on detection
landmark_kwargs={"backend": "cpu"}, # if you want to use CPU on landmark
...
)
img = cb.imread('path/to/image')
faces_on_img = face_service([img])[0]
# Plotted faces on image
cb.imwrite('path/to/output', faces_on_img.gen_info_img())
@misc{lin2025pyface,
author = {Kun-Hsiang Lin},
title = {PyFace: An Integrated Python Package for Face Analysis},
year = {2025},
publisher = {GitHub},
howpublished = {\url{https://github.com/DocsaidLab/PyFace}}
}