/ Machine Learning

RetinaFace: Single-stage Dense Face Localisation in the Wild

RetinaFace: Single-stage Dense Face Localisation in the Wild

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.

WiderFace Val Performance in single scale When using Mobilenet0.25 as backbone net.

Style easy medium hard
Pytorch (same parameter with Mxnet) 86.85 % 85.84% 79.69%
Pytorch (original image scale) 90.58 % 87.94% 73.96%
Original Mxnet - - 79.1%

r_3

FDDB Performance When using Mobilenet0.25 as backbone net.

Dataset performace
FDDB(pytorch) 97.93%

FDDB_DiscROC

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 dataset.

  2. Download annotations (face bounding boxes & five facial landmarks) from baidu cloud or dropbox

  3. 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 baidu cloud Password: ruck

Training

We trained Mobilenet0.25 on imagenet dataset and get 46.75% in top 1. We use it as pretrain model which has been put in repository named model_best.pth.tar.

  1. Before training, you can check the mobilenet*0.25 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:

python train.py

If you do not wish to train the model, we also provide trained model in ./weights/Final_Retinaface.pth.

Evaluation

Evaluation widerface val

  1. Generate txt file
python test_widerface.py --trained_model weight_file
  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.py --dataset FDDB
  1. Download eval_tool to evaluate the performance.

RetinaFace-MobileNet0.25

Pytorch_Retinaface

2--1-

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}

GitHub