Skip to content

rushammm/flood-detection-fm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flood Detection with Geospatial Foundation Models + Grad-CAM

Deployment and explainability analysis of NASA-IBM Prithvi-EO-2.0 (300M parameters) fine-tuned on Sen1Floods11 for satellite flood segmentation, with Grad-CAM to visualize what drives the model's predictions.

Live demo: huggingface.co/spaces/Rushammm/flood-detection-prithvi-xai

Technical writeup: WRITEUP.md

What this is

A geospatial foundation model (Prithvi-EO-2.0) takes a Sentinel-2 tile and predicts which pixels are flood-water. Grad-CAM overlays show which spatial regions the model attends to when predicting water — useful for sanity-checking the model on out-of-distribution scenes and identifying failure modes.

Model: ibm-nasa-geospatial/Prithvi-EO-2.0-300M-TL-Sen1Floods11 (released by NASA-IMPACT and IBM Research, Dec 2024). Dataset: Sen1Floods11 — 446 hand-labeled 512×512 Sentinel-2 tiles across 11 flood events, 14 biomes, 6 continents. XAI: Grad-CAM targeting the final feature-aggregation conv of the UperNet decoder.

Results

Three example tiles (India, Spain, USA) with RGB / predicted water score / Grad-CAM overlay:

Grad-CAM heatmaps for India, Spain, USA tiles

Per-tile observations are in WRITEUP.md.

Repo structure

flood-detection-fm/ ├── README.md ← you are here ├── WRITEUP.md ← 1-page technical writeup ├── results.md ← evaluation metrics + takeaways ├── notebooks/ │ ├── phase_a_eval.ipynb ← independent evaluation │ └── prithvi_flood_xai.ipynb ← main inference + Grad-CAM work ├── space/ │ ├── app.py ← Gradio app (same code as deployed Space) │ ├── requirements.txt │ └── README.md ├── figures/ ← Grad-CAM PNGs └── LICENSE


## How the demo works (CPU inference)

The HF Space runs the model on CPU. First inference on a 512×512 tile is ~30–90 seconds (ViT-300M forward + Grad-CAM backward pass). The Space downloads the 1.3 GB checkpoint once at startup.

To run locally with GPU acceleration, clone the repo and run `space/app.py` after `pip install -r space/requirements.txt`. A CUDA GPU is recommended.

## Acknowledgements

- **NASA-IMPACT + IBM Research** for releasing Prithvi-EO-2.0 and the fine-tuned Sen1Floods11 weights.
- **Cloud to Street** for the Sen1Floods11 dataset.
- **TerraTorch** team for the geospatial training/inference framework.


— Rusham Elahi · [rusham.dev](https://rusham.dev) · [github.com/rushammm](https://github.com/rushammm)

About

NASA-IBM Prithvi-EO-2.0 fine-tuned on Sen1Floods11 for satellite flood segmentation, with Grad-CAM explainability. Live Gradio demo on HF Spaces.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors