SFCN in "Learning from Synthetic Data for Crowd Counting in the Wild"
This is an official implementaion of the paper "SFCN+" in Learning from Synthetic Data for Crowd Counting in the Wild. More detialed information of the paper is shown in the project homepage.
Requirements
- Python 2.7
- Pytorch 0.4.0
- TensorboardX (pip)
- torchvision (pip)
- easydict (pip)
- pandas (pip)
Data preparation
- Download the original UCF-QNRF Dataset [Link: Dropbox ]
- Resize the images and the locations of key points.
- Generate the density maps by using the code.
- Generate the segmentation maps.
The pre-trained resSFCN on GCC and the processed QNRF dataset: [Link]
Training model
- Run the train.py:
python train.py
. - See the training outputs:
Tensorboard --logdir=exp --port=6006
.
Testing pretrained model
- Download pretrained resSFCN on QNRF in this link (two versions: the results of CVPR and the screenshot in this repo).
- Run
python test.py
.
Expermental results
Quantitative results
Errors on test set:
Note: the blue line is the result of using pre-trained GCC Dataset, and the red is the result of using pre-trained ImageNet.
Visualization results
Pre-trained ImageNet | Pre-trained GCC | |
---|---|---|
epoch 1,6 | ||
epoch 11,16 | ||
epoch 379,380 |
Column 1: input image; Column 2: density map GT; Column 3: density map prediction.
Tips
In this code, the validation is directly on the test set. Strictly speaking, it should be evaluated on the val set (randomly selected from the training set, which is adopted in the paper). Here, for a comparable reproduction (namely fixed splitting sets), this code directly adopts the test set for validation, which causes that the results of this code are better than that of our paper (mae: 99 v.s. 102).
One More Thing
We reproduce some classic networks (MCNN, CSRNet, SANet, etc.) and some solid baseline networks (AlexNet, VGG, ResNet, etc.) on GCC dataset. Welcome to visit this link. It is under development, we will release it as soon as possible.
Citation
If you find this project useful for your research, please cite:
@inproceedings{wang2019learning,
title={Learning from Synthetic Data for Crowd Counting in the Wild},
author={Wang, Qi and Gao, Junyu and Lin, Wei and Yuan, Yuan},
booktitle={Proceedings of IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
pages={8198--8207},
year={2019}
}