Need help with GCC-SFCN?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

147 Stars 37 Forks MIT License 18 Commits 22 Opened issues


This is the official code of spatial FCN in the paper Learning from Synthetic Data for Crowd Counting in the Wild [CVPR2019].

Services available


Need anything else?

Contributors list

# 60,259
18 commits

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.


  • Python 2.7
  • Pytorch 0.4.0
  • TensorboardX (pip)
  • torchvision (pip)
  • easydict (pip)
  • pandas (pip)

Data preparation

  1. Download the original UCF-QNRF Dataset [Link: Dropbox ]
  2. Resize the images and the locations of key points.
  3. Generate the density maps by using the code.
  4. Generate the segmentation maps.

The pre-trained resSFCN on GCC and the processed QNRF dataset: [Link]

Training model

  1. Run the
  2. See the training outputs:
    Tensorboard --logdir=exp --port=6006

Testing pretrained model

  1. Download pretrained resSFCN on QNRF in this link (two versions: the results of CVPR and the screenshot in this repo).
  2. Run

Expermental results

Quantitative results

Errors on test set:

Detialed infomation during the traning phase.

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|f1. | t1. | | epoch 11,16 |f2. | t2. | | epoch 379,380 |f3. | t2. |

Column 1: input image; Column 2: density map GT; Column 3: density map prediction.


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.


If you find this project useful for your research, please cite:

  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)},

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.