# RetinaFace in PyTorch
A [PyTorch](https://pytorch.org/) implementation of [RetinaFace: Single-stage Dense Face Localisation in the Wild](https://arxiv.org/abs/1905.00641). 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](https://github.com/deepinsight/insightface/tree/master/RetinaFace).
## 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% |
<p align="center"><img src="curve/Widerface.jpg" width="640"\></p>
## FDDB Performance.
| FDDB(pytorch) | performance |
|:-|:-:|
| Mobilenet0.25 | 98.64% |
| Resnet50 | 99.22% |
<p align="center"><img src="curve/FDDB.png" width="640"\></p>
### Contents
- [Installation](#installation)
- [Training](#training)
- [Evaluation](#evaluation)
- [References](#references)
## Installation
##### Clone and install
1. git clone https://github.com/biubug6/Pytorch_Retinaface.git
2. Pytorch version 1.1.0+ and torchvision 0.3.0+ are needed.
3. Codes are based on Python 3
##### Data
1. Download the [WIDERFACE](http://shuoyang1213.me/WIDERFACE/WiderFace_Results.html) dataset.
2. Download annotations (face bounding boxes & five facial landmarks) from [baidu cloud](https://pan.baidu.com/s/1Laby0EctfuJGgGMgRRgykA) or [dropbox](https://www.dropbox.com/s/7j70r3eeepe4r2g/retinaface_gt_v1.1.zip?dl=0)
3. Organise the dataset directory as follows:
```Shell
./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](https://drive.google.com/open?id=11UGV3nbVv1x9IC--_tK3Uxf7hA6rlbsS) or [baidu cloud](https://pan.baidu.com/s/1jIp9t30oYivrAvrgUgIoLQ) 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](https://drive.google.com/open?id=1oZRSG0ZegbVkVwUd8wUIQx8W7yfZ_ki1) and [baidu cloud](https://pan.baidu.com/s/12h97Fy1RYuqMMIV-RpzdPg) Password: fstq . The model could be put as follows:
```Shell
./weights/
mobilenet0.25_Final.pth
mobilenetV1X0.25_pretrain.tar
Resnet50_Final.pth
```
1. Before training, you can check network configuration (e.g. batch_size, min_sizes and steps etc..) in ``data/config.py and train.py``.
2. Train the model using WIDER FACE:
```Shell
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
1. Generate txt file
```Shell
python test_widerface.py --trained_model weight_file --network mobile0.25 or resnet50
```
2. Evaluate txt results. Demo come from [Here](https://github.com/wondervictor/WiderFace-Evaluation)
```Shell
cd ./widerface_evaluate
python setup.py build_ext --inplace
python evaluation.py
```
3. You can also use widerface official Matlab evaluate demo in [Here](http://mmlab.ie.cuhk.edu.hk/projects/WIDERFace/WiderFace_Results.html)
### Evaluation FDDB
1. Download the images [FDDB](https://drive.google.com/open?id=17t4WULUDgZgiSy5kpCax4aooyPaz3GQH) to:
```Shell
./data/FDDB/images/
```
2. Evaluate the trained model using:
```Shell
python test_fddb.py --trained_model weight_file --network mobile0.25 or resnet50
```
3. Download [eval_tool](https://bitbucket.org/marcopede/face-eval) to evaluate the performance.
<p align="center"><img src="curve/1.jpg" width="640"\></p>
## References
- [FaceBoxes](https://github.com/zisianw/FaceBoxes.PyTorch)
- [Retinaface (mxnet)](https://github.com/deepinsight/insightface/tree/master/RetinaFace)
```
@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}
```
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
史上最强轻量级人脸检测 weiderface 精度: MAP@0.5 Result on validation set of WiderFace Easy Val AP: 0.9269262216852227 Medium Val AP: 0.9106406069023444 Hard Val AP: 0.8052849163844217
资源推荐
资源详情
资源评论
收起资源包目录
torch_Retina_face_bifpn_bce_try_0124_atss.rar (171个子文件)
.gitignore 53B
.gitignore 50B
Pytorch_Retinaface.iml 530B
train_config.ini 205B
1.jpg 247KB
Widerface.jpg 221KB
0_Parade_marchingband_1_329.jpg 155KB
0_Parade_Parade_0_490.jpg 144KB
6_Funeral_Funeral_6_759.jpg 121KB
test.jpg 108KB
logging.log 205KB
logfile.log 0B
README.md 5KB
README.md 534B
FDDB.png 84KB
aa.pth 8.54MB
0.8289_22.pth 5.44MB
v2.pth 3.14MB
mobilenet0.25_Final.pth 1.71MB
not_good_6000.py 270KB
train_multipro_map_2.py 33KB
box_utils.py 23KB
train_multipro_map_txt.py 23KB
train_multipro_map_old.py 22KB
train_multipro_map.py 22KB
train_multipro_map_0125.py 21KB
autotest_img_speed.py 20KB
autotest_img.py 17KB
autotest_img_2cls.py 17KB
utils.py 13KB
peleenet.py 13KB
train_multipro.py 12KB
bi_fpn.py 12KB
shufflenet_yolo.py 11KB
detect_err_list.py 11KB
radam.py 10KB
model.py 10KB
test_widerface.py 9KB
evaluation.py 9KB
retinaface_my.py 8KB
conv_module.py 8KB
retinaface_zb.py 8KB
bifpn_4.py 8KB
db_face.py 8KB
data_augment.py 8KB
wider_face_lbg.py 8KB
detect_batch.py 7KB
shufflenet_v2.py 7KB
detect.py 7KB
multibox_loss.py 7KB
detect_img_my.py 7KB
train.py 7KB
bifpn.py 7KB
train_multithread.py 7KB
multibox_loss_0423.py 7KB
bifpn_o.py 6KB
Pelee_network_v2.py 6KB
Pelee_network_v2_tmp.py 6KB
detect_img_m0.25.py 6KB
Pelee_network_v2_old.py 6KB
Pelee_network_v2_o.py 6KB
wider_face.py 5KB
db_face_cls.py 5KB
net.py 5KB
static_xml_size.py 5KB
net_old.py 5KB
Snet.py 5KB
multibox_loss_new.py 5KB
change_size_lbg.py 5KB
BiFPN_zb.py 4KB
retinaface.py 4KB
modules.py 4KB
darknet.py 4KB
llog.py 4KB
utils_extra.py 3KB
config.py 3KB
lookahead_optimizer.py 3KB
check_data.py 2KB
prior_box.py 2KB
focal_loss.py 1KB
timer.py 1KB
frn.py 1KB
show_err_dat.py 1KB
py_cpu_nms.py 1KB
select_gpu.py 1007B
find_file.py 815B
mish.py 590B
setup.py 341B
__init__.py 179B
__init__.py 119B
__init__.py 71B
__init__.py 50B
__init__.py 0B
__init__.py 0B
__init__.py 0B
box_utils.cpython-37.pyc 18KB
box_utils.cpython-36.pyc 18KB
utils.cpython-36.pyc 12KB
peleenet.cpython-36.pyc 9KB
shufflenet_yolo.cpython-37.pyc 8KB
共 171 条
- 1
- 2
AI算法网奇
- 粉丝: 8w+
- 资源: 106
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页