> Physics-informed satellite flood segmentation with cross-modal SAR/optical fusion, > built on the IBM/NASA Prithvi-EO-1.0-100M geospatial foundation model.
Modellquelle
Quellenbeschreibung
Physics-informed satellite flood segmentation with cross-modal SAR/optical fusion, built on the IBM/NASA Prithvi-EO-1.0-100M geospatial foundation model.
is a pixel-level flood segmentation model for 12-channel satellite patches (6 optical + 5 SAR-derived + 1 JRC permanent-water prior). It fine-tunes the temporal Vision Transformer as the optical backbone, augmented by a parallel SAR encoder, cross-modal attention, and a physics-informed water-body gate that uses the 37-year JRC Global Surface Water dataset to suppress false positives over historically wet areas.
Quellen
1 QuelleVerifiziert 15. Sept.
Modellartefakte
1 ArtefaktQuellenauszüge
2 AuszügeThe model outputs binary flood masks (flood / no-flood) at full input resolution via sliding-window inference with optional 4-flip test-time augmentation. At evaluation time, waterbody pixels are reconstructed from the binary prediction using the JRC prior, enabling 3-class IoU reporting (no-flood / flood / waterbody) against the original 3-class ground truth.
checkpoint/LICENSE)prithvi_best-v7.ckpt — epoch 125, val flood IoU 0.368 (Google Drive / Zenodo link)Run flood segmentation inference on any 512×512 (or larger) satellite patch with 6 optical bands (Green, Red, NIR, SWIR, and two additional) + SAR (HH, HV). The model handles arbitrary patch sizes via sliding-window inference (window 224×224, stride 112).
Intended users:
The model is integrated into the FloodSense web application as the inference backend:
Geographic bias: The model was trained exclusively on a single flood event in West Bengal / Bangladesh (May 2024, patches 001–079). Performance on other geographies, flood types (flash floods, coastal inundation, urban flooding), or seasons is unknown and likely degraded.
Class imbalance: Flood pixels constitute only ~12% of the training data. The model is tuned for high recall (Tversky α=0.90) at the cost of precision — it will over-predict flood in ambiguous boundary regions.
JRC tile dependency: Waterbody suppression accuracy depends on the JRC Global Surface Water tile
covering the inference region. Images outside the occurrence_80E_30N tile footprint receive no
permanent-water prior, causing elevated false-positive rates in water-body regions (test WB FP rate
without JRC: ~0.34).
Train/val generalisation gap: Flood IoU drops from 0.34 (train) to 0.15 (val/test), indicating overfitting on the 59-image training set. The model should be fine-tuned on local data before operational deployment in a new region.
No temporal context: Despite Prithvi's native multi-temporal capability, this model uses single-frame input (T=1). Pre-flood / post-flood change detection would significantly improve accuracy.
import torch
import numpy as np
from pathlib import Path
# Clone repo and install dependencies
# pip install torch lightning timm rasterio scipy
from best import (
_load_model_from_checkpoint, cfg,
read_tif, normalise_optical, normalise_sar,
compute_sar_features, load_jrc_channel,
sliding_window_predict, postprocess_mask,
)
# Point JRC dir to your pre-generated masks
cfg.JRC_DIR = Path("data/jrc_masks")
device = "cuda" if torch.cuda.is_available() else "cpu"
# Load model
model = _load_model_from_checkpoint("prithvi_best-v7.ckpt", device)
model.to(device).eval()
# Prepare input (6-band GeoTIFF)
img_path = Path("data/image/20240529_EO4_RES2_fl_pid_002_image.tif")
raw = read_tif(img_path) # (6, H, W)
opt = normalise_optical(raw) # (6, H, W)
sar = normalise_sar(compute_sar_features(raw)) # (5, H, W)
jrc = load_jrc_channel(img_path, raw.shape[1:]) # (1, H, W)
img_t = torch.from_numpy(np.concatenate([opt, sar, jrc], axis=0)).float()
# Inference
with torch.no_grad():
prob = sliding_window_predict(model, img_t, crop=224, stride=112, device=device)
# prob: (2, H, W) — channel 1 is flood probability
# Post-process
flood_mask = postprocess_mask(prob[1].numpy(), threshold=0.45)
# flood_mask: (H, W) binary uint8 — 1 = flood, 0 = no-flood
print(f"Flood pixels: {flood_mask.sum()} ({100*flood_mask.mean():.1f}%)")
For 4-flip TTA (recommended for submission):
from best import tta_predict
prob = tta_predict(model, img_t, device=device)
occurrence_80E_30N, reprojected per-image to match patch CRS/resolution. Used as
binary permanent-water prior (channel 12, threshold ≥ 75% occurrence).Optical (channels 0–5):
hls = raw[[2,2,3,4,5,5]] * 0.0001 # scale to reflectance
opt = (hls - PRITHVI_MEANS) / PRITHVI_STDS # official Prithvi normalisation
Means: [0.0333, 0.0570, 0.0589, 0.2323, 0.1973, 0.1194]
Stds: [0.0227, 0.0268, 0.0400, 0.0779, 0.0871, 0.0724]
SAR (channels 6–10): HH, HV, HH−HV, log(HH), log(HV), z-score normalised.
Means: [786.83, 357.99, 434.18, 6.47, 5.78]
Stds: [373.43, 148.94, 305.09, 0.55, 0.62]
JRC (channel 11): Binary 0/1 (occurrence ≥ 75% → 1).
Label: Waterbody (class 2) remapped to no-flood (class 0) during training. Ignore index: −1 (nodata pixels).
Augmentation: horizontal/vertical flip, rot90, elastic deformation (p=0.3), SAR gamma speckle (looks=4), optical brightness jitter (std=0.25), cutout (48×48), MixUp (α=0.3), 8 random 224×224 crops per image per epoch.
precision="16-mixed")L = 0.15·CE + 0.25·Dice + 0.60·Tversky(α=0.90, β=0.10) + 0.05·SAR_KD + 0.20·FocalFlood(γ=3)| Metric | Value |
|---|---|
| Training hardware | NVIDIA T4 16 GB (single GPU) |
| Training time | ~8 hours (125 epochs to best checkpoint) |
| Best checkpoint epoch | 125 (step 14,868) |
| Checkpoint size (full) | 1,052 MB |
| Checkpoint size (inference-only) | ~400 MB |
| Inference time — T4 GPU | ~8 s per 512×512 patch (sliding window + 4-flip TTA) |
| Inference time — CPU | ~45 s per 512×512 patch |
| Total parameters | ~110M (ViT-Base backbone + heads) |
Evaluation is disaggregated by:
| Metric | Description |
|---|---|
| Flood IoU | Intersection-over-Union for class 1 (flood) — primary competition metric |
| No-Flood IoU | IoU for class 0 (no-flood) |
| WaterBody IoU | IoU for class 2 (waterbody), reconstructed via JRC: pred=0 ∧ JRC=1 → class 2 |
| mIoU (3-class) | Mean IoU over classes present in ground truth |
| mIoU (binary) | Mean of flood + no-flood IoU (matches training objective) |
| Overall Pixel Accuracy | Fraction of correctly classified valid pixels |
| WB FP Rate | Fraction of waterbody GT pixels predicted as flood |
By split:
| Split | NF IoU | FL IoU | WB IoU | mIoU(3) | mIoU(2) | Px Acc | WB FP Rate |
|---|---|---|---|---|---|---|---|
| Train (59 images) | 0.722 | 0.340 | 0.505 | 0.522 | 0.531 | 0.809 | 0.173 |
| Val (10 images) | 0.739 | 0.153 | 0.264 | 0.385 | 0.446 | 0.760 | 0.120 |
| Test (10 images) | 0.684 | 0.145 | 0.204 | 0.344 | 0.414... |
--- license: mit language: - en tags: - flood-detection - remote-sensing - satellite-imagery - semantic-segmentation - SAR - optical - geospatial - earth-observation - vision-transformer - physics-informed - disaster-response datasets: - AISEHack-Theme1-Phase2 - jrc-global-surface-water base_model: ibm-nasa-geospatial/Prithvi-EO-1.0-100M pipeline_tag: image-segmentation --- # Model Card — FloodDetNet-Prithvi v5 > Physics-informed satellite flood segmentation with cross-modal SAR/optical fusion, > built on the IBM/NASA Prithvi-EO-1.0-100M geospatial foundation model. ## Model Details ### Model Description **FloodDetNet-Prithvi v5** is a pixel-level flood segmentation model for 12-channel satellite patches (6 optical + 5 SAR-derived + 1 JRC permanent-water prior). It fine-tunes the [Prithvi-EO-1.0-100M](https://huggingface.co/ibm-nasa-geospatial/Prithvi-EO-1.0-100M) temporal Vision Transformer as the optical backbone, augmented by a parallel SAR encoder, cross-modal attention, and a physics-informed water-body gate that uses the 37-year JRC Global Surface Water dataset to suppress false positives over historically wet areas. The model outputs binary flood masks (flood / no-flood) at full input resolution via sliding-window inference with optional 4-flip test-time augmentation. At evaluation time, waterbody pixels are reconstructed from the binary prediction using the JRC prior, enabling 3-class IoU reporting (no-flood / flood / waterbody) against the original 3-class ground truth. - **Developed by:** AI-Hackers - **Funded by:** ANRF (Anusandhan National Research Foundation) AISEHack Programme - **Model type:** Semantic segmentation — geospatial / Earth observation - **Input modalities:** Optical (HLS-style 6-band) + SAR (HH, HV, SAR_diff, log_HH, log_HV) + JRC binary water prior - **Output:** Binary flood mask (0 = no-flood, 1 = flood), 2-channel softmax probability map - **License:** MIT (see `checkpoint/LICENSE`) - **Fine-tuned from:** [ibm-nasa-geospatial/Prithvi-EO-1.0-100M](https://huggingface.co/ibm-nasa-geospatial/Prithvi-EO-1.0-100M) ### Model Sources - **Model weights:** `prithvi_best-v7.ckpt` — epoch 125, val flood IoU 0.368 *(Google Drive / Zenodo link)* --- ## Uses ### Direct Use Run flood segmentation inference on any 512×512 (or larger) satellite patch with 6 optical bands (Green, Red, NIR, SWIR, and two additional) + SAR (HH, HV)...
Source context: 0 downloads · 0 likes · Pipeline image-segmentation · Repo RoAr777/FloodSense