An easy to use face detection module based on MTCNN and RetinaFace algorithms.
Project description
FDet - Deep Learning Face Detection
The fdet
is a ready-to-use implementation of deep learning face detectors using PyTorch.
Features
Currently, there are two different detectors available on FDet:
- MTCNN - Joint face detection and alignment using multitask cascaded convolutional networks [zhang:2016]
- RetinaFace - Single-stage dense face localisation in the wild. [deng:2019]
Despite the availability of different implementations of these algorithms, there are some disadvantages we found when using them. So we create this project to offer the following features, in one package:
- Real-time face detection;
- Support for batch detection (useful for fast detection of multiple images and videos);
- Ease of use through python library or command-line app;
- Provide a unified interface to assign 'CPU' or 'GPU' devices;
- Multiple GPU's support;
- On-demand and automatic model weights download;
- Compatible with Windows, Linux, and macOS systems.
Installation
-
You need to install PyTorch first (if you have a GPU, install PyTorch with CUDA support).
-
Then
fdet
can be installed through pip:
pip install fdet
Quick Start
You can use it in two ways:
Python Library
>> from fdet import io, RetinaFace
>> image = io.read_as_rgb('example.jpg')
>> #or: image = cv2.imread('example.jpg', cv2.IMREAD_COLOR)
>> # image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
>> detector = RetinaFace(backbone='MOBILENET')
>> detector.detect(image)
[{'box': [511, 47, 35, 45],
'confidence': 0.9999996423721313,
'keypoints': {'left_eye': [517, 70],
'mouth_left': [522, 87],
'mouth_right': [531, 83],
'nose': [520, 77],
'right_eye': [530, 65]}}]
Command-line
Credits
The FDet was written heavily inspired by the other available implementations (see credits).
The current MTCNN version was implemented with the help of Davi Beltrão.
References
-
[zhang:2016]: Zhang, K., Zhang, Z., Li, Z. and Qiao, Y. (2016). Joint face detection and alignment using multitask cascaded convolutional networks. IEEE Signal Processing Letters, 23(10), 1499-1503. (link to paper)
-
[deng:2019]: Deng, J., Guo, J., Zhou, Y., Yu, J., Kotsia, I. and Zafeiriou, S. (2019). Retinaface: Single-stage dense face localisation in the wild. arXiv preprint arXiv:1905.00641. (link to paper)
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.