TERRAMIND
FLOOD MAPPING
Teaching a geospatial foundation model to trace flood water in Sentinel-1 radar imagery — a staged fine-tuning pipeline on Sen1Floods11, with real numbers and one genuinely humbling out-of-distribution result.
Clouds don’t stop radar
Floods arrive with storms, and storms bring cloud — the exact moment optical satellites go blind. Synthetic-aperture radar doesn’t care.
Water is dark on radar
Sentinel-1 fires microwave pulses through cloud, smoke and darkness. Smooth open water acts like a mirror and reflects the pulse away from the sensor, so flooded land shows up as near-black in the VV/VH backscatter channels. That physical signal — not colour, not visibility — is what the model segments.
252 chips is not a lot
Sen1Floods11 has only 252 hand-labeled training chips. Training a segmenter from scratch on that would memorise, not generalise. TerraMind 1.0 (IBM & ESA) arrives already fluent in Earth-observation data, so this project only has to teach it one narrow skill: flood water vs everything else.
Sen1Floods11
11 real flood events across 5 continents: 446 chips where humans traced the water by hand, plus 4,160 chips auto-labeled by Otsu thresholding — cheap, plentiful, and noisy. The whole Bolivia event is held out to ask the only question that matters: does this work on a flood it has never seen?
Weak labels weren’t free
Pretraining on all 4,160 weak chips before fine-tuning matched the simple baseline in-domain (0.647 vs 0.653 flood IoU) — and lost5.7 points on the Bolivia holdout. The charts below show it plainly, because a lab notebook that only records wins isn’t a lab notebook.
From raw scenes to water masks
The whole run is one batch script: pretrain, extract the encoder, fine-tune, evaluate twice. Every stage logs to disk so results are reproducible and auditable.
SEN1FLOODS11 v1.1
4,160 weakly-labeled Sentinel-1 chips (Otsu-threshold water masks) plus 446 hand-labeled chips across 11 flood events. Bolivia scenes are quarantined as an out-of-distribution holdout.
SPLITS + NORMALISATION
Official splits: 252 train / 89 valid / 90 test hand-labeled chips, 15 Bolivia. VV/VH channels normalised with dataset stats (means ≈ −12.6 / −20.3 dB), D4 dihedral augmentation, dice loss with ignore-index for missing labels.
TERRAMIND-LARGE BACKBONE
TerraMind 1.0 Large (IBM + ESA) loaded from a local checkpoint via TerraTorch. Tokens are tapped at four depths (layers 5/11/17/23), reshaped to images, and interpolated into a feature pyramid feeding a UNet decoder.
STAGE 1 — WEAK PRETRAIN
Full encoder–decoder trained on the 4,160 Otsu-labeled chips (~6–9 h on a single local GPU, bf16). Checkpoint selection monitors loss on the clean hand-labeled validation split, so noisy labels never pick the winner.
ENCODER SURGERY + STAGE 2
extract_encoder.py strips the Lightning prefix off the best Stage 1 checkpoint and saves bare encoder weights. Stage 2 restarts with that encoder and a fresh decoder, fine-tuning on the 252 hand-labeled chips for up to 150 epochs.
EVALUATION
The best Stage 2 checkpoint runs terratorch test twice: once on the official 90-chip test split, once on the 15-chip Bolivia holdout. Every number on this page comes from those logs.
What the eval logs say
Two charts, zero massaging: flood-class IoU per training stage, and the label budget that motivated the experiment in the first place.
Real numbers. Stage 1→2 values are from stage2_eval_test.log / stage2_eval_bolivia.log (TerraTorch test runs, 25 Jul); Stage 0 baseline values are the ones recorded in the pipeline script after the baseline run. In domain the weak pretraining is a wash — out of distribution it costs 5.7 IoU points.
Real counts from the split files (splits/*.txt). The weak set is ~16× the hand-labeled training set, which is the whole bet of Stage 1: pretrain on cheap noisy labels, save the 446 hand-labeled chips for fine-tuning and honest evaluation. Bolivia scenes are excluded from the weak set so the holdout stays clean.
| Metric | Official test | Bolivia OOD | Drop |
|---|---|---|---|
| IoU · flood | 0.647 | 0.541 | −0.106 |
| F1 score | 0.877 | 0.823 | −0.054 |
| mIoU | 0.792 | 0.717 | −0.075 |
| Pixel accuracy | 0.943 | 0.905 | −0.038 |
| Flood recall | 0.830 | 0.708 | −0.122 |
Real values from the TerraTorch evaluation logs of the best Stage 2 checkpoint. Flood recall is the per-class accuracy of the flood class — on Bolivia the model misses ~29% of flood pixels, the clearest symptom of the distribution shift.
Real chips, real masks
Five held-out Sen1Floods11 test scenes — India, and onwards — with the flood mask sweeping over the raw Sentinel-1 backscatter. Recorded from the actual evaluation output, not an illustration.
SAR in, mask out
What the model actually does, as a scene you can sweep: dark specular water in the radar image on the left, the segmented flood product on the right.
Drag the divider (or use arrow keys) to sweep between the SAR scene and the segmentation overlay. This is a hand-drawn illustrationof the model’s input/output — smooth water reflects the radar pulse away and shows up dark, which is exactly the signal the network learns. Exporting real prediction rasters from the Stage 2 checkpoint, and a live “tile anywhere” FLOODSCOPE demo, are roadmap items below.
Where it stands
- Stage 0 baseline: direct fine-tune on hand labels (test flood IoU 0.653)
- One-command staged pipeline (run_stage1_pipeline.bat): pretrain → extract encoder → fine-tune → double eval
- Stage 1 weak-label pretraining on 4,160 chips with clean-val checkpointing
- Stage 2 fine-tune + evaluation on test and Bolivia holdout
- Understanding the Bolivia regression — did Otsu label bias leak into the encoder?
- Prediction raster export (GeoTIFF → PNG) for real before/after visuals
- Add Sentinel-2 optical as a second modality and test S1+S2 fusion
- Frozen-encoder and lower-LR Stage 2 variants to protect pretrained features
- FLOODSCOPE live demo: pick a tile anywhere, get a water mask in the browser