DrainGuard AI

Turning storm-drain photos into an explainable cleanup plan before flooding starts.

One-line Summary

DrainGuard AI uses computer vision, rainfall, mapping data, and before/after photo verification to help communities identify which storm drains need attention first—and verify that cleanup actually happened.

The Problem

Blocked storm drains can become a preventable weak point during heavy rainfall. Yet municipal and community teams cannot inspect every drain before a storm.

In practice, cleanup can be reactive: teams respond to complaints or inspect locations without a consistent way to compare urgency across many reported drains.

A drain with severe visible blockage, increasing rainfall, and nearby waterways may deserve attention before a lightly blocked drain elsewhere—but that decision is difficult to make consistently from scattered reports.

The problem is not simply finding a blocked drain. It is deciding what to do first, with limited people and time, and knowing whether the intervention worked.

My Solution

I built DrainGuard AI to turn a drain photo into an explainable operational recommendation.

It follows four stages:

INSPECT → PRIORITIZE → ACT → VERIFY

1. Inspect

A field worker uploads a photograph.

DrainGuard analyzes:

  • Visible blockage
  • Drain-like evidence
  • Litter signals
  • Model confidence
  • Image quality
  • Environmental context

The system also prevents unrelated or low-confidence images from being treated as reliable drain reports.

2. Prioritize

The user provides the drain's location.

DrainGuard combines the visual evidence with:

  • Location-specific rainfall
  • Nearby mapped waterways
  • Visible litter
  • Blockage severity

It then produces an explainable priority score and places the report on an interactive map and ranked cleanup queue.

Instead of simply saying "high risk," the system shows why a location was prioritized.

3. Act

Real cleanup teams have limited capacity.

DrainGuard's Action Planner helps determine:

  • Which reports should be handled first
  • Which reports fit current crew capacity
  • Why a report was selected or deferred
  • How changing rainfall conditions can alter the queue

This turns AI analysis into an operational decision-support tool.

4. Verify

After cleanup, the worker uploads another photograph.

DrainGuard checks whether:

  • The same drain is shown
  • The drain remains visible
  • Blockage has meaningfully decreased
  • Remaining litter is below the configured threshold
  • The evidence is strong enough to close the report

If the evidence is uncertain, the report does not automatically close. It goes to human review.


What Makes DrainGuard Different?

Many computer-vision systems stop after recognizing something in an image.

I designed DrainGuard around the entire intervention lifecycle:

See the problem → Rank the problem → Send people → Prove the change.

The system therefore treats verification and uncertainty as first-class features, rather than assuming an AI prediction is automatically correct.


Explainable AI

DrainGuard currently uses a transparent pilot priority model:

Priority = 0.55 × blockage
         + 0.30 × rainfall index
         + 0.15 × litter

The weights are visible to the user and are explicitly treated as pilot policy values rather than scientifically validated flood probabilities.

Operational Guidance

  • 0–59: Monitor
  • 60–79: Inspect today
  • 80–100: Dispatch now

A high score never bypasses human review.


Environmental Decision Support

DrainGuard also calculates a separate environmental estimate using:

Environmental Risk = 0.40 × blockage
                   + 0.30 × rainfall index
                   + 0.20 × litter
                   + 0.10 × mapped waterway proximity

If rainfall or waterway data is unavailable, DrainGuard does not invent a value. The missing factor remains visible and evidence coverage is reduced.


Cleanup Verification

A report becomes Verified Clear only when all configured checks pass:

Same-drain scene match >= 68%
Drain confidence      >= 60%
Remaining blockage    <= 48%
Remaining litter      <= 48%
Blockage reduction    >= 15 points

If any check fails, the report remains open and is routed to human review.

This prevents a second photograph from automatically being treated as proof that cleanup succeeded.


Responsible AI

I deliberately designed DrainGuard not to overclaim.

It is not:

  • A flood predictor
  • A pollution meter
  • A replacement for engineering assessment

