Sparse R-CNN: End-to-End Object Detection with Learnable Proposals

Paper (CVPR 2021)

Sparse R-CNN: End-to-End Object Detection with Learnable Proposals

Updates

  • (02/03/2021) Higher performance is reported by using stronger backbone model PVT.
  • (23/02/2021) Higher performance is reported by using stronger pretrain model DetCo.
  • (02/12/2020) Models and logs(R101_100pro_3x and R101_300pro_3x) are available.
  • (26/11/2020) Models and logs(R50_100pro_3x and R50_300pro_3x) are available.
  • (26/11/2020) Higher performance for Sparse R-CNN is reported by setting the dropout rate as 0.0.

Models

Methodinf_timetrain_timebox APdownload
R50_100pro_3x23 FPS19h42.8model | log
R50_300pro_3x22 FPS24h45.0model | log
R101_100pro_3x19 FPS25h44.1model | log
R101_300pro_3x18 FPS29h46.4model | log

Models and logs are available in Baidu Drive by code wt9n.

Notes

  • We observe about 0.3 AP noise.
  • The training time is on 8 GPUs with batchsize 16. The inference time is on single GPU. All GPUs are NVIDIA V100.
  • We use the models pre-trained on imagenet using torchvision. And we provide torchvision's ResNet-101.pkl model. More details can be found in the conversion script.
Methodinf_timetrain_timebox APcodebase
R50_300pro_3x22 FPS24h45.0detectron2
R50_300pro_3x.detco22 FPS28h46.5detectron2
PVTSmall_300pro_3x13 FPS50h45.7mmdetection
PVTv2-b2_300pro_3x11 FPS76h50.1mmdetection

Installation

The codebases are built on top of Detectron2 and DETR.

Requirements

  • Linux or macOS with Python ≥ 3.6
  • PyTorch ≥ 1.5 and torchvision that matches the PyTorch installation. You can install them together at pytorch.org to make sure of this
  • OpenCV is optional and needed by demo and visualization

Steps

  1. Install and build libs
git clone https://github.com/PeizeSun/SparseR-CNN.git
cd SparseR-CNN
python setup.py build develop
  1. Link coco dataset path to SparseR-CNN/datasets/coco
mkdir -p datasets/coco
ln -s /path_to_coco_dataset/annotations datasets/coco/annotations
ln -s /path_to_coco_dataset/train2017 datasets/coco/train2017
ln -s /path_to_coco_dataset/val2017 datasets/coco/val2017
  1. Train SparseR-CNN
python projects/SparseRCNN/train_net.py --num-gpus 8 \
    --config-file projects/SparseRCNN/configs/sparsercnn.res50.100pro.3x.yaml
  1. Evaluate SparseR-CNN
python projects/SparseRCNN/train_net.py --num-gpus 8 \
    --config-file projects/SparseRCNN/configs/sparsercnn.res50.100pro.3x.yaml \
    --eval-only MODEL.WEIGHTS path/to/model.pth
  1. Visualize SparseR-CNN
python demo/demo.py\
    --config-file projects/SparseRCNN/configs/sparsercnn.res50.100pro.3x.yaml \
    --input path/to/images --output path/to/save_images --confidence-threshold 0.4 \
    --opts MODEL.WEIGHTS path/to/model.pth

Third-party resources

License

SparseR-CNN is released under MIT License.

GitHub

GitHub - PeizeSun/SparseR-CNN: End-to-End Object Detection with Learnable Proposal, CVPR2021
End-to-End Object Detection with Learnable Proposal, CVPR2021 - GitHub - PeizeSun/SparseR-CNN: End-to-End Object Detection with Learnable Proposal, CVPR2021