⚡ Inspiration: Living Through Lagos Floods

I live in Nigeria. Every rainy season, I watch our nation's economic engine, Lagos, grind to a halt. The headlines are always the same: floods strand millions of commuters, supply chains collapse, and emergency services are overwhelmed.

The problem is coordination. When citizens need help the most, there's no real-time intelligence to guide emergency assets to where they're needed. When Gemini 3's multimodal capabilities were announced, I realised I could finally build something for my community: a system that gives commanders the eyes they need to save lives faster.

🧠 What It Does: Semantic Reasoning for Disaster Response

Project Lifeline is a real-time command centre that analyses live video feeds to help emergency coordinators make faster, smarter decisions.

1. 📹 Multimodal Depth Perception (Vision)

Using Gemini 3 Flash, the system analyses CCTV, drone footage, and citizen videos to calculate flood severity based on semantic context:

  • Observation: "Water reaching the door handles of a submerged yellow minivan."
  • Inference: "Depth ≈ 90cm."
  • Recommendation: DEPLOY CANOE.

2. 🎯 Context-Aware Asset Recommendations

The AI doesn't just detect water—it understands physics:

  • Reference Markers: "Person kayaking" → Water is navigable depth
  • Human-Scale: "Knee-deep on pedestrian" → ~40cm depth
  • Vehicle Scale: "SUV hood visible" → ~80cm depth

Based on these, it recommends the safest asset (Truck / Okada / Canoe).

🛠️ How We Built It (The Stack)

We architected a lightweight feedback loop between video feeds and Gemini's multimodal reasoning engine.

Component Technology Role
AI Brain Google Gemini 3 Flash Multimodal video analysis & semantic reasoning
Backend Python + Flask API server connecting UI to Vision Agent
Vision Agent Custom Python Module Processes video, builds structured prompts for Gemini
Frontend HTML5 + Vanilla JS Real-time dashboard with "Inspector Mode"
Mapping Leaflet.js Geospatial visualisation of Lagos zones

The "Magic" Prompt Engineering

We treat Gemini as a Logistics Analyst, not a chatbot. Here's a snippet of our system prompt:

TASK: Analyse this video for flood logistics decisions.

ESTIMATE WATER DEPTH using references:
- Ankle = 15cm, Knee = 40cm, Waist = 80cm
- Car wheel = 30cm, Car door = 60cm

OUTPUT JSON:
{
  "flood_assessment": {
    "water_level_cm": <0-200>,
    "reference_landmark": "<what you used to estimate>",
    "flooding_detected": <true|false>
  },
  "logistics_decision": {
    "zone_status": "NORMAL|WARNING|CRITICAL|FLOODED",
    "recommended_asset": "TRUCK|OKADA|CANOE"
  }
}

🚧 Challenges: Latency vs. Accuracy

The hardest part was trusting the AI's reasoning without overfitting.

  • Challenge 1: Hallucinations

    • Early tests had Gemini guessing depth randomly
    • Fix: Prompt engineering to require "Reference Landmarks" before giving measurements
  • Challenge 2: Real-Time Performance

    • Video analysis is computationally heavy
    • Fix: Switched to Gemini 3 Flash for faster inference while maintaining reasoning quality
  • Challenge 3: Human Trust

    • Commanders won't blindly follow AI
    • Fix: Built "Inspector Mode" showing the AI's chain of thought and reference reasoning
  • Challenge 4: The "Physics Hallucination" Gap

    • We tried building this with older models (Gemini 1.5 Pro, GPT-4), but they failed. They could identify "water," but they couldn't measure it. They would look at a submerged car and guess the depth randomly.
    • The Breakthrough: Only Gemini 3 had the spatial reasoning to use "Reference Objects" (like using a car tyre as a ruler) to calculate accurate depth. This project is only possible because of Gemini 3's reasoning engine.

🏆 Accomplishments We're Proud Of

  • Semantic Reasoning: The AI correctly identified "Person Kayaking" as evidence of 80cm+ water depth—something simple computer vision would miss
  • Inspector Mode: Transparent UI exposing the AI's logic (Reference, Observation, Confidence) so commanders can audit decisions
  • Gemini 3 Integration: Successfully migrated to the latest model family to leverage improved multimodal reasoning and 1M+ token context
  • Real-Time Architecture: Building a system that feels "alive" with streaming logs and dynamic zone status updates

🔮 What's Next for Project Lifeline

  • IoT Integration: Fusing video data with ultrasonic water level sensors for double verification
  • Predictive Modelling: Using Gemini to predict flood paths based on topography and drainage patterns
  • Scalability: Expanding beyond Lagos to Jakarta, Mumbai, and other flood-prone megacities

Project Lifeline is not just code. It's a blueprint for the future of African disaster response.

Built With

Share this project:

Updates