Skip to content

leoniehodel/deepCattleCount

Repository files navigation

deepCattleCount

DOI Paper Open Access

Deep learning–based cattle counts on satellite imagery, offering evidence on land use and policy impact in the Brazilian Amazon.

This repository contains the Python code for the CSRNet implementation of Hodel et al., 2026.

This architecture and this code is adapted from

Create a conda environment

conda env create -f environment.yml

conda activate deepcattlecount

Downloads

Download pre-trained weights for inference on new images.

Estimate cattle distribution on VHR satellite images

This model is designed to perform inference on very high-resolution satellite images with a spatial resolution of 28 cm per pixel. It utilizes both a JPEG file containing RGB data and a KML file that provides the geospatial context for the image.

python inference.py parameters/ pathto/img.jpg pathto/img.kml

The output of the model is an Img.geojson file, which includes geospatial points corresponding to approximately every 400 x 400 pixel segment of the input image. This geospatial point contains the predicted number of cattle and the ensemble-generated standard deviation of the estimates.

Training

the files train.json and test.json contain the paths to the individual train and test images. Trained parameters will be saved in the parameters folder.

python train.py --train_json train.json --test_json test.json 0 parmeters/parameters1

Testing

In the jupyter notebook Ensemble-test-set.ipynb the ensemble of the trained CSRNet set is evaluated and an example image shown.

The test set, as well as the full image dataset are available upon request.

About

No description, website, or topics provided.

Resources

License

Stars

4 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors