/crowd-counting

Image Crowd Counting Using Convolutional Neural Network and Markov Random Field

Primary LanguageC++

Crowd Counting

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.

Citation

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

Prepare

  1. 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.
  2. Compiling the MRF code by running testMRF.m in MRF folder.

Evalute

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.

Training a new model

If you want to train a new regress model, follow these steps:

  1. 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.
  2. 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.
  3. Running EvaluteUCF.m or EvaluateSHT.m to evalute the model's performance.

Results

  1. UCF

    MAE MSE
    254.1 352.5
  2. Shanghaitech

    Part_A Part_B
    MAE MSE MAE MSE
    79.1 130.1 17.8 26.0