Skip to content

HiKapok/DAN

Repository files navigation

Single Shot Faces Detectors in TensorFlow

This repository contains the un-official reimplementation of several single shot faces detectors in TensorFlow.

Usage

  • Download WIDER Face Dataset and reorganize the directory as follows:

     WIDER Face Dataset/
        |->WIDER_train/
        |    |->images/
        |    |->...
        |->WIDER_val/
        |    |->images/
        |    |->...
        |->WIDER_test/
        |    |->images/
        |    |->...
        |->wider_face_split/
        |    |->wider_face_train.mat
        |    |->...
     '''
     WIDER_ROOT is your path of the WIDER Face Dataset.
    
  • Run the following script to generate TFRecords.

     python dataset/convert_tfrecords.py --dataset_directory=WIDER_ROOT --output_directory=./dataset/tfrecords
  • Download the pre-trained VGG-16 model (reduced-fc) from here and put them into one sub-directory named 'model' (we support SaverDef.V2 by default, the V1 version is also available for sake of compatibility).

  • Compile custom operations, run following command in directory 'cpp/Deform' and 'cpp/ExtraLib':

     mkdir build
     cd build && cmake ..
     make
  • Run the following script to start training:

     python train_dan.py (or python train_pb.py for PyramidBox, or python train_sfd.py for S³FD)
  • Run the following script to get detection results in *.txt (modify the WIDER_ROOT in 'data_dir' firstly):

     python eval_dan.py (or python eval_pb.py for PyramidBox, or python eval_sfd.py for S³FD)
  • Run the official MATLAB script for evaluation

All the codes was tested under TensorFlow 1.8, Python 3.5, Ubuntu 16.04 with CUDA 8.0. You need at least two decent GPUs for training by yourself.

Framework

The whole framework:

Low-level FPN:

Context module V2:

Context module V1:

Results

Reproduced results are list as follows:

Algorithm Easy Medium Hard
S³FD 0.933 0.923 0.848
PyramidBox 0.955 0.946 0.888
DAN 0.958 0.946 0.895
DAN-Deform 0.957 0.947 0.897

The performance of PyramidBox could be further improved by using transposed convolution in LFPN and tuning the weight of losses. While the training peroid is too long to perform more experiments.

Easy:

Medium:

Hard:

You can download the trained model of DAN from GoogleDrive.

Discussion

Welcome to join in QQ Group(758790869) for more discussion

Apache License, Version 2.0

Releases

No releases published

Packages

No packages published