- Python 3.8
- pytorch 1.10.2
Please run the follow line to install enviroment
pip install -r requirements.txt
ShanghaiTech (no official)
Run generate_density.py in data_preprocess to generate ground-truth density map and data_list
python generate_density.py --data_root 'data_root' --target_root 'target_root' --cls 'cls' # cls=SHH, NWPU, UCF_QNRF, UCF_CC_50, jhu++
Please put the image and ground-truth in the same folder
Data_root/
-train/
-IMG_1.h5
-IMG_1.jpg
-IMG_1.txt
⋮
-test/
-IMG_1.h5
-IMG_1.jpg
-IMG_1.txt
⋮
⋮
The backbone pretrained model please put in the backbone_pretrained folder
python train.py --data_root 'data_root' --epochs 4000
python test.py --data_root 'data_root' --weight_path 'checkpoint_path'
Quantitative evaluation on four dataset. We report Mean Abosolute Error (MAE), Root Mean Square Error (RMSE). (Bold means the 1st best; Underline means the 2nd best).
- Visualize
The generated density map comparison of our method and some other methods on ShanghaiTech PartA dataset. From left to right are input image, ground truth, MCNN, CSRnet, CAN, BL, DM-count, and Ours.
- Ablation study
Ablation study of all modual we used with size 128x128 images on ShanghaiTech PartA dataset. We report Mean Abosolute Error (MAE), Root Mean Square Error (RMSE). (Bold means the 1st best; Underline means the 2nd best)