S³FD: Single Shot Scale-invariant Face Detector, ICCV, 2017
Switch branches/tags
Nothing to show
Clone or download
Latest commit c1abcf0 Oct 17, 2018

README.md

S³FD: Single Shot Scale-invariant Face Detector

By Shifeng Zhang

Introduction

S³FD is a real-time face detector, which performs superiorly on various scales of faces with a single deep neural network, especially for small faces. For more details, please refer to our arXiv paper.

Contents

  1. Preparation
  2. Eval
  3. Train

Preparation

  1. Get the SSD code. We will call the directory that you cloned Caffe into $SFD_ROOT
git clone https://github.com/weiliu89/caffe.git
cd $SFD_ROOT
git checkout ssd
  1. Build the code. Please follow Caffe instruction to install all necessary packages and build it.
# Modify Makefile.config according to your Caffe installation.
cp Makefile.config.example Makefile.config
make -j8
# Make sure to include $CAFFE_ROOT/python to your PYTHONPATH.
make py
make test -j8
# (Optional)
make runtest -j8
  1. Download our trained model from GoogleDrive or BaiduYun, and merge it with the folder $SFD_ROOT/models.

  2. Download our above sfd_test_code folder and put it in the $SFD_ROOT.

  3. Download AFW, PASCAL face, FDDB and WIDER FACE datasets.

  4. Download the EVALUATION TOOLBOX for evaluation.

Eval

  1. Evaluate our model on AFW.
cd $SFD_ROOT/sfd_test_code/AFW
# You must modify the "Path" in the afw_test.py to your AFW path. 
# It will creat sfd_afw_dets.txt and put it in the EVALUATION TOOLBOX to evalute.
python afw_test.py
  1. Evaluate our model on PASCAL face.
cd $SFD_ROOT/sfd_test_code/PASCAL_face
# You must modify the "Path" in the pascal_test.py to your PASCAL_face path. 
# It will creat sfd_pascal_dets.txt and put it in the EVALUATION TOOLBOX to evalute.
python pascal_test.py
  1. Evaluate our model on FDDB.
cd $SFD_ROOT/sfd_test_code/FDDB
# You must modify the "Path" in the fddb_test.py to your FDDB path.
# It will creat sfd_fddb_dets.txt.
python fddb_test.py
# Fitting the dets from rectangle box to ellipse box.
# It will creat sfd_fddb_dets_fit.txt and put it in the FDDB evalution code to evalute.
cd fddb_from_rectangle_to_ellipse
matlab -nodesktop -nosplash -nojvm -r "run fitting.m;quit;"
# If you want to get the results of FDDB in our paper, you should use our 'FDDB_annotation_ellipseList_new.txt'
  1. Evaluate our model on WIDER FACE.
cd $SFD_ROOT/sfd_test_code/WIDER_FACE
# You must modify the path in the wider_test.py to your WIDERFACE path. 
# It will creat detection results in the "eval_tools_old-version" folder.
python wider_test.py
# If you want to get the results of val set in our paper, you should use the provided "eval_tools_old-version". 
# Or you can use latest eval_tools of WIDER FACE.
# There is a slight difference between them, since the annotation used for the evaluation is slightly change around March 2017.

Train

  1. Follow the intruction of SSD to create the lmdb of WIDER FACE.

  2. Modify the data augmentation code of SSD to make sure that it does not change the image ratio.

  3. Modify the anchor match code of SSD to implement the 'scale compensation anchor matching strategy'.

  4. Train the model.