CleanCore: Modernizing Smart City Waste Architecture
Description
CleanCore is an AI-driven smart waste management platform combining computer vision and route optimization for municipal collection fleets. Powered by a custom YOLOv8 model trained on 895 proprietary IoT camera images from three European waste operators, the platform achieves 97.1% mAP50 fill-level accuracy on an unseen camera hold out test set. A FastAPI backend ingests bin snapshots, classifies fill status (Empty, Half-Full, Full, Overflowing) against admin tunable thresholds, then dispatches workers via a Greedy Nearest Neighbor plus 2-opt routing engine over Haversine distance. The system integrates a React/Firestore admin dashboard with ten concurrent real time listeners for operational visibility, and a Flutter worker application with Firebase Cloud Messaging notifications that deliver urgent-pickup alerts from sensor detection to driver action in seconds.
Objectives
The objective of CleanCore is to modernize the inefficient, schedule-driven waste collection model used by most municipalities by replacing fixed routes and manual inspection with an intelligent, data-driven, real-time system. Specifically, the project aims to: 1. Eliminate empty trip collection through AI-based bin fill monitoring, by training a custom object detection model that classifies a bin's contents into four operational fill states (Empty, Half-Full, Full, Overflowing) and identifies its waste composition using only a single static snapshot from a battery powered IoT image sensor designed deliberately around the hardware reality of low cost cellular devices that cannot stream continuous video without depleting their batteries. 2. Deliver a worker level algorithmic routing layer that converts the set of qualifying bins (above the admin configured collection threshold, within the worker's assigned area and waste stream, not concurrently locked to another truck, and not in regulatory blackout) into a near optimal collection sequence using Greedy Nearest Neighbor seeded ordering followed by 2-opt local search refinement over Haversine geographic distance. 3. Provide municipal administrators with real time operational visibility through a web dashboard backed by ten concurrent Firestore push based snapshot listeners, surfacing total bin status, active routes, completed stops, anomaly events, route exceptions, shift schedules, and orphaned critical bins that have crossed the threshold but have no active route to ride on. 4. Establish a closed-loop notification mechanism using Firebase Cloud Messaging that proactively informs the right worker, in the right area, at the right time: either by appending a newly-critical bin to their active route, or by sending a batched "start a route" alert when no matching route currently exists. 5. Demonstrate that a 895-image proprietary dataset can, through transfer learning from COCO weights and an aggressive augmentation pipeline (mosaic, HSV jitter, RandAugment, random erasing), reach production-grade accuracy on a held-out, unseen-camera test set proving that municipal AI deployments do not require massive open datasets if the data is well-curated and the architecture is well-chosen. 6. Position the system as a defensible, integrable intelligent layer that can feed into existing commercial fleet-management infrastructure (HERE Maps, Google Routes, DHL fleet systems) rather than reinventing macro-level logistics that the industry has already standardized.
Socio-economic benefit
CleanCore delivers measurable benefits across environmental, economic, and public health dimensions. Environmental Impact: By replacing fixed schedule collection with fill based routing, the system eliminates trips to bins that do not yet require service, directly reducing fuel consumption and tailpipe emissions. Each generated route is annotated with an estimated fuel consumption and a CO2 footprint computed at the German municipal standard of 0.95 kg CO2 per kilometre, giving fleet managers explicit, auditable sustainability metrics. The 2-opt route refinement consistently reduces total tour distance over a greedy baseline, compounding per-route emission savings across a city-wide fleet. Economic Impact: Municipal waste collection is one of the largest line items in a city's operational budget, with fuel, labour, and vehicle wear dominating the cost structure. By eliminating empty trips and optimizing stop sequencing, CleanCore directly reduces operating costs and extends vehicle service life. The admin configurable threshold system gives operators a single dial the critical fill percentage to tune the system's behavior to local conditions: tight 60% thresholds for high-density commercial districts, relaxed 85% thresholds for low traffic residential zones. The retroactive recompute endpoint applies any threshold change to all existing bins atomically, letting operations teams respond to seasonal or event-driven demand without manual data work. Public Health and Civic Quality: Overflowing bins are not just an aesthetic problem they attract pests, leak leachate, and in dense urban environments contribute to disease vectors and respiratory complaints. CleanCore's model is deliberately biased toward over collection rather than under-collection: the confusion matrix on the test set shows zero instances where a Full or Overflowing bin is misclassified as Empty. The two tier notification system ensures that when a bin crosses the critical threshold, either an already-dispatched driver is updated in-flight, or the nearest available worker is alerted to start a new route closing the loop between sensor detection and physical action in seconds rather than days. Worker and Operator Welfare: The Flutter worker app removes the cognitive load of route planning from the driver, replacing the "where do I go next?" question with a pre optimized sequence rendered against road aware OSRM polylines. The route exception pathway lets drivers report unsafe conditions (hazardous waste, blocked access, full truck) without bypassing the system or making unilateral decisions, while still keeping a human in the loop for any non-routine event. Shift scheduling via the admin panel aligns collection windows with municipal noise regulations and worker availability.
Methodologies
The project follows an industry aligned methodology informed by a nine year domain partner in the European waste management market, structured into six layered phases: 1. Data Acquisition and Curation A proprietary dataset of 895 timestamped images was acquired under a legally binding agreement with three industrial waste operators Paprec, Slinger, and UKConnect. Fill percentages were read directly from the IoT camera's sensor-side filename metadata (e.g. "..._1737822744869_95.jpg" denotes 95% full) and binned into four classes (Empty 0–15%, Half-Full 16–55%, Full 56–89%, Overflowing 90%+). The split was operator stratified rather than randomly partitioned: Paprec 80/20 train/val, Slinger entirely in training as the source of overflowing examples, and UKConnect entirely held out as a cross device test set so the headline accuracy reflects generalization to a camera the model has never seen. 2. Model Training (Transfer Learning) A YOLOv8n model pretrained on COCO was fine-tuned for 100 epochs (early stopped at 42 via patience=25) with image size 640, batch 16, SGD with momentum 0.937 and cosine learning rate schedule. Loss components were box CIoU (weight 7.5), classification BCE (0.5), and Distribution Focal Loss (1.5). A heavy augmentation pipeline mosaic, HSV jitter, horizontal flip, translate/scale, random erasing, RandAugment multiplies the effective training exposure to compensate for the small dataset size. 3. Backend Inference Service A FastAPI application loads the fill model and a parallel waste-type model into memory once on boot. The /analyze/ endpoint accepts a multipart image, runs fill inference at confidence 0.5, maps the predicted class to an integer fill percent, and if non-empty chains the waste classifier. The result is classified against admin-configurable thresholds and persisted to Firestore. 4. Routing Engine Route generation models the worker's collection problem as a Travelling Salesman variant: starting from the worker's GPS depot, all qualifying bins (above the collection threshold, in the worker's assigned area, in the matching waste stream, not locked, and not in quiet-hours regulatory blackout) are passed through Greedy Nearest Neighbor seeding and then 2-opt local-search refinement (capped at 3 passes, 1-metre improvement threshold) over Haversine distance. Per-route fuel, distance, and CO2 are computed and stored alongside the ordered stop sequence. 5. Real Time Coordination Layer The admin React panel uses ten concurrent Firestore push-based snapshot listeners covering bins, users, pickup logs, routes, anomalies, exceptions, shifts, and alerts. When a bin crosses the critical threshold, the backend's urgent-attach function either appends the bin to a matching active route and FCMs the driver, or falls back to a batched orphan notification across all area workers.
Outcome
CleanCore delivers a production quality, three-tier waste management platform that demonstrably outperforms traditional schedule based collection on accuracy, efficiency, and responsiveness. System Deliverables: 1. A custom-trained 22 MB YOLOv8 fill level model, deployable from a single Python service. 2. A FastAPI backend exposing endpoints for image analysis, route generation, threshold management, shift scheduling, urgent attachment, worker location tracking, and cascade-safe bin deletion. 3. A React + TypeScript admin dashboard with ten real time Firestore listeners, full bin CRUD with cascade-safe deletion across active routes, configurable warning and critical thresholds with retroactive reclassification of every existing bin, and integrated anomaly and AI-insights panels. 4. A Flutter worker application with Firebase Cloud Messaging integration, OSRM road-following route visualization, live orphan critical bin counter, and on-route stop completion flow. Qualitative Outcomes: 1. Demonstrated that a sub-1000-image proprietary dataset, properly curated and held-out by camera identity, can reach commercial-grade detection accuracy through transfer learning challenging the common assumption that municipal AI requires massive training corpora. 2. Established a clean architectural separation between worker level algorithmic routing (CleanCore's scope) and macro level fleet management (commercial logistics APIs such as HERE Maps and DHL), positioning CleanCore as an intelligent layer that integrates into existing enterprise stacks rather than competing with them. 3. Implemented a closed-loop, threshold driven monitoring system where any administrator action changing the critical threshold, adding a new bin, deleting an existing one propagates atomically through every dependent record without manual intervention. 4. Produced a fully reproducible build with the trained models, training run logs, dataset preparation script, and complete inference pipeline source available for future extension. The system is deployable in its current form to a pilot municipality and forms a defensible foundation for future enhancements including per-truck capacity modeling, ONNX/edge device deployment, and integration with commercial fleet management APIs.
Gallery
More from Computer Science
Ustad Go: An AI-Powered Mobile and Web Ecosystem for Verified Local Service Provision in P…
Ustad Go is a dual-platform solution bridging the gap between skilled local service providers and households.…
Supervisor: Dr. Wasif Nisar
Sales Distribution Hub
The Sales Distribution Hub is a web-based management system designed for Masood & Company to automate and stre…
Supervisor: Dr. Wasif Nisar.
AI Based Road Damage Detection System
AI Based Road Damage Detection System is a smart application that uses YOLOv8 and computer vision techniques t…
Supervisor: Mehwish Mukhtar
EvaluTech: AI-Powered Hiring & Job Platform for Employers and Applicants
EvaluTech is an intelligent recruitment management platform that streamlines the complete hiring lifecycle fro…
Supervisor: Dr. Wasif Nisar