When environmental data is unavailable, the system does not fabricate a value. Missing evidence remains visible and reduces evidence coverage.

The current model audit uses proxy UK trash-screen imagery rather than Bengaluru street-drain imagery. Therefore, the reported model performance is presented as a reproducibility audit, not as proof of Bengaluru field accuracy.


Technical Approach

I built DrainGuard using:

  • Next.js
  • React
  • TypeScript
  • ONNX Runtime Web
  • TensorFlow.js
  • ResNet-50
  • COCO-SSD
  • Leaflet
  • OpenStreetMap
  • Open-Meteo
  • Overpass API
  • Vercel

AI Pipeline

The AI pipeline combines multiple layers:

  1. A research-backed ResNet-50 classifier estimates whether a drain or trash screen appears blocked or clear.
  2. A drain-evidence gate checks whether the image contains credible drain-like structure.
  3. COCO-SSD detects visible litter objects separately from blockage classification.
  4. Texture and debris signals provide a fallback when model resources cannot load.
  5. A normalized scene fingerprint compares before/after images.
  6. Low-confidence, mismatched, unchanged, or non-drain evidence is routed to human review.

The browser model is packaged as a 24 MB INT8 ONNX artifact.

Photo analysis runs client-side in the browser.


Product Features

  • Photo upload and re-analysis
  • Browser-based blockage classification
  • Drain-presence confidence
  • Litter detection signals
  • Explainable factor contributions
  • Location-specific rainfall
  • Mapped waterway context
  • Interactive OpenStreetMap map
  • Ranked cleanup queue
  • Human-review queue
  • Priority Shock rainfall scenarios
  • Transparent crew Action Planner
  • Before/after comparison
  • Comparison slider
  • Same-drain scene verification
  • Field brief generator
  • Controlled evaluation scenarios
  • Model evaluation panel
  • Validation and limitation panels
  • Trust and responsible-use explanations
  • Pitch Mode

Challenges

Generic Object Detection Is Not Enough

Generic object detectors do not provide a reliable storm-drain blockage category.

I therefore separated blockage classification from litter detection and added a drain-evidence gate for unrelated images.

Before and After Photos Are Difficult to Compare

Lighting, camera angle, distance, and framing can change between photographs.

I addressed this using a normalized scene fingerprint and an explicit same-drain threshold.

Environmental Data Can Be Incomplete

Weather and mapping services can be temporarily unavailable.

Instead of inventing missing values, DrainGuard keeps the missing context visible and reduces evidence coverage.

A Second Photo Should Not Automatically Close a Ticket

A photo upload alone does not prove that cleanup happened.

DrainGuard checks scene match, drain confidence, remaining obstruction, remaining litter, and actual improvement before allowing verification.

Responsible AI Communication

The current model audit uses proxy imagery rather than local Bengaluru street-drain imagery.

I therefore show the evaluation scope and limitations directly instead of presenting the results as universal accuracy.


Evaluation

I evaluated the browser classifier using a balanced, camera-disjoint audit of 40 UK trash-screen images.

Metric Result
Accuracy 92.5%
Balanced Accuracy 92.5%
Blocked Recall 100%
Clear Specificity 85%
Precision 87%
F1 Score 0.93

Confusion Matrix

Actual / Predicted Blocked Clear
Blocked 20 true positives 0 false negatives
Clear 3 false positives 17 true negatives

The audit identified all 20 blocked examples while correctly identifying 17 of 20 clear examples.

This is a reproducibility audit of the browser model artifact.

It does not claim:

  • Bengaluru field accuracy
  • Hydraulic performance
  • Pollution measurement
  • Flood prediction

I also created deterministic workflow checks covering blocked drains, clear drains, cleaned pairs, unchanged evidence, different-scene evidence, and non-drain review routing.


Social Impact

If developed and validated with local communities and municipal teams, DrainGuard could help shift storm-drain maintenance from reactive reporting toward evidence-based prioritization.

