WasteVision
Waste Vision: Scan. Map. Clean
The problem WasteVision solves
Managing waste across large areas like university campuses is often a reactive and inefficient process. Cleanup crews rely on manual patrols and subjective reports, leading to wasted resources, missed problem areas, and a lack of actionable, real-time data on waste accumulation. It's difficult to know which areas need cleaning most urgently and to track the effectiveness of cleanup efforts over time.
Waste Vision transforms this process by providing a data-driven, intelligent platform for proactive waste management. It automatically maps a campus into smaller, manageable zones. By processing geolocated images—uploaded in bulk from drones or ground patrols—through an advanced AI pipeline, the system automatically detects waste and estimates its volume using 3D reconstruction.
The result is a live, color-coded "waste heatmap" on an interactive dashboard. This allows campus administrators to instantly see which zones need immediate attention (Red), which are becoming problematic (Yellow), and which are clean (Green). This actionable insight enables them to move from reactive cleaning to data-driven management, optimizing crew deployment, reducing costs, and ensuring a cleaner, more sustainable environment for everyone.
Key Features
AI-Powered Waste Detection: Utilizes a YOLOv8 model and a 3D reconstruction pipeline to accurately estimate waste volume from 2D images.
Real-Time Interactive Map: A dashboard with a Leaflet map that displays a color-coded, real-time status of all campus zones.
Automated Zone Generation: Intelligently creates a grid of manageable zones based on a campus's specific area and location.
Asynchronous Bulk Image Processing: A robust backend using Celery and Redis allows users to upload many images at once without waiting, ensuring a smooth user experience.
**Customizable Zone Management: **Admins can visually edit the map by resizing, moving, creating, and deleting zones to perfectly match their operational needs.
Challenges we ran into
Building a full-stack application that integrates a real-time map, an asynchronous machine learning pipeline, and a robust database presented several significant challenges. Overcoming these was key to developing a stable and scalable solution.
Asynchronous ML Pipeline Integration:
The core feature—analyzing waste images—is a computationally intensive process that can take a long time. Running this directly in an API request would cause server timeouts and a terrible user experience.
Solution: We architected a robust asynchronous pipeline using Celery for task management and Redis (run via Docker for a consistent environment) as a message broker. When a user uploads images, the FastAPI backend immediately accepts the request, places a job on the Redis queue, and returns a response. A separate Celery worker process then picks up the job, runs the entire ML/3D reconstruction pipeline in the background, and updates the database upon completion. This decouples the API from the heavy computation, ensuring the application remains fast and responsive.
Database Schema Management and Migrations:
As the application's features evolved, ensuring the PostgreSQL database schema stayed perfectly in sync with our Python models was a major challenge.
Solution: We implemented Alembic for database migrations. A key hurdle was integrating the PostGIS extension for geospatial queries. Alembic's autogenerate feature initially tried to drop critical PostGIS system tables (like spatial_ref_sys), which would have broken the mapping functionality. We solved this by creating a custom filter in the migration environment (alembic/env.py) to make Alembic correctly ignore extension-specific tables, resulting in a stable and reliable migration process.
Data Integrity and Cleaning at Scale:
The initial dataset of over 5,000 colleges was messy. It contained duplicate entries and inconsistent data formats (e.g., campus area listed as "647 Acres" instead of a number, or missing values represented as NaN).
Solution: We built a resilient, resumable seeding script.
To handle duplicate names in different cities (e.g., "College of Engineering" in Pune vs. Delhi), we implemented a composite unique constraint on the (name, city, state) columns in our database.
The script was enhanced to parse and clean data on the fly, converting text like "Acres" to numbers and calculating the area in a standard unit (square meters).
Crucially, we fixed an issue where NaN values were being saved to the database, which are not JSON compliant and caused API errors. The script now correctly converts these to NULL, ensuring data integrity from the source all the way to the API response.