TorchGeo
PyTorch ecosystem library · OSGeo project

Geospatial data and models for PyTorch.

TorchGeo provides CRS-aware datasets and samplers, multispectral transforms, and pretrained weights for satellite and aerial imagery. Its interfaces compose with PyTorch and Lightning. TorchGeo, TorchGeo-Bench, and TerraTorch are projects of the independent TorchGeo Organization.

Stewart et al. TorchGeo: Deep Learning with Geospatial Data. ACM SIGSPATIAL 2022. doi:10.1145/3557915.3560953

$pip install torchgeo
v0.9.0 · Feb 2026 MIT licensedPython 3.12+PyTorch 2.2+OSGeo project
Quickstart

CRS-aware training workflows for classification, segmentation, and detection.

Datasets return tensor dicts, samplers yield geographic windows, and models accept arbitrary band counts. The interfaces follow familiar PyTorch and torchvision conventions.

torchgeo · API

Land-cover classification on EuroSAT.

A Sentinel-2-pretrained ResNet-18 fine-tuned on EuroSAT. The sampler yields windows in the dataset's native CRS; the dataloader is a stock torch.utils.data.DataLoader.

  • CRS-awarewindows align to the dataset CRS, not array indices.
  • 13-band inputSentinel-2 MSI, no RGB workaround.
  • Pretrained weightsSeCo, MoCo, MAE, DOFA, DINO-v2.
$
Successfully installed torchgeo-1.0.0 rasterio-1.4.1 fiona-1.10.1
$
Loaded · Sentinel-2 · 13 bands · 64×64
eurosat.pycomplete example
# Fresh interpreter to a fine-tuned Sentinel-2 ResNet-18.
from torchgeo.datamodules import EuroSATDataModule
from torchgeo.models import ResNet18_Weights
from torchgeo.trainers import ClassificationTask
from lightning.pytorch import Trainer
 
dm = EuroSATDataModule(root="./data", batch_size=64, download=True)
task = ClassificationTask(
model="resnet18", weights=ResNet18_Weights.SENTINEL2_ALL_MOCO,
in_channels=13, num_classes=10,
)
 
Trainer(max_epochs=50, accelerator="gpu").fit(task, datamodule=dm)
Talks & tutorials

Talks and tutorials from TorchGeo users.

Recorded sessions cover releases, semantic segmentation, change detection, and end-to-end geospatial training workflows.

The TorchGeo Organization

Stewarded by Microsoft AI for Good, TU Munich, Taylor Geospatial, Space42, and IBM Research.

Founded at Microsoft AI for Good in 2021, TorchGeo is now an independent OSGeo Project. The TorchGeo Organization governs TorchGeo, TorchGeo-Bench, and TerraTorch in public. Sponsorships fund maintainer time, model checkpoints, dataset hosting, and workshops.

Microsoft AI for GoodFounding org
Technical University of MunichMember
Taylor GeospatialMember
Space42Member
IBMMember
Datasets

100+ datasets in torchgeo.datasets.

Dataset classes preserve coordinate reference systems, spatial bounds, and acquisition metadata while exposing standard PyTorch dataset interfaces.

Inria Aerial Image Labeling — 0.3 m/px imagery and building mask

Inria Aerial Image Labeling

0.3 m aerial imagery · building footprints · five cities

Semantic segmentation
NWPU VHR-10 detection sample

NWPU VHR-10

Mask R-CNN · 10 classes · 800 scenes

Object detection
Pretrained weights

Pretrained backbones for satellite imagery.

Checkpoint definitions record the expected sensors, bands, and preprocessing so weights can be loaded without discarding input metadata.

ModelInputPretraining and architectureSensor domain
DOFAAny · 1–13 chWavelength-conditioned ViT pretrained on Sentinel-1, Sentinel-2, NAIP, Gaofen, and EnMAP.Multi-sensor
PrithviHLS · 6 chIBM × NASA's masked-autoencoder ViT, fine-tuned for floods, wildfires, and crop classification.HLS L30/S30
Scale-MAERGB · 3 chGround-sample-distance-conditioned masked autoencoder for imagery from 0.3 m to 30 m.Aerial / VHR
SatMAES2 · 13 chMasked autoencoder pretrained on temporal Sentinel-2 stacks.Sentinel-2
SeCoS2 · 13 chSeasonal-contrast pretraining over one million Sentinel-2 image pairs.Sentinel-2
SSL4EOS1 + S2 · 15 chDINO, MoCo, MAE, and Data2Vec checkpoints trained on one million Sentinel-1 and Sentinel-2 images.SAR + optical
Research use

Published work and public projects using TorchGeo.

142
unique citing works
194
public dependent projects
169
organizations represented

Institutions in citing-work metadata

InstitutionPapers
Technical University of Munich8
IBM Research3
University of Freiburg3
K. N. Toosi University of Technology3
Centre National de la Recherche Scientifique3
Politecnico di Torino3
Samara National Research University3
IBM Research - Tokyo2
Citing work