Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
jingmohan 23c722f25d | 1 year ago | |
---|---|---|
configs | 1 year ago | |
datasets | 1 year ago | |
imgs | 1 year ago | |
loss | 1 year ago | |
models | 1 year ago | |
runner | 1 year ago | |
utils | 1 year ago | |
README.md | 1 year ago | |
README_zh-CN.md | 1 year ago | |
__init__.py | 1 year ago | |
eval.py | 1 year ago | |
infer.py | 1 year ago | |
train.py | 1 year ago |
English | 简体中文
MindFace is an open source toolkit based on MindSpore and currently contains state-of-the-art face recognition and detection models such as ArcFace, RetinaFace, etc. MindFace has a unified application programming interface and powerful scalability for common application scenarios such as facial recognition and detection.
This is a face detection repository for the MindFace. The deep learning models currently available for users are RetinaFace network models based on different backbone networks (resnet50 and mobiletnet0.25). RetinaFace is a single-stage SOTA face detector which is accepted by CVPR 2020. The ResNet50-based version we implemented provides better performance, while the MobileNet0.25-based version is faster to detect.
backbone | Easy | Medium | Hard |
---|---|---|---|
ResNet50 | 95.81% | 94.89% | 90.10% |
Style | Easy | Medium | Hard |
---|---|---|---|
MindSpore (same parameter with MXNet) | 94.46% | 93.64% | 89.42% |
MindSpore (original image scale) | 95.07% | 93.61% | 84.84% |
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% |
Installation
1.1 Git clone this repo and install RetinaFace_resnet50.
git clone https://openi.pcl.ac.cn/lemon/mindface_retinaface_resnet50.git
cd mindface_retinaface_resnet50
1.2 Install dependencies
cd mindface_retinaface_resnet50/
pip install -r requirements.txt
Prepare Data
2.1. Download WiderFace dataset and annotations that we used from baidu cloud or google drive.
2.2. Organise the dataset directory under mindface_retinaface_resnet50 as follows:
data/WiderFace/
train/
images/
label.txt
val/
images/
label.txt
ground_truth/
wider_easy_val.mat
wider_medium_val.mat
wider_hard_val.mat
wider_face_val.mat
Set Config File
You can Modify the parameters of the config file in ./configs
.
We provide config (RetinaFace_resnet50).
Training
It is easy to train your model using train.py
, where the training strategy (e.g., augmentation, LR scheduling) can be configured with external arguments or a yaml config file.
python mindface_retinaface_resnet50/train.py --config mindface_retinaface_resnet50/configs/RetinaFace_resnet50.yaml
Distributed Training
To run in distributed mode, openmpi is required to install.
export CUDA_VISIBLE_DEVICES=0,1,2,3 # 4 GPUs
mpirun -n 4 python mindface_retinaface_resnet50/train.py --config mindface_retinaface_resnet50/configs/RetinaFace_resnet50.yaml
note: if your device is Ascend, please set the "device_target" in the config file to "Ascend".
Validation
To evalute the model performance, please run eval.py
python eval.py --config mindface_retinaface_resnet50/configs/RetinaFace_resnet50.yaml --checkpoint pretrained/weight.ckpt
Inference
To infer a single image, please run infer.py
python infer.py --config mindface_retinaface_resnet50/configs/RetinaFace_resnet50.yaml --checkpoint pretrained/weight.ckpt --image_path ./imgs/0000.jpg --conf 0.5
The inference results by using our pre-trained weights are shown in the following figure.
You can download our pretrained model of RetinaFace-ResNet50.
You can verify the results in the table with the downloaded pretrained model.
@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}
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》