- This repository is the official implementation of our method DSFormer(Dual Supervision Transformer) in ICASSP 2023. In this work, we propose a transformer-based weakly-supervised crowd counting framework with density tokens to perform density classification.
python >=3.6
torch >=1.8.0
opencv-python >=4.4.0
scipy >=1.4.0
h5py >=2.10
pillow >=7.0.0
imageio >=1.18
timm==0.1.30
tqdm==4.64.0
grad-cam==1.4.6
- Some crucial packages are listed above. Please make sure to install them before running.
Three datasets are utilized in our proposed method, where links are shown below:
- Download ShanghaiTech dataset from Baidu-Disk, passward:cjnx; or Google-Drive
- Download UCF-QNRF dataset from here
- Download NWPU-CROWD dataset from Baidu-Disk, passward:3awa; or Google-Drive
python train.py --dataset ShanghaiA
You can download the pretrained model from Baidu-Disk, passward:DSFO
python test.py --dataset ShanghaiA --pre model_best.pth
You may consider kindly citing our work if you find this useful. Great thanks!
@inproceedings{hu2023densitytoken,
title={Densitytoken: Weakly-Supervised Crowd Counting with Density Classification},
author={Hu, Zaiyi and Wang, Binglu and Li, Xuelong},
booktitle={ICASSP 2023-2023 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)},
pages={1--5},
year={2023},
organization={IEEE}
}
This code is heavily built on TransCrowd. We sincerely thank the authors for sharing the codes.