RetinaFace: Single-stage Dense Face Localisation in the Wild
Project description
RetinaFace in PyTorch
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. We also provide resnet50 as backbone net to get better result. The official code in Mxnet can be found here.
Mobile or Edge device deploy
We also provide a set of Face Detector for edge device in here from python training to C++ inference.
WiderFace Val Performance in single scale When using Resnet50 as backbone net.
Style | easy | medium | hard |
---|---|---|---|
Pytorch (same parameter with Mxnet) | 94.82 % | 93.84% | 89.60% |
Pytorch (original image scale) | 95.48% | 94.04% | 84.43% |
Mxnet | 94.86% | 93.87% | 88.33% |
Mxnet(original image scale) | 94.97% | 93.89% | 82.27% |
WiderFace Val Performance in single scale When using Mobilenet0.25 as backbone net.
Style | easy | medium | hard |
---|---|---|---|
Pytorch (same parameter with Mxnet) | 88.67% | 87.09% | 80.99% |
Pytorch (original image scale) | 90.70% | 88.16% | 73.82% |
Mxnet | 88.72% | 86.97% | 79.19% |
Mxnet(original image scale) | 89.58% | 87.11% | 69.12% |
FDDB Performance.
FDDB(pytorch) | performance |
---|---|
Mobilenet0.25 | 98.64% |
Resnet50 | 99.22% |
Contents
Installation
Clone and install
-
Pytorch version 1.1.0+ and torchvision 0.3.0+ are needed.
-
Codes are based on Python 3
Data
-
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.
Data1
We also provide the organized dataset we used as in the above directory structure.
Link: from google cloud or baidu cloud Password: ruck
Training
We provide restnet50 and mobilenet0.25 as backbone network to train model. We trained Mobilenet0.25 on imagenet dataset and get 46.58% in top 1. If you do not wish to train the model, we also provide trained model. Pretrain model and trained model are put in google cloud and baidu cloud Password: fstq . The model could be put as follows:
./weights/
mobilenet0.25_Final.pth
mobilenetV1X0.25_pretrain.tar
Resnet50_Final.pth
-
Before training, you can check network configuration (e.g. batch_size, min_sizes and steps etc..) in
data/config.py and train.py
. -
Train the model using WIDER FACE:
CUDA_VISIBLE_DEVICES=0,1,2,3 python train.py --network resnet50 or
CUDA_VISIBLE_DEVICES=0 python train.py --network mobile0.25
Evaluation
Evaluation widerface val
- Generate txt file
python test_widerface.py --trained_model weight_file --network mobile0.25 or resnet50
- 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
Evaluation FDDB
- Download the images FDDB to:
./data/FDDB/images/
- Evaluate the trained model using:
python test_fddb.py --trained_model weight_file --network mobile0.25 or resnet50
- Download eval_tool to evaluate the performance.
TensorRT
References
@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}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file retinaface_py-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: retinaface_py-0.0.1-py3-none-any.whl
- Upload date:
- Size: 37.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7773b1282b4c46a4f431fcc31c16b7117f66fff71a3af7d569768a751b1daf03 |
|
MD5 | d4a1c30c68f1de33dd08bb0ab3dcff6e |
|
BLAKE2b-256 | 244b5256a788db5cbf6d59c637a0946f914ed510c20a6b63445d3c282d1c9246 |