Skip to content

The code for preparing the training data for crowd counting / segmentation algorithm.

License

Notifications You must be signed in to change notification settings

wk910930/crowd_density_segmentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

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

Requirements: software

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

Installation

  1. Clone the repository
# Make sure to clone with --recursive
git clone https://github.com/wk910930/crowd_density_segmentation.git
  1. Build Caffe (Code is private for now)
# 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
    cd $CROWD_ROOT/scripts
  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.
    # Notice:
    #   jpg_id is the file list contains all frame crops, which can be generated by the command `ls sub_frames/*.jpg`. It looks like:
    #       xxxxxxx01.jpg
    #       xxxxxxx02.jpg
    #       xxxxxxx03.jpg
    #       xxxxxxx04.jpg
    #       ...
    #   Similar to png_id and mat id.
    
    # Example:
    #
    # Convert frame crops to leveldb
    ./caffe/build/tools/convert_imageset.bin -backend leveldb /path/to/sub_frames/ jpg_id data_db
    # Convert segment crops to leveldb
    ./caffe/build/tools/convert_imageset.bin -backend leveldb -gray /path/to/sub_segs/ png_id segment_db
    # Convert density crops to leveldb
    ./caffe/build/tools/convert_matset.bin -backend leveldb -height 256 -width 256 -varname crop_dens /path/to/sub_density/ mat_id regression_db

About

The code for preparing the training data for crowd counting / segmentation algorithm.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages