Inspiration
Pakistan loses $3–4 billion a year to floods. The 2022 floods displaced 33 million people, and rural communities often get less than six hours of warning. The cruel irony: during monsoon — exactly when flooding peaks — the optical satellites that could map the water are blinded by cloud cover, and authorities fall back on slow, dangerous field surveys. We wanted to build the system we wished existed in 2010 and 2022: one that sees through the clouds and acts on its own.
What it does
FloodSense-PK is a flood intelligence platform operated end-to-end by AI agents:
- Sees through clouds: Sentinel-1 C-band radar imagery flows through Google Earth Engine into our U-Net (ResNet34) segmentation model, mapping floodwater in any weather, day or night, at district, province, or national scale.
- Benchmarks against history: Every detection is compared against the 2010 Great Pakistan Floods (Landsat-5 MNDWI baseline) to compute a Delta Severity — is today worse than the worst flood in modern history?
- Fuses live hydraulics: A scraper pulls real-time barrage discharge from Pakistan's Flood Forecasting Division across 31 stations.
- Decides autonomously: A four-agent pipeline classifies risk (Disaster Intelligence Agent), projects the flood wave downstream district-by-district with a volume-balance model (Simulation Agent), then selects safe zones, plans evacuation routes, and dispatches personalized email alerts to citizens and tactical briefings to authorities (Response & Communication Agent) — grounded in a RAG knowledge base of Pakistan's flood protocols, with narratives generated by Gemini.
It ships as a Streamlit executive dashboard, a React 19 web console on a FastAPI + MongoDB Atlas backend, and a Flet mobile alert app — all sharing one intelligence engine.
How we built it
- Detection: U-Net + ResNet34 (ImageNet encoder), trained on Sen1Floods11 with Dice + Focal loss, reaching 0.5503 validation IoU. Large SAR tiles are sliced into 256×256 patches, inferred, and stitched back into a flood mask and probability heatmap.
- Geospatial pipeline: Google Earth Engine fetches Sentinel-1 VV composites with an SRTM slope mask, plus the 2010 Landsat-5 MNDWI baseline via zonal statistics over 148 district boundaries.
- Agents: Deterministic, testable Pydantic-typed agents orchestrated by
run_pipeline(), with Gemini (Groq fallback) enriching the natural-language reports. A Qdrant vector store (sentence-transformers embeddings) grounds assessments in our structured knowledge PDF with cited sources. - Production stack: FastAPI REST backend with JWT auth, background analysis jobs, and auto-alert creation persisted to MongoDB Atlas; React 19 + Vite + TanStack Query frontend; SMTP alert delivery with safe-zone coordinates and Google Maps directions.
Challenges we ran into
- VH polarization gaps: GEE composites gave us VV reliably, so we approximate VH at inference — retaining the VH/VV ratio channel the model was trained on.
- Comparing sensors across eras: 2010 optical MNDWI vs. 2026 SAR aren't pixel-comparable, so we treat the delta as a benchmark indicator with transparent methodology, not a pixel-perfect diff.
- A fragile government data source: The FFD portal has no API; our scraper uses aggressive regex parsing with status fallbacks to survive layout changes.
- Terrain false positives: Radar shadows in mountains mimic water — an SRTM slope mask (<15°) cut these dramatically.
- Keeping agents trustworthy: Alerts that trigger evacuations can't hallucinate. We made every agent decision rule-based and auditable, using LLMs only to narrate — not to decide life-safety thresholds.
Accomplishments that we're proud of
- 0.5503 IoU on a peer-reviewed global benchmark with a single model, no ensembling.
- A fully autonomous detect → simulate → alert loop running in production: analyses that cross the risk threshold create alerts and send citizen emails with zero human intervention.
- Three production clients (web dashboard, React ops console, mobile app) on one shared engine, with a live demo anyone can try.
- Downstream propagation modeling along the real Indus/Kabul barrage topology (Tarbela → Sukkur → Kotri), giving districts hours of advance notice.
What we learned
Radar physics is a superpower — open water is a specular mirror in SAR, and leaning on that physics beat chasing more channels. We also learned that "agentic" doesn't have to mean opaque: deterministic agents with LLM narration gave us both autonomy and defensibility, which is exactly what disaster authorities demand. And building three frontends taught us to ruthlessly separate the intelligence engine from every UI.
What's next for FloodSense-PK
Local fine-tuning on Pakistani flood imagery, dual-pol SAR export from GEE, SMS/WhatsApp alert channels for low-connectivity communities, insurer-facing parametric-trigger APIs, and expansion of the district knowledge base — turning FloodSense-PK from an early-warning tool into national flood infrastructure.
Built With
- fastapi
- flet
- gemini
- google-cloud
- google-earth-engine
- groq
- landsat
- mongodb
- opencv
- pydantic
- pydeck
- python
- pytorch
- qdrant
- rag
- react
- sentence-transformers
- sentinel-1
- streamlit
- tailwindcss
- tensorflow
- typescript
- vite
Log in or sign up for Devpost to join the conversation.