Potential Beneficiaries

  • Municipal sanitation and maintenance teams
  • Community cleanup groups
  • Residents
  • Schools and campuses
  • Smart-city programs
  • Areas vulnerable to heavy rainfall and drain blockage

My goal is not to replace field workers.

It is to help the people already responsible for maintaining drainage infrastructure decide where their limited time can have the greatest immediate value—and provide evidence that the work was completed.


Feasibility

The core workflow already exists as a browser-based prototype.

Phase 1 — Prototype

Photo analysis, prioritization, mapping, action planning, and verification.

Phase 2 — Local Validation

I would collect local drain imagery across:

  • Different drain designs
  • Weather conditions
  • Camera angles
  • Blockage types
  • Lighting conditions
  • Rain and low-light conditions

Phase 3 — Municipal Pilot

I would introduce:

  • Authenticated multi-user reporting
  • Shared storage
  • Crew coordination
  • Ward-level dashboards

Phase 4 — Scale

Future deployment could add:

  • Route-aware crew assignment
  • Repeat-blockage tracking
  • Larger field validation
  • Long-term performance measurement

Privacy

Photo analysis runs in the browser.

The current prototype stores reports and compressed before/after evidence in browser storage on the inspection device.

The prototype does not yet provide:

  • Shared municipal storage
  • User authentication
  • Role-based access
  • Cross-device synchronization
  • Retention controls
  • Immutable audit history

Users should avoid uploading sensitive personal information, faces, license plates, or confidential locations to the public demo.


Limitations

  • The model audit uses UK imagery rather than Bengaluru street-drain imagery.
  • The 40-image audit is an integration/reproducibility check, not a field deployment guarantee.
  • Image analysis estimates visible obstruction; it does not measure hydraulic capacity.
  • Litter detection does not measure pollution volume.
  • Current storage is device-local.
  • Weather and mapping services can be unavailable.
  • Real municipal deployment requires local validation.
  • Human review remains necessary for uncertain evidence.

What's Next

My next development priorities are:

  • Bengaluru-labelled drain imagery
  • Local model fine-tuning
  • Support for different drain designs and camera angles
  • Night, rain, silt, vegetation, and low-light evaluation
  • Shared authenticated municipal storage
  • Multi-user crew coordination
  • Ward-level dashboards
  • Route-aware crew planning
  • Immutable verification history
  • Larger field validation
  • Response-time measurement
  • Repeat-blockage measurement

Accomplishments

As a solo developer, I:

  • Built a complete photo-to-action environmental workflow
  • Added research-backed browser AI
  • Added visible confidence and factor explanations
  • Added coordinate-specific weather lookup
  • Added mapped waterway context
  • Added a ranked cleanup map and queue
  • Added Priority Shock rainfall scenarios
  • Added transparent crew capacity planning
  • Added persistent before/after evidence
  • Added same-drain verification
  • Added human-review routing
  • Added a field-brief generator
  • Added model evaluation and workflow evaluation panels
  • Added deterministic scoring and verification tests
  • Added GitHub Actions quality checks
  • Deployed the application publicly on Vercel
  • Published the complete source code and documentation on GitHub

What I Learned

I learned that useful environmental AI must do more than recognize objects.

It must:

  • Explain why a report is prioritized
  • Expose uncertainty
  • Preserve evidence
  • Provide a clear next action
  • Involve humans when evidence is uncertain

I also learned that verification is a core product feature.

A cleanup workflow becomes stronger when the system can show what changed rather than simply assuming that an uploaded photo proves success.

Finally, missing data should remain visible.

It is better to show lower evidence coverage than to create a false sense of certainty.


Why DrainGuard Matters

A blocked drain is a small problem until the conditions around it make it a much bigger one.

My central idea is simple:

Don't just detect the blockage. Help decide what to do next—and verify that it changed.

By combining computer vision with environmental context, transparent prioritization, human oversight, and before/after verification, I aim to make storm-drain maintenance more proactive, explainable, and accountable.


Built With

Share this project:

Updates

Submission history