项目作者: wk910930

项目描述 :
The code for preparing the training data for crowd counting / segmentation algorithm.
高级语言: Matlab
项目地址: git://github.com/wk910930/crowd_density_segmentation.git
创建时间: 2017-06-07T12:13:52Z
项目社区:https://github.com/wk910930/crowd_density_segmentation

开源协议:MIT License

下载


Crowd Density & Segmentation Prediction

This project is the implementation and extension of the previous work, which is based on patches. For more details, please refer to the original paper.

Citation

Please cite the original paper in your publications if it helps your research:

  1. @inproceedings{zhang2015cross,
  2. title={Cross-scene crowd counting via deep convolutional neural networks},
  3. author={Zhang, Cong and Li, Hongsheng and Wang, Xiaogang and Yang, Xiaokang},
  4. booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
  5. pages={833--841},
  6. year={2015}
  7. }

Requirements: software

Caffe and MATLAB 2014a or above are required. Notice: A modified version of Caffe is requried.

Installation

  1. Clone the repository
  1. # Make sure to clone with --recursive
  2. git clone https://github.com/wk910930/crowd_density_segmentation.git
  1. Build Caffe (Code is private for now)
  1. # Currently the code is not allowed to be public.

Prepare training data

We will call the directory that you cloned $CROWD_ROOT. We have prepared a toy dataset called dataset_01, which is used to demonstrate how to generate training data. Place your own dataset(s) under the data for further research.

  1. Generate density map
    • Go to the scripts folder.
      1. cd $CROWD_ROOT/scripts
    • Run the gen_density_map.m. It will generate density map for each frame.
    • Run the gen_patch.m. It will crop the frames and density maps.
  2. Convert to Leveldb

    • Training the model needs three leveldb datasets, i.e. data_db, regression_db and segment_db, which stores the frames, segmentation masks and density maps, respectively.
    • Converting to Leveldb needs the Caffe, which is private for now.

      1. # Notice:
      2. # jpg_id is the file list contains all frame crops, which can be generated by the command `ls sub_frames/*.jpg`. It looks like:
      3. # xxxxxxx01.jpg
      4. # xxxxxxx02.jpg
      5. # xxxxxxx03.jpg
      6. # xxxxxxx04.jpg
      7. # ...
      8. # Similar to png_id and mat id.
      9. # Example:
      10. #
      11. # Convert frame crops to leveldb
      12. ./caffe/build/tools/convert_imageset.bin -backend leveldb /path/to/sub_frames/ jpg_id data_db
      13. # Convert segment crops to leveldb
      14. ./caffe/build/tools/convert_imageset.bin -backend leveldb -gray /path/to/sub_segs/ png_id segment_db
      15. # Convert density crops to leveldb
      16. ./caffe/build/tools/convert_matset.bin -backend leveldb -height 256 -width 256 -varname crop_dens /path/to/sub_density/ mat_id regression_db