Skip to content
Hierarchical Shot Detector (ICCV2019)
Python Cuda C Other
Branch: master
Clone or download
Latest commit b7f52f2 Sep 27, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
configs hsd Sep 27, 2019
data hsd Sep 27, 2019
layers hsd Sep 27, 2019
models Delete Sep 27, 2019
utils hsd Sep 27, 2019
LICENSE Initial commit Sep 26, 2019 hsd Sep 27, 2019 hsd Sep 27, 2019
hsd.jpg hsd Sep 27, 2019 hsd Sep 27, 2019


This code is a official implementation of "Hierarchical Shot Detector (ICCV2019)" on COCO object detection with Pytorch.


We propose a novel pipeline for accurate object detection (called ROC). Instead of simultaneous classification and regression, ROC firstly conducts box regression, secondly predicts the feature sampling locations for box classification, and finally classifies regressed boxes with the features of offset locations. To achieve the better detection accuracy, a hierarchical shot detector is proposed by stacking two ROC modules. Meanwhile, the contextual information is also incorporated to enrich the features of the second ROC module.

HSD detection pipeline.


name backbone input size minival download
HSD320 VGG16 320x320 33.9 model
HSD512 VGG16 512x512 38.6 model
HSD512 ResNet101 512x512 39.7 model
HSD512 ResNext101 512x512 41.4 model


  • Install PyTorch-0.4.0 and Python 3+.
  • Clone this repository.
  • Compile the nms and install coco tools:
cd HSD
pip install Cython, pycocotools, opencv-python, matplotlib, PyYaml
  • Compile the deformable convolution:
cd HSD/models/deform
CC=g++ python
  • Then download the COCO dataset and put the MS COCO dataset at $path/data/coco
|_ images
|  |_ train2014
|     |_ <imgname>.jpg
|     |_ ...
|  |_ val2014
|     |_ ...
|  |_ test2015
|     |_ ...
|_ annotations
|  |_ instances_train2014.json
|  |_ ...
|_ cache

Train and Inference

  • Download the pre-trained models (e.g., VGG16, Resnet, and ResNext) and put these models in the HSD/weights/pretrained_models/ dir:
VGG16:      wget
ResNet101:  wget
Resnext101: wget
  • Use to train the detector:
e.g., python --cfg ./configs/hsd_vgg_coco_320.yaml
  • To evaluate a trained network:
e.g., python --cfg ./configs/hsd_vgg_coco_320.yaml --weights ./weights/hsd-vgg320-coco/hsd_vgg_epoch_160_300.pth


If the project helps your research, please cite this paper.

  author =       {Jiale Cao and Yanwei Pang and Jungong Han and Xuelong Li},
  title =        {Hierarchical Shot Detector},
  journal =      {Proc. International Conference on Computer Vision},
  year =         {2019}


Many thanks to the open source codes, i.e., SSD_Pytorch, deformable-convolution-pytorch, mmdetection, and DANet.

You can’t perform that action at this time.