PyramidBox: A Context-assisted Single Shot Face Detector
Branch: master
Clone or download
Latest commit 8b0eb04 Jan 29, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
datasets pyramidbox Jan 5, 2019
demo pyramidbox Jan 5, 2019
eval/eval_tools pyramidbox Jan 5, 2019
nets pyramidbox Jan 5, 2019
preprocessing pyramidbox Jan 5, 2019
tf_extended pyramidbox Jan 5, 2019
utility pyramidbox Jan 5, 2019
.gitignore pyramidbox Jan 5, 2019 pyramidbox Jan 5, 2019 Update Jan 29, 2019 pyramidbox Jan 5, 2019 pyramidbox Jan 5, 2019 pyramidbox Jan 5, 2019 pyramidbox Jan 5, 2019 pyramidbox Jan 5, 2019 pyramidbox Jan 5, 2019 pyramidbox Jan 5, 2019


This is an unofficial Tensorflow re-implementation of PyramidBox: A Context-assisted Single Shot Face Detector, which achieves superior performance among the state-of-the-art on the two common face detection benchmarks, FDDB and WIDER FACE.


There is still a gap in performance from the paper. May be caused by several reasons:

  • Without implementing data-anchor-sampling.
  • Differences of data augmentation from original.
  • The batch size in the paper is 16, but I used 1 because of the limitation of memory.
  • Hyperparameters not mentioned in the paper.
  • Differences of deep learning framework.


Face Detection

Results on WIDER FACE validation set:

This is just a very casual training result. I believe you can achieve better results after trying some other hyperparameters. For example: batch size, learning rate and some parameters related to the loss function,etc.

Method AP Easy AP Medium AP Hard
original 96.1 95.0 88.9
this repo 90.6 88.8 73.4



(Only tested on) Ubuntu 16.04 with:

  • Python3
  • Tensorflow-gpu 1.4
  • OpenCV3

Clone the repo

git clone

Download PyramidBox models form BaiduYun or GoogleDrive .


Run the following script for visualization:


Train on WIDER FACE Datasets

  1. Download pre-trained VGG16 models from here and put it to /checkpoints.
  2. Download WIDER FACE Datasets and convert to VOC format. Path looks like below:
       |    |->WIDER_train/
       |    |->WIDER_val/
       |    |->WIDER_test/
       |    |->Annotations/
       |    |->JPEGImages/
       |    |...
  1. Run the following script to generate TFRecords:
python datasets/
You can run `` to check data. This step is not necessary.
  1. The training strategy is two-stages: First run with below setting to train additional PyramidBox layers:
self.fine_tune_vgg16 = False
  1. Then set self.fine_tune_vgg16 =Ture to run to train total network.


Run the following script for evaluation and get mAP:

cd eval/eval_tools
octave wider_eval.m


  • Add data-anchor-sampling
  • Try more logical and rigorous data augmentation
  • Transfer to other backbone networks




If you find any problems, welcome to open a new issue or contact .