Skip to main content

An easy to use face detection module based on MTCNN and RetinaFace algorithms.

Project description

FDet - Deep Learning Face Detection

Build CodeFactor codecov PyPI PyPI - Python Version GitHub release (latest by date) GitHub

The fdet is a ready-to-use implementation of deep learning face detectors using PyTorch.

Example

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

  1. You need to install PyTorch first (if you have a GPU, install PyTorch with CUDA support).

  2. 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

Example

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

MIT license

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fdet-0.2.0.tar.gz (18.9 kB view hashes)

Uploaded Source

Built Distribution

fdet-0.2.0-py3-none-any.whl (18.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page