This is the official PyTorch implementation of paper: STEERER: Resolving Scale Variations for Counting and Localization via Selective Inheritance Learning, which effectively addressed the issue of scale variations for object counting and localizaioion, demonstrating the state-of-arts counting and localizaiton performance for different catagories, such as crowd,vehicle, crops and trees .
- Training and Testing Code (18/08/2023)
- Pretrained models for SHHB, JHU, TRANSCOS, MTC, TREE (30/10/2023)
- Pretrained models for NWPU, QNRF (coming soon)
- Clone this repo in the directory (
root/
):
cd $root
git clone https://github.com/taohan10200/STEERER.git
- Install dependencies. We use python 3.9 and pytorch >= 1.12.0 : http://pytorch.org.
conda create -n STEERER python=3.9 -y
conda activate STEERER
conda install pytorch==1.12.0 torchvision==0.13.0 cudatoolkit=11.3 -c pytorch
cd ${STEERER}
pip install -r requirements.txt
- !!! Processed datasets and Pretrained-weights are available at the OneDrive net disk, and you can selectively dolownd the dataset that you want to train or inference. Before starting your training and testing, you should organiza your project as the following directory tree.
$root/
├── ProcessedData
│ ├── SHHB
│ │ ├── images # the input images
│ │ ├── jsons # the annotated labels
│ │ ├── train.txt # the image name of train set
│ │ ├── test.txt # the image name of test set
│ │ ├── test_gt_loc.txt # the localization labels for evaluation
│ │ └──train_gt_loc.txt # the localization labels for train set (not used)
│ ├── SHHA
│ ├── NWPU
│ ├── QNRF
│ ├── JHU
│ ├── MTC
│ ├── JHU
│ ├── JHUTRANCOS_v3
│ └── TREE
├── PretrainedModels
└── STEERER
we provide simplify script to run distributed or cluster training,
# $1 is the configuration file, $2 is the GPU_ID
sh train.sh configs/SHHB_final.py 1
# mltiple GPUs
sh train.sh configs/SHHB_final.py 0,1,2,3
or if you are trainging on the computer cluster, you could be run
# $3 the configuration file, $4 is the number of GPUs
sh slurm_train.sh partition_name job_name configs/SHHB_final.py 1
To reproduce the performance, run the similry command like training,
# $1 is the configuration file, $2 is the checkpoint path, $3 is the GPU_ID, only support single GPU.
sh test.sh configs/SHHB_final.py ../PretrainedModels/SHHB.pth 1
or if you are trainging on the computer cluster, you could be run
# $3 the configuration file, $4 is the checkpoint path, $5 is the number of GPUs
sh slurm_test.sh partition_name job_name configs/SHHB_final.py ../PretrainedModels/SHHB.pth 1
Dataset | MAE/MSE | F1-m./Pre./Rec. (%) | Pretraied Model | Dataset | |
---|---|---|---|---|---|
This Repo | SHHB | 5.8/8.5 | 87.0/89.4/84.82.01 | weights | Dataset |
This Repo | TRANSCOS | 1.8/3.1 | 95.1/91.7/93.4/ | weights | Dataset |
This Repo | MTC | 2.74/3.72 | - | weights | Dataset |
This Repo | JHU | 54.5/240.6 | 65.6/66.7/64.6 | weights | Dataset |
This Repo | TREE | 8.2/11.3 | 72.9/70.4/75.7 | weights | Dataset |
This Repo | FDST | 0.93/1.29 | 97.4/98.0/96.7 | weights | Dataset |
This Repo | UCF-QNRF | 77.8/138.0 | 75.6/79.7/72.0 | weights | Dataset |
This Repo | NWPU | 32.5/80.4 (Val. set) | - | weights | - |
If you find this project is useful for your research, please cite:
@article{haniccvsteerer,
title={STEERER: Resolving Scale Variations for Counting and Localization via Selective Inheritance Learning},
author={Han, Tao, Bai Lei, Liu Lingbo, and Ouyang Wanli},
booktitle={ICCV},
year={2023}
}
The released PyTorch training script borrows some codes from the HRNet and MMCV repositories. If you think this repo is helpful for your research, please consider cite them.