#U-Net

2 posts

Two land cover maps of a 30 km square around Leicester side by side: the U-Net prediction on the left and the reference labels on the right. Both show the city in grey and red in the centre, surrounded by farmland in pale green, woods in dark green and reservoirs in blue. The prediction's city is smoother, with fewer separate red buildings.

Tutorial Python Part 3 of 3

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.

Advanced 13 min read

Four rows of Sentinel-2 test chips. Each row shows the image, the reference labels, the U-Net prediction and the disagreement in magenta. The prediction matches rivers, woods and fields closely, but in the city centre it draws buildings as blobs instead of separate roofs.

Tutorial Python Part 2 of 3

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.

Advanced 12 min read