TorchGeo
Official PyTorch Ecosystem Library · est. 2021

Geospatial deep learning,
without the glue code.

Satellite imagery has its own geometry, statistics, and metadata — it’s a different modality from natural images, not just bigger pictures. TorchGeo adds CRS-aware datasets, spatial samplers, multispectral transforms, and pretrained backbones to PyTorch.

$pip install torchgeo
MIT licensedPython 3.12+PyTorch 2.2+OSGeo project
Quickstart

Classification, segmentation, detection, instance masks — one training loop.

Datasets return tensor dicts, samplers yield geographic windows, models take arbitrary band counts. The six modules below compose the way torchvision does, so most of the API will feel familiar.

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.pyruns as-is
# 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)
Datasets

100+ datasets in torchgeo.datasets.

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

Inria Aerial Image Labeling

0.3 m/px aerial · building footprints · 5 cities

Segmentation
NWPU VHR-10 detection sample

NWPU VHR-10

Mask R-CNN · 10 classes · 800 scenes

Detection
+ 100 more
EuroSAT · BigEarthNet · So2Sat · SpaceNet · xBD · SEN12MS · RESISC45 · OSCD · MillionAID · LEVIR-CD · …

The full catalog

SAR · multispectral · hyperspectral · LiDAR

Browse →
Pretrained weights

Pretrained backbones for satellite imagery.

DOFA

Any · 1–13 ch

A single ViT trained on Sentinel-1, Sentinel-2, NAIP, Gaofen, and EnMAP — wavelength-conditioned.

Multi-sensor

Prithvi

HLS · 6 ch

IBM × NASA's masked-autoencoder ViT, fine-tuned for floods, wildfires, and crop classification.

HLS L30/S30

Scale-MAE

RGB · 3 ch

GSD-conditioned MAE — the same backbone reasons across 0.3 m to 30 m without retraining.

Aerial / VHR

SatMAE

S2 · 13 ch

MAE pretrained on temporal Sentinel-2 stacks. Strong on land cover and crop-type tasks.

Sentinel-2

SeCo

S2 · 13 ch

Seasonal-contrast pretraining over a million Sentinel-2 image pairs — first-class baseline.

Sentinel-2

SSL4EO

S1 + S2 · 15 ch

A 1M-image SSL benchmark — DINO, MoCo, MAE, Data2Vec checkpoints all under one API.

SAR + optical
Research adoption

Cited by 150+ papers, imported by 184+ public repos.

Citations counted from the 2022paper forward (Google Scholar, rounded down). Repo count comes from GitHub’s dependency graph, filtered to non-fork, non-archived geospatial projects across 160 organizations.

Top institutions · 12 of many
Technical University of MunichIBM ResearchK. N. Toosi University of TechnologyUniversity of FreiburgCentre National de la Recherche ScientifiqueSamara National Research UniversityIBM Research - TokyoBavarian State Institute of ForestryBavarian State Research Center for AgricultureMicrosoft AI for Good Research LabInstitut national de recherche en sciences et technologies du numériqueUniversité de Montpellier
Talks & tutorials

From the community.

The TorchGeo Organization

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

Started in 2021 as a Microsoft AI for Good internship project, TorchGeo now operates as an independent, self-governing OSGeo Community Project — MIT-licensed, with contributors across academia, industry, and government. In 2025 the TorchGeo Organization was founded to steward the project. Sponsorships fund maintainer time, model checkpoints, dataset hosting, and workshops.

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