Inspiration

Littering from moving vehicles is a common sight on the roads of Lahore and other fast-growing cities, but it's almost impossible to enforce. There's no systematic way to catch it happening, identify the vehicle responsible, or even understand where and how often it occurs. Municipal bodies and traffic police are left with no evidence base to act on. We wanted to see if the traffic cameras cities already have could be turned into a detection system, without requiring new hardware or additional patrols.

What it does

Our system watches traffic camera footage and automatically flags likely littering incidents. A computer vision pipeline built on YOLOv8 and ByteTrack detects and tracks vehicles frame by frame, and a motion-analysis heuristic identifies the moment an object separates from a moving vehicle and settles on the road. Once a violation is flagged, an ANPR (automatic number plate recognition) module attempts to read the vehicle's license plate. Every incident — with timestamp, location, confidence score, and evidence image — is logged to a backend and shown on a reviewer dashboard, where a human confirms, rejects, or escalates it before any action is taken.

How we built it

We split the system into four roles working in parallel over a 5-day sprint:

  • Computer vision: vehicle detection and tracking, plus the littering-detection heuristic using background subtraction and motion divergence.
  • ANPR: plate detection and OCR, with validation against local plate formatting.
  • Backend: a FastAPI + PostgreSQL API storing every incident with full metadata, and an analytics endpoint aggregating incidents by type, day, and location.
  • Frontend: a React dashboard with an interactive map and incident review controls.

We defined a shared API contract early so all four pieces could be built independently and integrated at the end, rather than waiting on each other sequentially.

Challenges we ran into

The biggest challenge was data. There is no public dataset of real littering incidents from a CCTV-style camera angle, so we couldn't train a traditional classifier in the time available. We solved this by building a heuristic detector instead — one that tracks an object's motion relative to a vehicle and flags it when it separates and settles, rather than relying on a labeled littering dataset that doesn't exist. We also tested the pipeline against a mix of real and AI-generated sample clips, deliberately including negative cases (vehicles passing with no littering) to check our false-positive rate.

Integrating four independently built modules was its own challenge — small mismatches in field names, value formats (like how "no plate detected" should be represented), and status values between teammates' code caused real bugs that we had to catch and fix through testing, not just code review.

What we learned

That a working system doesn't require a perfect one. Rather than trying to train a model on data that doesn't exist, decomposing the problem into reliable, well-understood components — detection, tracking, motion analysis, OCR — let us build something that genuinely works end to end within the time we had. We also learned how much cross-team integration bugs come from implicit assumptions about data shape, not faulty logic — the fix was almost always writing the contract down explicitly and testing against it directly, rather than assuming everyone was aligned.

What's next

Given a chance to develop this further, we'd want to replace the motion heuristic with a model trained on real incident data collected from the system's own operation over time. Vehicle emissions/smoke detection is a natural next violation type to add, but depends on access to real emissions data through a future partnership — not something we can self-collect at this scale. Beyond that, the architecture is built to scale by simply adding more camera feeds, and we'd want to pilot it at a small number of known problem locations before wider rollout.

Built With

Share this project:

Updates

Submission history