Counting-with-Focus-for-Free
Zenglin Shi, Pascal Mettes, and Cees G. M. Snoek. Counting with Focus for Free, ICCV, 2019
Overview of our approach
1. CUDA 8.0 and Cudnn 7.5 or higher Requirements
2. GPU memory 10GB or higher
3. Python 2.7
4. Tensorflow 1.04 or or higher
Data preprocessing
1. ShanghaiTech partA and partB Datasets
2. TRANCOS
3. Dublin Cell Counting
4. WIDER FACE
5. UCF-QNRF
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¨. Density 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¨. Segmentation map 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. Global density generation
1. Prepare your data following the step of ¨data preprocessing¨. Training
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¨
1. Prepare your data following the step of ¨data preprocessing¨. Testing
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¨
1. The dataload function in this code is a little bit slow, you can impove it by using Dataset API in TF. Tips
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
Please cite our paper when you use this code. Citation
@inproceedings{shi2019counting,
title={Counting with Focus for Free},
author={Zenglin Shi, Pascal Mettes, and Cees G. M. Snoek},
booktitle={ICCV},
year={2019}
}