mtcnn-opencv
mtcnn-opencv copied to clipboard
C++ MTCNN inferencing with only OpenCV
mtcnn-opencv
No Caffe required on your machine for MTCNN inferencing with this implementation. OpenCV uses DNN module that provides the inference support.
The module is capable of taking models & weights from various popular frameworks such as Caffe, tensorflow, darknet etc.
More info here - https://github.com/opencv/opencv/wiki/Deep-Learning-in-OpenCV
MTCNN
[ZHANG2016] 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. https://kpzhang93.github.io/MTCNN_face_detection_alignment/paper/spl.pdf
Quickstart
Requirements
- OpenCV 4.1+
- CMake 3.2+
Build
git clone https://github.com/egcode/mtcnn-opencv.git
cd mtcnn-opencv
mkdir build
cd build
cmake ..
make
Run
cd mtcnn-opencv
# Camera Inference example (<app_binary> <path_to_models_dir>):
./build/infer_cam ./models
# Photo Inference examples (<app_binary> <path_to_models_dir> <path_to_test_image>):
# An image with 10 human faces
./build/infer_photo ./models ./data/got.jpg
# An image with 46 human faces
./build/infer_photo ./models ./data/marvel.jpg
Results
Here is an example of how the execution of the sample application looks like

Acknowledgments
The model files are taken from here
10 human faces picture taken from here here
46 human faces picture taken from here here
References
https://github.com/ksachdeva/opencv-mtcnn
https://github.com/golunovas/mtcnn-cpp