This repository is for DIP curriculum final project. The baseline model CSRNet is provided.
- python 3.7.4
- pytorch 1.4.0
- torchvision 0.5.0
- numpy 1.18.5
- tensorboard 2.2.1
This pipeline is a simple framework for crowd counting task including four folders(datasets, losses, models, optimizers, Make_Datasets) and three files(main.py, test.py, train.sh).
- main.py: The entrance of the main program.
- test.py: Compute the MAE and RMSE metrics among testset images based on your checkpoints.
- train.sh: You can run
sh ./train.sh
to launch training. - datasets: This folder contains dataloaders from different datasets.
- losses: This folder contains different customized loss functions if needed.
- models: This folder contains different models. CSRNet is provided here.
- optimizers: This folder contains different optimzers.
- Make_Datasets: This folder contains density map generation codes.
- ShanghaiTech PartA and PartB: download_link
- UCF-QNRF: download_link
- NWPU: download_link
- GCC: download link
The density map generation codes are in Make_Datasets folders.
After all density maps are generated, run ls -R /xx/xxx/xxx/*.jpg > train.txt
, ls -R /xx/xxx/xxx/*.jpg > val.txt
, ls -R /xx/xxx/xxx/*.jpg > test.txt
to generate txt files for training, validating and testing.
- Training
run sh ./train.sh
or run the following command.
python main.py --dataset shanghaitechpa \
--model CSRNet \
--train-files /home/jqgao/workspace/CrowdCounting/TrainingTestingFileLists/ShanghaiTechPartA_full_origin_train.txt \
--val-files /home/jqgao/workspace/CrowdCounting/TrainingTestingFileLists/ShanghaiTechPartA_full_origin_val.txt \
--gpu-devices 4 \
--lr 1e-5 \
--optim adam \
--loss mseloss \
--checkpoints ./checkpoints/demo \
--summary-writer ./runs/demo
- Testing
run the following command.
python test.py --test-files /home/jqgao/workspace/CrowdCounting/TrainingTestingFileLists/ShanghaiTechPartA_full_origin_test.txt --best-model /home/jqgao/workspace/DIP2021/checkpoints/demo/bestvalmodel.pth
https://www.crowdbenchmark.com/nwpucrowd.html
- [CVPR 2015] Cross-scene Crowd Counting via Deep Convolutional Neural Networks
- [CVPR 2016] Single-Image Crowd Counting via Multi-Column Convolutional Neural Network (MCNN, ShanghaiTech Dataset)
- [CVPR 2018] CSRNet: Dilated Convolutional Neural Networks for Understanding the Highly Congested Scenes
- [ECCV 2018] Composition Loss for Counting, Density Map Estimation and Localization in Dense Crowds (UCF-QNRF Dataset)
- [CVPR 2019] Learning from Synthetic Data for Crowd Counting in the Wild (GCC Dataset)
- [TIP 2019] PaDNet: Pan-Density Crowd Counting
- [PAMI 2020] NWPU-Crowd: A Large-Scale Benchmark for Crowd Counting and Localization (NWPU-Crowd Dataset)
- [Survey] CNN-based Single Image Crowd Counting: Network Design, Loss Function and Supervisory Signal
- [Survey] CNN-based Density Estimation and Crowd Counting: A Survey
- [Survey] A Survey of Recent Advances in CNN-based Single Image Crowd Counting and Density Estimation