Awesome
S³FD: Single Shot Scale-invariant Face Detector
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
Preparation
- 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
- 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
-
Download our trained model from GoogleDrive or BaiduYun, and merge it with the folder
$SFD_ROOT/models
. -
Download our above sfd_test_code folder and put it in the
$SFD_ROOT
. -
Download AFW, PASCAL face, FDDB and WIDER FACE datasets.
-
Download the EVALUATION TOOLBOX for evaluation.
Eval
- 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
- 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
- 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'
- 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
-
Follow the intruction of SSD to create the lmdb of WIDER FACE.
-
Modify the data augmentation code of SSD to make sure that it does not change the image ratio.
-
Modify the anchor match code of SSD to implement the 'scale compensation anchor matching strategy'.
-
Train the model.