Skip to content
Code for Counting with Focus for Free, ICCV, 2019
Python MATLAB
Branch: master
Clone or download
Latest commit 50b88df Aug 29, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
code Delete rrr Jul 30, 2019
data Update density.m Aug 29, 2019
image Add files via upload Jul 31, 2019
README.md Update README.md Aug 7, 2019

README.md

Counting-with-Focus-for-Free

Zenglin Shi, Pascal Mettes, and Cees G. M. Snoek. Counting with Focus for Free, ICCV, 2019 image

                  Overview of our approach

Requirements

1. CUDA 8.0 and Cudnn 7.5 or higher
2. GPU memory 10GB or higher
3. Python 2.7
4. Tensorflow 1.04 or or higher

Data preprocessing

Datasets

1. ShanghaiTech partA and partB
2. TRANCOS
3. Dublin Cell Counting
4. WIDER FACE
5. UCF-QNRF

Density map generation

Bsed on equation (1) and (7), for datasets with dense objects, ie, ShanghaiTech Part_A, TRANCOS and UCF-QNRF, we use our proposed non-uniform kernel with beta=0.3 and k=5. For ShanghaiTech Part_B and DCC, we set the Gaussian kernel variance to sigma=5 and sigma=10 respectively. For WIDER FACE, we obtain the Gaussian kernel variance by leveraging the box annotations. You can find the code in folder ¨data/getDmap.m¨.

Segmentation map generation

Bsed on equation(2), we use the same sigma as density map generation. You can find the code in folder ¨data/getPmap.m¨.

Global density generation

Bsed on equation(4) and (5), we use M=8 density levels for ShanghaiTech Part_A and UCF-QNRF, and 4 for the other datasets.

Training

1. Prepare your data following the step of ¨data preprocessing¨.
2. Set the experiment settings in ¨code/tr_param.ini¨ in which phase = train, and set other parameters accordingly (refer to our paper).
3. Run ¨python code/main.py¨

Testing

1. Prepare your data following the step of ¨data preprocessing¨.
2. Set the experiment settings in ¨code/tr_param.ini¨ in which phase = test, and set other parameters accordingly (refer to our paper).
3. Run ¨python code/main.py¨

Tips

1. The dataload function in this code is a little bit slow, you can impove it by using Dataset API in TF.
2. Please generate your groundtruth map following the step of ¨data preprocessing¨ if you want to reproduce our reported numbers in Table 6.
3. You may get different results for each run because some random functions are used even with a fixed random seeds.
4. If you have any questions, feel free to post them in ¨Issues¨.
5. You can find more information at my homepage

Citation

Please cite our paper when you use this code.
 @inproceedings{shi2019counting,
 title={Counting with Focus for Free},
 author={Zenglin Shi, Pascal Mettes, and Cees G. M. Snoek},
 booktitle={ICCV},
 year={2019}
 }
You can’t perform that action at this time.