Skip to main content

Lightweight benchmarking framework for geospatial models

Project description

torchgeo-bench

CI PyPI version Python 3.12+ License: MIT

A lightweight benchmarking framework for evaluating frozen geospatial foundation models on the GeoBench V1 and V2 suites. Plug in any backbone, get KNN-5 / linear-probe accuracy on classification datasets and mIoU on segmentation datasets, with bootstrapped 95% confidence intervals — all configured through Hydra.

  • Frozen-backbone evaluation — KNN-5, L-BFGS logistic regression, and linear / conv / FPN / DPT segmentation probes.
  • GeoBench V1 + V2 built in — classification and segmentation, RGB or full multispectral / multi-modal stacks.
  • Hydra-driven — sweep models, datasets, partitions, image sizes, and bands without code changes.
  • Resumableresume=true skips already-computed (dataset, method, model, …) rows. Atomic CSV appends are safe across parallel jobs.
  • Bring your own model — copy contrib_template.py, implement _forward_patch_features, and add a one-file Hydra config. See the Stage 1 guide for a full walkthrough, or the Stage 2 guide to contribute the model back upstream.

Installation

pip install torchgeo-bench

For development:

git clone https://github.com/torchgeo/torchgeo-bench
cd torchgeo-bench
uv sync --extra dev

For GPU-accelerated KNN (Linux + CUDA 12 + glibc ≥ 2.28):

pip install 'torchgeo-bench[cuda]'

Requires Python 3.12+. The default (CPU) install runs on Linux, macOS, and Windows; GPU-accelerated KNN (the [cuda] extra) is Linux-only.

Download a dataset

The runner expects datasets under ./data/. To grab GeoBench V1:

torchgeo-bench download geobench_v1

V2 (classification + segmentation) and torchgeo's EuroSAT downloader work the same way (torchgeo-bench download geobench_v2, torchgeo-bench download eurosat). See the documentation for all options.

Run a basic experiment

# Default: random convolutional features (RCF) on every available dataset
torchgeo-bench run

# A single dataset with a pretrained ImageNet ResNet-50
torchgeo-bench run model=timm/resnet50 dataset.names=[m-eurosat]

The default device is cuda:0. On a machine without a working CUDA GPU (or if a GPU run crashes — see troubleshooting), fall back to CPU:

torchgeo-bench run dataset.names=[m-eurosat] device=cpu

Results are appended to results/all_results.csv, which ships pre-populated with reference results — to start from a clean slate, write to your own file with output=results/my_run.csv. Re-run with resume=true to skip already-completed rows.

Learn more

  • Documentation — full configuration reference, available models, dataset tables, multi-band experiments, evaluation methodology, output schema, dev / release workflow, and troubleshooting.
  • AGENTS.md — contributor guide and house style.

Citation

If you use this framework, please cite it (once the torchgeo-bench paper is available):

@misc{torchgeobench,
  title  = {torchgeo-bench: A lightweight benchmarking framework for geospatial foundation models},
  author = {torchgeo-bench Contributors},
  year   = {TBD},
  note   = {Software},
  url    = {https://github.com/torchgeo/torchgeo-bench}
}

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torchgeo_bench-0.4.0.tar.gz (110.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

torchgeo_bench-0.4.0-py3-none-any.whl (182.7 kB view details)

Uploaded Python 3

File details

Details for the file torchgeo_bench-0.4.0.tar.gz.

File metadata

  • Download URL: torchgeo_bench-0.4.0.tar.gz
  • Upload date:
  • Size: 110.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for torchgeo_bench-0.4.0.tar.gz
Algorithm Hash digest
SHA256 07efa4a576a57ed0da250c6a53c37279bc75b49a410608f922cdc54778517eba
MD5 b3a97123f253bbb9aa1bf5a2b7650394
BLAKE2b-256 bfe8339b8a986090bb1d9145c9751fc8579ac31809319e2447493612dca4efc9

See more details on using hashes here.

Provenance

The following attestation bundles were made for torchgeo_bench-0.4.0.tar.gz:

Publisher: release.yml on torchgeo/torchgeo-bench

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file torchgeo_bench-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: torchgeo_bench-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 182.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for torchgeo_bench-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e284b4d612689f52e7e45c438015bc742f1e6a56adb9d66b529cf8cbd74b0f7
MD5 2373b9ec211d5d456f0b04ec8cb42996
BLAKE2b-256 2b91cec1c809d157714d27ff70a7787e268f5507be9836d07fe949f99d4d7ff3

See more details on using hashes here.

Provenance

The following attestation bundles were made for torchgeo_bench-0.4.0-py3-none-any.whl:

Publisher: release.yml on torchgeo/torchgeo-bench

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page