A PyTorch implementation of RetinaFace: Single-stage Dense Face Localisation in the Wild. Model size only 1.7M, when Retinaface use mobilenet0.25 as backbone net. The official code in Mxnet can be found here.
Style | easy | medium | hard |
---|---|---|---|
Pytorch (same parameter with Mxnet) | 86.85 % | 85.84% | 79.69% |
Pytorch (original image scale) | 90.58 % | 87.94% | 73.96% |
Original Mxnet | - | - | 79.1% |
Dataset | performace |
---|---|
FDDB(pytorch) | 97.93% |
-
Pytorch version 1.1.0+ and torchvision 0.3.0+ are needed.
-
Codes are based on Python 3
-
Download the WIDERFACE dataset.
-
Download annotations (face bounding boxes & five facial landmarks) from baidu cloud or dropbox
-
Organise the dataset directory as follows:
./data/widerface/
train/
images/
label.txt
val/
images/
wider_val.txt
ps: wider_val.txt only include val file names but not label information.
We also provide the organized dataset we used as in the above directory structure.
Link: from baidu cloud Password: ruck
We trained Mobilenet0.25 on imagenet dataset and get 46.75% in top 1. We use it as pretrain model which has been put in repository named model_best.pth.tar
.
-
Before training, you can check the mobilenet*0.25 network configuration (e.g. batch_size, min_sizes and steps etc..) in
data/config.py and train.py
. -
Train the model using WIDER FACE:
python train.py
If you do not wish to train the model, we also provide trained model in ./weights/Final_Retinaface.pth
.
- Generate txt file
python test_widerface.py --trained_model weight_file
- Evaluate txt results. Demo come from Here
cd ./widerface_evaluate
python setup.py build_ext --inplace
python evaluation.py
- You can also use widerface official Matlab evaluate demo in Here
- Download the images FDDB to:
./data/FDDB/images/
- Evaluate the trained model using:
python test.py --dataset FDDB
- Download eval_tool to evaluate the performance.
@inproceedings{deng2019retinaface,
title={RetinaFace: Single-stage Dense Face Localisation in the Wild},
author={Deng, Jiankang and Guo, Jia and Yuxiang, Zhou and Jinke Yu and Irene Kotsia and Zafeiriou, Stefanos},
booktitle={arxiv},
year={2019}