[Paper | Website | Colab (coming soon)]
Chenlin Meng, Enci Liu, Willie Neiswanger, Jiaming Song, Marshall Burke, David B. Lobell, Stefano Ermon
Stanford University
IS-Count is a sampling-based and learnable method for estimating the total object count in a region. It largely reduces the number of satellite images as well as human annotations compared to an exhaustive approach used by object detectors in many real-world counting tasks, while achieving a high accuracy.
- Overview
- Requirements
- Tutorials
- Data Preparation
- Running Identity Models
- Running Isotonic Models
- Citation
We consider the following four tasks across 45 countries:
- Counting buildings in the US and 43 African countries
- Counting cars in Kenya
- Counting brick kilns in Bangladesh
- Counting swimming pools in the US
The code has been tested on PyTorch 1.7.1 (CUDA 11.2).
To install necessary packages and dependencies, run
pip install -r requirements.txt
conda install gdal
The IS-Count pipeline could be divided into two steps: 1) data preparation and 2) object count estimation. We provide the code for the two steps with the example of estimating building count in New York State in the tutorials/
folder.
We provide code for preparing the necessary data for IS-Count in create_mask.py
and create_data.py
. Before running these scripts, you need to make sure you have the prerequisite data downloaded and organized as described in the file data/README.md
. For more details on preparing the necessary data for running IS-Count, check out the data_prep_tutorial.ipynb
notebook under data/
.
To create the binary mask for the region of interest, run create_mask.py
with the following command
python create_mask.py --sampling_method "$sampling_method" --district "$district" --overwrite
To create the all-pixel file for the region of interest, run create_data.py
with the following command
python create_data.py --sampling_method "$sampling_method" --district "$district" --overwrite
We provide code to reproduce our results on counting buildings and brick kilns using uniform, NL-based, and Population-based identity models in baselines.py
. To reproduce the results for all the three identity methods, run the following command:
for sampling_method in "uniform" "NL" "population"
do
echo "$sampling_method"
python baselines.py --sampling_method "$sampling_method" --percentage 0.02 --plot
done
We provide code to reproduce our results on counting buildings and brick kilns using uniform, NL-based, and Population-based isotonic models in isotonic_regression.py
.
for sampling_method in "NL" "population"
do
echo "$sampling_method"
python isotonic_regression.py --sampling_method "$sampling_method" --percentage 0.0001 --plot
done
To get results for the Isotonic method in the paper, run with the --extra_train
flag.
Please cite this article as follows, or use the BibTeX entry below.
@inproceedings{meng2022count,
title={Is-count: Large-scale object counting from satellite images with covariate-based importance sampling},
author={Meng, Chenlin and Liu, Enci and Neiswanger, Willie and Song, Jiaming and Burke, Marshall and Lobell, David and Ermon, Stefano},
booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
volume={36},
number={11},
pages={12034--12042},
year={2022}
}