Sentinel-1 water U-Net (Amazon)
U-Net that maps surface water from Sentinel-1 SAR images (IW GRDH, VV + VH, 10 m), from Wagner et al. (2024), The Amazon's 2023 Drought: Sentinel-1 Reveals Extreme Rio Negro River Contraction, Remote Sensing 16(6):1056.
This repository holds the PyTorch weights (port of the original R/Keras model, numerically validated), and a preprocessed example scene. Code, notebooks and documentation: github.com/fabien-w/sentinel1-water-unet.

Files
| File | Content |
|---|---|
s1_water_unet.safetensors | weights, PyTorch state dict (recommended) |
s1_water_unet.pt | same weights, torch.save state dict |
conversion_info.json | source Keras file and number of tensors |
examples/anavilhanas_S1D_20260828_VV_VH_8bits.tif | preprocessed Sentinel-1D scene of 28 Aug 2026, 0.5° × 0.5° around the Anavilhanas archipelago (input of the model) |
examples/anavilhanas_S1D_20260828_water.tif | water mask predicted from it (0 not water, 1 water, 255 no data) |
Usage
pip install "s1water @ git+https://github.com/fabien-w/sentinel1-water-unet.git"
from s1water.pipeline import download_example_scene, predict_scene
img8 = download_example_scene() # or your own SNAP-preprocessed scene
predict_scene(img8, "anavilhanas_water.tif") # downloads these weights, GPU if available
Low level:
import torch
from huggingface_hub import hf_hub_download
from s1water.model import load_model
model = load_model(hf_hub_download("Fabien-Ctrees/sentinel1-water-unet", "s1_water_unet.safetensors"), "cuda")
x = torch.rand(1, 4, 4224, 4224, device="cuda", dtype=torch.float16) # VV, VH, VV, VH in [0, 1]
prob = model(x, crop=64) # (1, 1, 4096, 4096) water probability; water = prob >= 0.5
Model details
- Architecture: U-Net (Ronneberger et al. 2015), encoder 32-64-128-256-512 filters (2 × conv 3×3 + batch norm + ReLU per level, max pooling, dropout 0.5), centre 1024, decoder with 3 × conv per level, 1×1 conv + sigmoid; 34.6 M parameters. Batch-norm epsilon 1e-3 (Keras).
- Input: 4 bands VV, VH, VV, VH (the 2-band image repeated), 8-bit values / 255. The 8-bit values come
from σ⁰ in dB:
(max(-49, min(1, dB)) + 50) × 5; 250 = no data. Any size multiple of 32. - Preprocessing (ESA SNAP): Apply-Orbit-File (precise) → Remove-GRD-Border-Noise → ThermalNoiseRemoval →
Calibration (σ⁰) → Terrain-Correction (GETASSE30, bilinear, WGS84, 10 m) → dB → 8 bits. Implemented in the
GitHub repository (
s1water.preprocess,esa_snappy). - Prediction: 4224 × 4224 tiles every 4096 px, 64 px cropped on each side (
crop=64); float16 on GPU. - Post-processing (paper): scene-border mask (no data only outside the acquisition footprint); optional SRTM mountain-shade mask (slope ≥ 20°), off by default because it hides lakes in flat forest.
Training
- 59,387 training and 6,057 validation patches of 256 × 256 px, Sentinel-1A images of the Amazon basin (2021-2022), each matched with a high-resolution reference water mask acquired ≤ 25 days apart, plus patches with sandbanks of the dry season.
- Adam (learning rate 1e-4), binary cross-entropy + Dice loss, batch 32, random flips; R keras / TensorFlow 2.10.
- The weights are those of the published results (
unet_wgth_S1_waterNsand_256_008).
Evaluation
| Sample | Patches | Precision | Recall | F1 |
|---|---|---|---|---|
| Training (paper) | 59,387 | 0.935 | 0.926 | 0.930 |
| Validation (paper) | 6,057 | 0.934 | 0.926 | 0.930 |
Port validation: PyTorch vs Keras float32, maximum probability difference 4.8 × 10⁻⁶ and 100 % identical masks; PyTorch float16 vs the original predictions of the paper, 99.998 % identical pixels on 2,379 validation patches, same F1.
Limitations
- Trained and evaluated in the Amazon only; not evaluated in other biomes, arid regions or cities.
- Trained with Sentinel-1A; Sentinel-1C/D (scenes after 2025) have the same instrument design but were not part of the training data.
- Rivers of 1-2 pixels (10-20 m) are often missed; flooded vegetation is not mapped as open water.
- Convective rain cells can increase the backscatter of water and cause omissions; radar shadows in mountains can look like water (use the shade mask).
- The reference masks come from another model, with its own errors.
Support
If this model is useful to you, you can support the work with a coffee: https://buymeacoffee.com/fwagner ☕
License and citation
Weights under CC BY 4.0 (attribution: cite the article below); code under MIT (GitHub). Example data contain modified Copernicus Sentinel data (2026).
@article{wagner2024amazon,
title = {The Amazon's 2023 Drought: Sentinel-1 Reveals Extreme Rio Negro River Contraction},
author = {Wagner, Fabien H. and Favrichon, Samuel and Dalagnol, Ricardo and Hirye, Mayumi C. M. and Mullissa, Adugna and Saatchi, Sassan},
journal = {Remote Sensing}, volume = {16}, number = {6}, pages = {1056}, year = {2024},
doi = {10.3390/rs16061056}
}
Developed at CTrees.