Skip to content

licksylick/retinaface_with_face_alignment

Repository files navigation

RetinaFace in PyTorch

A PyTorch implementation of RetinaFace: Single-stage Dense Face Localisation in the Wild.

Additional features

python train.py --network resnet50 --num_workers 1 --cpu_usage True

Installation

Clone and install
  1. git clone https://github.com/licksylick/retinaface_with_face_alignment.git
  2. Pytorch version 1.1.0+ and torchvision 0.3.0+ are needed
  3. Codes are based on Python 3
Data

Link: from google cloud
Paste it to widerface dir

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
  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:

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
python test_widerface.py --trained_model weight_file --network mobile0.25 or resnet50
  1. Evaluate txt results. Demo come from Here
cd ./widerface_evaluate
python setup.py build_ext --inplace
python evaluation.py
  1. You can also use widerface official Matlab evaluate demo in Here

Evaluation FDDB

  1. Download the images FDDB to:
./data/FDDB/images/
  1. Evaluate the trained model using:
python test_fddb.py --trained_model weight_file --network mobile0.25 or resnet50
  1. Download eval_tool to evaluate the performance.

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}

Releases

No releases published

Packages

No packages published