Home

Awesome

Detection in Crowded Scenes: One Proposal, Multiple Predictions

This is the pytorch implementation of our paper "Detection in Crowded Scenes: One Proposal, Multiple Predictions", https://arxiv.org/abs/2003.09163, published in CVPR 2020.

Our method aiming at detecting highly-overlapped instances in crowded scenes.

The key of our approach is to let each proposal predict a set of instances that might be highly overlapped rather than a single one in previous proposal-based frameworks. With this scheme, the predictions of nearby proposals are expected to infer the same set of instances, rather than distinguishing individuals, which is much easy to be learned. Equipped with new techniques such as EMD Loss and Set NMS, our detector can effectively handle the difficulty of detecting highly overlapped objects.

The network structure and results are shown here:

<img width=60% src="https://github.com/Purkialo/images/blob/master/CrowdDet_arch.jpg"/> <img width=90% src="https://github.com/Purkialo/images/blob/master/CrowdDet_demo.jpg"/>

Citation

If you use the code in your research, please cite:

@InProceedings{Chu_2020_CVPR,
author = {Chu, Xuangeng and Zheng, Anlin and Zhang, Xiangyu and Sun, Jian},
title = {Detection in Crowded Scenes: One Proposal, Multiple Predictions},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2020}
}

Run

  1. Setup environment by docker
    sudo docker build . -t crowddet
    
    • Run docker image:
    sudo docker run --gpus all --shm-size=8g -it --rm crowddet
    
  1. CrowdHuman data:

    • CrowdHuman is a benchmark dataset to better evaluate detectors in crowd scenarios. The dataset can be downloaded from http://www.crowdhuman.org/. The path of the dataset is set in config.py.
  2. Steps to run:

    • Step1: training. More training and testing settings can be set in config.py.
    cd tools
    python3 train.py -md rcnn_fpn_baseline
    
    • Step2: testing. If you have four GPUs, you can use -d 0-3 to use all of your GPUs. The result json file will be evaluated automatically.
    cd tools
    python3 test.py -md rcnn_fpn_baseline -r 40
    
    • Step3: evaluating json, inference one picture and visulization json file. -r means resume epoch, -n means number of visulization pictures.
    cd tools
    python3 eval_json.py -f your_json_path.json
    python3 inference.py -md rcnn_fpn_baseline -r 40 -i your_image_path.png 
    python3 visulize_json.py -f your_json_path.json -n 3
    

Models

We use MegEngine in the research (https://github.com/megvii-model/CrowdDetection), this proiect is a re-implementation based on Pytorch.

<!-- We use pre-trained model from Detectron2 Model Zoo: https://dl.fbaipublicfiles.com/detectron2/ImageNetPretrained/MSRA/R-50.pkl. (or [R-50.pkl](https://drive.google.com/open?id=1qWAwY8QOhYRazxRuIhRA55b8YDxdOR8_)) -->

We use pre-trained model from MegEngine Model Hub and convert this model to pytorch. You can get this model from here. These models can also be downloaded from Baidu Netdisk(code:yx46).

ModelTop1 accTop5 acc
ResNet5076.25493.056

All models are based on ResNet-50 FPN.

APMRJIModel
RCNN FPN Baseline (convert from MegEngine)0.87180.42390.7949rcnn_fpn_baseline_mge.pth
RCNN EMD Simple (convert from MegEngine)0.90520.41960.8209rcnn_emd_simple_mge.pth
RCNN EMD with RM (convert from MegEngine)0.90970.41020.8271rcnn_emd_refine_mge.pth
RCNN FPN Baseline (trained with PyTorch)0.86650.42430.7949rcnn_fpn_baseline.pth
RCNN EMD Simple (trained with PyTorch)0.89970.41670.8225rcnn_emd_simple.pth
RCNN EMD with RM (trained with PyTorch)0.90300.41280.8263rcnn_emd_refine.pth
RetinaNet FPN Baseline0.81880.56440.7316retina_fpn_baseline.pth
RetinaNet EMD Simple0.82920.54810.7393retina_emd_simple.pth
<!-- | RCNN FPN Baseline | --- | --- | --- | --- | | RCNN EMD Simple | --- | --- | --- | --- | | RCNN EMD with RM | --- | --- | --- | --- | -->

Contact

If you have any questions, please do not hesitate to contact Xuangeng Chu (xg_chu@pku.edu.cn).