All work
LWComputer Vision · Civic TechAI & AutomationCase study

Litter Watch — Street Garbage Detection

Finds street garbage from a moving scooter and pins every pile to a real coordinate a municipality can act on.

A computer-vision system that finds garbage piles in street video shot from a moving scooter, pins each one to a real coordinate, and streams annotated frames to a live dashboard — with a geometry gate that filters out people, vehicles and street furniture.

Source private
Litter Watch — Street Garbage Detection interface
Industry
Civic / Municipal
Role
ML & Full-Stack Engineer
Type
AI System
Year
2025
Status
Delivered
78%+
Avg Confidence
Live video
Detection
Geo-pinned piles
Output

Overview

Litter Watch detects garbage and trash piles in street footage filmed from a phone mounted on a moving scooter — the cheapest possible survey rig for an Indian city. A YOLO detector runs over sampled frames, and every confirmed pile is pinned to its own coordinate so the output is a map of where the problem actually is, not just a count.

The hard part is not detection but suppression. Street scenes are full of things that look like a trash pile to a naive detector: people crouching, parked vehicles, stones, tree litter, benches, posters and fences. A geometry gate filters these forbidden classes explicitly and reports how many boxes it rejected, so the confirmed count means something.

The same detector drives two faces — a FastAPI backend streaming an MJPEG feed to a Next.js dashboard with a live map and per-locality stats, and a CLI that batch-processes a video into an annotated file plus a JSON report.

The problem

Municipal garbage surveys are done on foot with clipboards — slow, expensive and stale by the time they are compiled. There was no cheap way to answer "where exactly is the garbage" across a city, and a naive detector run over street video reports every crouching person and parked vehicle as a pile.

The solution

A detection pipeline driven by phone video from a moving scooter: sampled frames run through a YOLO model trained on trash piles, a geometry gate rejects forbidden classes, and every surviving detection is pinned to a coordinate and streamed to a live dashboard.

Technical stack

Frontend

  • Next.js
  • React

Backend

  • Python
  • FastAPI

AI & Processing

  • OpenCV

Also used

  • YOLOv8
  • Ultralytics
  • Leaflet
  • MJPEG streaming

System architecture

  1. 1

    YOLOv8 detector with custom trash-pile weights, run through Ultralytics and OpenCV

  2. 2

    FastAPI backend exposing detection control, run statistics and an MJPEG frame stream

  3. 3

    Next.js dashboard with live feed, Leaflet coverage map, detection gallery and per-zone stats

  4. 4

    Geometry gate that filters forbidden classes and reports the rejection count for transparency

  5. 5

    Sandboxed video library — the detector resolves every job inside one folder and rejects escaping paths

  6. 6

    CLI batch path sharing the same detector, emitting an annotated video plus a JSON report

Engineering challenges

Challenge

The detector confidently boxed people, scooters, stones and posters as garbage — a false-positive rate that made the pile count meaningless.

How I solved it

Added an explicit geometry gate for forbidden classes and surfaced the rejected-box count in the UI, so suppression is visible rather than hidden. Green boxes show what was filtered; only red boxes are ever reported as garbage.

Challenge

Footage from a moving scooter means the same pile appears across many consecutive frames and would be counted repeatedly.

How I solved it

Sampled at a configurable frame interval and pinned confirmed detections to coordinates, so a pile resolves to one location rather than one count per frame it appears in.

Core features

  • YOLO detector trained for street-level garbage piles
  • Geometry gate that filters people, vehicles and street furniture
  • Live MJPEG feed of annotated frames in the browser
  • Every pile pinned to its own map coordinate
  • Per-locality breakdown of where garbage was found
  • Confidence and frame-interval controls at runtime
  • Video upload from the dashboard with progress
  • Webcam and IP-camera sources alongside video files
  • CLI batch mode producing an annotated video plus a JSON report
  • Downloadable annotated video after a run

Results & impact

A survey that previously needed people walking with clipboards became a scooter ride: in a single run the system processed street footage live, confirmed piles at 78%+ average confidence, filtered the forbidden-class boxes, and dropped every confirmed pile onto a Ranchi coverage map with a per-locality breakdown.

Screenshots

Litter Watch — Street Garbage Detection screenshot 1
Litter Watch — Street Garbage Detection screenshot 2

What I learned

  • On a real-world detector, the filtering rules carry more product value than the model — and showing what was rejected is what makes the remaining count trustworthy.
  • Constraining file jobs to a single sandboxed folder is worth doing on day one when the input is user-uploaded video.

Related work

All projects
Next step

Have a system like this to build?

I take projects from the first conversation through to production, and stay on for the support that follows.