lipw b0a38d6b2e | 1 year ago | |
---|---|---|
__pycache__ | 1 year ago | |
checkpoint/mobile | 1 year ago | |
configs | 1 year ago | |
datasets | 1 year ago | |
imgs | 1 year ago | |
loss | 1 year ago | |
models | 1 year ago | |
pretrained | 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 | |
requirements.txt | 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 |
---|---|---|---|
mobileNet0.25 | 91.60% | 89.50% | 82.39% |
Style | Easy | Medium | Hard |
---|---|---|---|
MindSpore (same parameter with MXNet) | 88.51% | 86.86% | 80.88% |
MindSpore (original image scale) | 90.77% | 88.20% | 74.76% |
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% |
Installation
1.1 Git clone this repo and install mindface.
git clone https://github.com/mindspore-lab/mindface.git
cd mindface
python setup.py install
1.2 Install dependencies
cd mindface/detection/
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/detection/ 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 file (RetinaFace_mobilenet025.
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/detection/train.py --config mindface/detection/configs/RetinaFace_mobilenet025.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/detection/train.py --config mindface/detection/configs/RetinaFace_mobilenet025.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/detection/configs/RetinaFace_mobilenet025.yaml --checkpoint pretrained/weight.ckpt
Inference
To infer a single image, please run infer.py
python infer.py --config mindface/detection/configs/RetinaFace_mobilenet025.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
RetinaFace-MobileNet025.
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》