Tutorial series · 3 parts

Deep learning for satellite imagery with Python

Build a complete deep-learning workflow for satellite imagery in Python: prepare training chips and labels, train a U-Net for semantic segmentation in PyTorch, and run the trained model over rasters far larger than memory.

Level
Intermediate to Advanced
Parts
3, all published
Reading time
About 38 minutes

Start with part 1: Training data for deep learning on satellite imagery: Sentinel-2 image chips in Python

The parts, in order

  1. Part 1 Intermediate 13 min read

    Training data for deep learning on satellite imagery: Sentinel-2 image chips in Python

    Build a labelled deep learning dataset from free data: stream a Sentinel-2 L2A composite from the Planetary Computer, rasterise Overture building footprints over ESA WorldCover, cut georeferenced image chips, split them by spatial block so the test set does not leak, check the class balance and load it all as a TorchGeo dataset.

  2. Part 2 Advanced 12 min read

    U-Net satellite image segmentation in PyTorch: a TorchGeo and Sentinel-2 tutorial on a CPU

    Train a U-Net to segment Sentinel-2 imagery into buildings, built-up land, trees, grass and water with PyTorch, segmentation_models_pytorch and TorchGeo's Sentinel-2 pretrained ResNet-18 weights, on a CPU in five minutes. Real loss curves, per-class IoU and F1, a confusion matrix and an honest look at what limits accuracy.

  3. Part 3 Advanced 13 min read

    Deep learning inference on large rasters: sliding-window prediction, COGs and polygons in Python

    Run a trained PyTorch U-Net over a whole Sentinel-2 scene of a city it has never seen: tiled sliding-window inference on a large GeoTIFF with overlapping, blended windows, a georeferenced Cloud Optimised GeoTIFF of classes and confidence, raster-to-vector polygons with rasterio.features.shapes in a GeoPackage, and an honest check against reference labels.

All tutorial series