This repository is an implementation of crowd counting described in the paper "Image Crowd Counting Using Convolutional Neural Network and Markov Random Field". The fully connected regress network is implemented by Keras (Tensorflow backend). Others are implemented by Matlab.
If you find this code useful in your research, please cite:
@article{han2017image,
title={Image Crowd Counting Using Convolutional Neural Network and Markov Random Field},
author={Han, Kang and Wan, Wanggen and Yao, Haiyan and Hou, Li},
journal={arXiv preprint arXiv:1706.03686},
year={2017}
}
- Downloading data at https://www.dropbox.com/sh/garodovussfijta/AAABTgM_Ut19Be4kGzHqf6MUa?dl=0 or https://pan.baidu.com/s/1gfjcdbX and put it at the root folder of the project.
- Compiling the MRF code by running testMRF.m in MRF folder.
You can direct evalute the model's performance by running EvaluteUCF.m or EvaluateSHT.m using predicted patches' count. This process will apply Markov Random Field and get the global count.
If you want to train a new regress model, follow these steps:
- Installing MatConvNet and then runing ExtractFeatures.m to extract features. This step is not necessary if you use the extracted features in the data folder.
- Installing Keras and runing regress_UCF.py or regress_SHT.py to train a new regress network. Also, you can run patch_predict_SHT.py or patch_predict_UCF.py to predict the patches' count using trained regress network.
- Running EvaluteUCF.m or EvaluateSHT.m to evalute the model's performance.
-
UCF
MAE MSE 254.1 352.5 -
Shanghaitech
Part_A Part_B MAE MSE MAE MSE 79.1 130.1 17.8 26.0