skillfed

torchgeo

TorchGeo: datasets, samplers, transforms, and pre-trained models for geospatial data

torchgeo v0.10.0 79.2K downloads/30d#14,375 on PyPI4,143
Permissive license MIT Active released

What it is and what it does

TorchGeo is a domain library built on PyTorch that bridges machine learning and geospatial data science. It provides curated datasets for satellite imagery (Landsat, Sentinel, and others), samplers that intelligently extract patches from large geographic regions, and pre-trained models adapted for multispectral remote sensing tasks. The library automatically handles the complexity of geospatial work—reprojecting data into matching coordinate reference systems, aligning different satellite sources with different spectral bands, and composing datasets through set operations (union and intersection) based on geographic coverage.

The package targets two audiences: ML practitioners who want to work with satellite and earth observation data without wrestling with geospatial coordinate systems, and remote sensing experts exploring deep learning solutions. It includes both large-scale geospatial datasets (where you sample patches from continental-scale imagery) and benchmark datasets with pre-labeled examples for tasks like object detection, semantic segmentation, and change detection. All datasets integrate seamlessly with PyTorch data loaders and Lightning training pipelines.

Use it for:

  • Train semantic segmentation models on Landsat or Sentinel satellite imagery with automatic CRS alignment and band selection.
  • Build object detection systems on high-resolution aerial imagery using the VHR-10 benchmark dataset.
  • Combine multispectral satellite data from different sensors (e.g., Landsat 7 and 8) into a single training dataset.
  • Sample random geographic patches from continental-scale raster data like the Cropland Data Layer for efficient batch training.
  • Transfer-learn from pre-trained models adapted for multispectral channels beyond standard RGB imagery.
  • Prototype change detection or land-use classification pipelines on real remote sensing data with minimal data wrangling.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

TorchGeo provides PyTorch datasets, samplers, transforms, and pre-trained models for geospatial and remote sensing data, handling multispectral satellite imagery with automatic coordinate reference system alignment.

Yes, if you are working with satellite or geospatial imagery in a PyTorch workflow. The library solves real problems—automatic CRS reprojection, multispectral band alignment, and intelligent patch sampling from large rasters—that would otherwise require substantial custom code. Active maintenance, MIT license, and integration with Lightning make it a solid foundation. The 22 runtime dependencies are heavy but standard for this domain; install time and disk footprint are expected costs. Not necessary if your geospatial work is small-scale or already handled by other tools.

Install

torchgeo on PyPI

pip

pip install torchgeo

uv

uv add torchgeo

poetry

poetry add torchgeo

Installing torchgeo

Before you install

Low friction installation with a pure Python wheel. The 22 runtime dependencies include heavy ML stacks (torch, torchvision, lightning, kornia, segmentation-models-pytorch) that will pull in substantial compiled code; installation time and disk footprint are non-trivial but standard for PyTorch-based geospatial work. Actively maintained as of 2026-08-14.

License in practice

MIT license is permissive; you can use, modify, and distribute TorchGeo with minimal restrictions, including in commercial projects, provided you retain the license notice.

Quickstart

pip install torchgeo

from torchgeo.datasets import Landsat8, CDL
from torchgeo.samplers import RandomPatchSampler
from torch.utils.data import DataLoader

landsat = Landsat8(paths='...')
cdl = CDL(paths='...', download=True)
dataset = landsat & cdl
sampler = RandomPatchSampler(dataset, size=256, length=10000)
loader = DataLoader(dataset, batch_size=128, sampler=sampler)

Requires PyTorch and torchvision to be installed; torch and torchvision are heavy compiled dependencies that may take time to download and build on some systems.

Verify before relying

  • Whether pre-trained model weights for multispectral channels are included in the package or must be downloaded separately.
  • Performance characteristics when working with very large geospatial datasets (e.g., continental-scale imagery).
  • Specific remote sensing data formats and coordinate reference systems supported beyond the examples in the description.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.12)
Install friction low — pure-Python wheel
Runtime dependencies 22 — einops, geopandas, jsonargparse, kornia, lightly, lightning, matplotlib, numpy, pandas, pillow, pyogrio, pyproj, rasterio, requests, segmentation-models-pytorch, shapely, timm, torch, torchmetrics, torchvision, tqdm, typing-extensions
Maintenance actively maintained — 0 days since the last release
Last repo commit
First released
Downloads 79,184/month — #14,375 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: torchgeo-0.10.0-py3-none-any.whl

Keywords: pytorch, deep learning, machine learning, remote sensing, satellite imagery, earth observation, geospatial

Development Status :: 4 - BetaIntended Audience :: Science/ResearchOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Scientific/Engineering :: GIS

Tags

geospatial deep learning pytorchsatellite imagery machine learningremote sensing datasets pytorchmultispectral image processingearth observation deep learninglandsat sentinel data pytorchgeospatial data loader
geospatial-mlsatellite-imageryremote-sensing

More Artificial Intelligence packages