This is an simple and clean implemention of CVPR 2016 paper "Single-Image Crowd Counting via Multi-Column Convolutional Neural Network."
1. Install pytorch 1.0.0 later and python 3.6 later
2. Install visdom
pip install visdom
3. Clone this repository
git clone https://github.com/CommissarMa/MCNN-pytorch.git
We'll call the directory that you cloned MCNN-pytorch as ROOT.
1. Download ShanghaiTech Dataset from
Dropbox: link or Baidu Disk: link
2. Put ShanghaiTech Dataset in ROOT and use "data_preparation/k_nearest_gaussian_kernel.py" to generate ground truth density-map. (Mind that you need modify the root_path in the main function of "data_preparation/k_nearest_gaussian_kernel.py")
1. Modify the root path in "train.py" according to your dataset position.
2. In command line:
python -m visdom.server
3. Run train.py
1. Modify the root path in "test.py" according to your dataset position.
2. Run test.py for calculate MAE of test images or just show an estimated density-map.
1. Unlike original paper, this implemention doesn't crop patches for training. We directly use original images to train mcnn model and also achieve the result as authors showed in the paper.
2. If you are new to crowd counting, we recommand you to know Crowd_counting_from_scratch first. It is an overview and tutorial of crowd counting.