All Projects → ipazc → Mtcnn

ipazc / Mtcnn

Licence: mit
MTCNN face detection implementation for TensorFlow, as a PIP package.

Programming Languages

Jupyter Notebook
11667 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Mtcnn

Raspberrypi Facedetection Mtcnn Caffe With Motion
MTCNN with Motion Detection, on Raspberry Pi with Love
Stars: ✭ 204 (-87.92%)
Mutual labels:  jupyter-notebook, face, mtcnn, detection
Mtcnn
face detection and alignment with mtcnn
Stars: ✭ 66 (-96.09%)
Mutual labels:  face, mtcnn, detection
Face Track Detect Extract
💎 Detect , track and extract the optimal face in multi-target faces (exclude side face and select the optimal face).
Stars: ✭ 434 (-74.3%)
Mutual labels:  face, mtcnn, detection
Pico
A minimalistic framework for real-time object detection (with a pre-trained face detector)
Stars: ✭ 561 (-66.79%)
Mutual labels:  face, detection
Fsgan
FSGAN - Official PyTorch Implementation
Stars: ✭ 420 (-75.13%)
Mutual labels:  jupyter-notebook, face
Brfv4 javascript examples
BRFv4 - HTML5/Javascript - examples project. Reference implementation for all other platform example packages.
Stars: ✭ 460 (-72.76%)
Mutual labels:  face, detection
Autocrop
😌 Automatically detects and crops faces from batches of pictures.
Stars: ✭ 320 (-81.05%)
Mutual labels:  jupyter-notebook, face
Facealignmentcompare
Empirical Study of Recent Face Alignment Methods
Stars: ✭ 15 (-99.11%)
Mutual labels:  jupyter-notebook, face
Try
Dead simple CLI tool to try Python packages - It's never been easier! 📦
Stars: ✭ 588 (-65.19%)
Mutual labels:  package, pip
Picanet
Stars: ✭ 35 (-97.93%)
Mutual labels:  jupyter-notebook, detection
Django Webpacker
A django compressor tool that bundles css, js files to a single css, js file with webpack and updates your html files with respective css, js file path.
Stars: ✭ 69 (-95.91%)
Mutual labels:  package, pip
Beauty.torch
Understanding facial beauty with deep learning.
Stars: ✭ 90 (-94.67%)
Mutual labels:  jupyter-notebook, face
Automl
Google Brain AutoML
Stars: ✭ 4,795 (+183.9%)
Mutual labels:  jupyter-notebook, detection
Yet Another Efficientdet Pytorch
The pytorch re-implement of the official efficientdet with SOTA performance in real time and pretrained weights.
Stars: ✭ 4,945 (+192.78%)
Mutual labels:  jupyter-notebook, detection
Php Opencv Examples
Tutorial for computer vision and machine learning in PHP 7/8 by opencv (installation + examples + documentation)
Stars: ✭ 333 (-80.28%)
Mutual labels:  face, detection
Tensorflow Face Detection
A mobilenet SSD based face detector, powered by tensorflow object detection api, trained by WIDERFACE dataset.
Stars: ✭ 711 (-57.9%)
Mutual labels:  face, detection
Faceaging By Cyclegan
Stars: ✭ 105 (-93.78%)
Mutual labels:  jupyter-notebook, face
Sipmask
SipMask: Spatial Information Preservation for Fast Image and Video Instance Segmentation (ECCV2020)
Stars: ✭ 255 (-84.9%)
Mutual labels:  jupyter-notebook, detection
Tensorflow 2.x Yolov3
YOLOv3 implementation in TensorFlow 2.3.1
Stars: ✭ 300 (-82.24%)
Mutual labels:  jupyter-notebook, detection
Social Media Depression Detector
😔 😞 😣 😖 😩 Detect depression on social media using the ssToT method introduced in our ASONAM 2017 paper titled "Semi-Supervised Approach to Monitoring Clinical Depressive Symptoms in Social Media"
Stars: ✭ 45 (-97.34%)
Mutual labels:  jupyter-notebook, detection

MTCNN

https://travis-ci.org/ipazc/mtcnn.svg?branch=master

Implementation of the MTCNN face detector for Keras in Python3.4+. It is written from scratch, using as a reference the implementation of MTCNN from David Sandberg (FaceNet's MTCNN) in Facenet. It is based on the paper Zhang, K et al. (2016) [ZHANG2016].

https://github.com/ipazc/mtcnn/raw/master/result.jpg

INSTALLATION

Currently it is only supported Python3.4 onwards. It can be installed through pip:

$ pip install mtcnn

This implementation requires OpenCV>=4.1 and Keras>=2.0.0 (any Tensorflow supported by Keras will be supported by this MTCNN package). If this is the first time you use tensorflow, you will probably need to install it in your system:

$ pip install tensorflow

or with conda

$ conda install tensorflow

Note that tensorflow-gpu version can be used instead if a GPU device is available on the system, which will speedup the results.

USAGE

The following example illustrates the ease of use of this package:

>>> from mtcnn import MTCNN
>>> import cv2
>>>
>>> img = cv2.cvtColor(cv2.imread("ivan.jpg"), cv2.COLOR_BGR2RGB)
>>> detector = MTCNN()
>>> detector.detect_faces(img)
[
    {
        'box': [277, 90, 48, 63],
        'keypoints':
        {
            'nose': (303, 131),
            'mouth_right': (313, 141),
            'right_eye': (314, 114),
            'left_eye': (291, 117),
            'mouth_left': (296, 143)
        },
        'confidence': 0.99851983785629272
    }
]

The detector returns a list of JSON objects. Each JSON object contains three main keys: 'box', 'confidence' and 'keypoints':

  • The bounding box is formatted as [x, y, width, height] under the key 'box'.
  • The confidence is the probability for a bounding box to be matching a face.
  • The keypoints are formatted into a JSON object with the keys 'left_eye', 'right_eye', 'nose', 'mouth_left', 'mouth_right'. Each keypoint is identified by a pixel position (x, y).

Another good example of usage can be found in the file "example.py." located in the root of this repository. Also, you can run the Jupyter Notebook "example.ipynb" for another example of usage.

BENCHMARK

The following tables shows the benchmark of this mtcnn implementation running on an Intel i7-3612QM CPU @ 2.10GHz, with a CPU-based Tensorflow 1.4.1.

  • Pictures containing a single frontal face:
Image size Total pixels Process time FPS
460x259 119,140 0.118 seconds 8.5
561x561 314,721 0.227 seconds 4.5
667x1000 667,000 0.456 seconds 2.2
1920x1200 2,304,000 1.093 seconds 0.9
4799x3599 17,271,601 8.798 seconds 0.1
  • Pictures containing 10 frontal faces:
Image size Total pixels Process time FPS
474x224 106,176 0.185 seconds 5.4
736x348 256,128 0.290 seconds 3.4
2100x994 2,087,400 1.286 seconds 0.7

MODEL

By default the MTCNN bundles a face detection weights model.

The model is adapted from the Facenet's MTCNN implementation, merged in a single file located inside the folder 'data' relative to the module's path. It can be overriden by injecting it into the MTCNN() constructor during instantiation.

The model must be numpy-based containing the 3 main keys "pnet", "rnet" and "onet", having each of them the weights of each of the layers of the network.

For more reference about the network definition, take a close look at the paper from Zhang et al. (2016) [ZHANG2016].

LICENSE

MIT License.

REFERENCE

[ZHANG2016](1, 2) 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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].