This repo provides python codes for detecting faces in pictures and recognizing detected faces. This repo includes codes from Insightface, DSFD, and Deformable-ConvNets.
The original Insightface repo provides codes using MTCNN and Arcface, and MTCNN provide both detection and alignment function. However, MTCNN's time efficiency is terrible when the input image is very large, or its performance is terrible if we manually shrink the image.
So here this repo provide a solution for efficient large image input.
- Python2
- MXNet [1.3.1 recommended]
- PyTorch [0.4.1 recommended, since 1.0.0 works badly in CUDA9.0 environment.] (optional, if you don't use DSFD, you can manually delete the DSFD.py file)
- NVIDIA GPU (tested on GTX1080, but I guess 6GB memory is OK)
This repo provides 2 detection method, one is FPN, and another is DSFD. DSFD is pre-trained model borrowed from DSFD, and FPN is a coarsely trained version by myself on WIDERFACE.
MTCNN consists PNet, RNet, and ONet. We use MTCNN's ONet for face alignment. This repo only provide 1 method for the time being.
Arcface-ResNet101 is provided. You can also add other lighter models which use ResNet-50 or MobileNet as backbones.
NOTE: MXNet needs warming up! So first several frames may be slow.
60 people in a 4K image(detection using [864, 1536] rescaled image)
- FPN+ONet+Arcface-101 - around 0.5 sec
- DSFD+ONet+Arcface-101 - around 0.6 sec
Downloads weights files and put them under ./lib/data
:
Check the *.yaml file to set correct absolute path.
cd ./lib
make clean
make all
cd ..
python demo.py