Inspiration
Every year, over 2 billion tonnes of waste are generated globally, yet only 13.5% is properly recycled. The rest ends up in landfills, oceans, or is openly burned, releasing harmful greenhouse gases. As college students passionate about sustainability, we noticed a critical problem: people want to recycle, but they're often confused about how to properly dispose of different materials.
A plastic bottle looks different from a glass jar, and a cardboard box is nothing like an aluminum can—yet many people throw everything into the same bin. This confusion leads to contamination, making entire batches of recycling unrecyclable. We asked ourselves: What if AI could instantly tell you how to dispose of any waste item just by looking at it?
This question sparked EcoGuard AI—a project that combines computer vision with environmental science to make recycling accessible, educational, and even rewarding.
What it does
EcoGuard AI is an intelligent waste classification system that:
📸 Classifies waste in real-time: Upload a photo or use your camera, and our AI identifies the material type (plastic, paper, glass, metal, organic, or e-waste) using color analysis, texture detection, and edge recognition.
♻️ Provides recycling instructions: Each classification comes with 5 specific, actionable tips for proper disposal—like rinsing containers, removing labels, or finding certified e-waste centers.
📊 Tracks environmental impact: Every item you recycle is logged, and the app calculates your real-world impact: CO₂ emissions saved, water conserved, energy saved, and landfill space diverted. A dynamic dashboard visualizes your cumulative contribution.
🏆 Gamifies sustainability: Community challenges, achievements, and a leaderboard turn recycling into an engaging experience. Earn badges like "Carbon Crusader" or "Water Warrior" as you reach milestones.
📚 Educates users: Beyond classification, the app teaches why proper recycling matters and how small actions create massive collective impact.
How we built it
Frontend & UI:
- Built entirely with Streamlit for rapid prototyping and deployment
- Custom HTML/CSS for responsive, accessible design with proper color contrast
- Plotly for interactive data visualizations and impact charts
Computer Vision & Classification:
- OpenCV for image preprocessing, color space conversion (RGB, HSV, LAB), edge detection (Canny), contour analysis, and texture feature extraction
- Custom scoring algorithm that analyzes:
- Color ratios (white, black, brown, green, blue, red, yellow pixel percentages)
- Texture features (edge density, Laplacian variance, morphological gradients)
- Shape features (contour count, area analysis)
- Dominant color detection via K-means clustering
- Multi-factor discrimination to prevent misclassification (e.g., white/bright items reduce organic probability, dark complex items increase e-waste probability)
Data & Impact Science:
- Pandas for data processing and CSV export
- Environmental impact calculations based on EPA and academic research data
- Impact factors per kg of recycled material for CO₂, water, energy, and landfill diversion
Deployment:
- Deployed on Streamlit Cloud for instant access
- GitHub for version control and collaboration
- Optimized dependencies with
opencv-python-headlessfor cloud compatibility
Challenges we ran into
1. Accurate classification without deep learning Without a pre-trained neural network or large dataset, achieving reliable classification was tough. We had to deeply understand how different materials appear in various color spaces. For example, clear glass has high brightness but low saturation with sharp reflection edges, while organic matter shows in brown/green with irregular textures. We iterated through dozens of test images, tweaking score weights until the system could reliably distinguish between 6 categories.
2. Cloud deployment dependency hell
Deploying on Streamlit Cloud with OpenCV was painful. The platform runs Debian Trixie, which has renamed or removed several system packages. We went through multiple packages.txt iterations before realizing opencv-python-headless bundles its own dependencies. Removing system packages entirely solved the deployment issues.
3. Preventing false positives for "organic" Our initial classifier labeled almost everything as "organic" because brown/green detection was too aggressive. We had to add anti-discrimination logic: white items reduce organic probability, dark items push toward e-waste, blue items suggest plastic, and shiny reflective surfaces indicate metal. This balanced the scoring system.
4. Streamlit API changes
Mid-development, Streamlit deprecated use_column_width in favor of use_container_width, breaking our image displays. We had to find and replace every instance across 600+ lines of code.
5. Color contrast accessibility Our original design used light green backgrounds with white text, which was nearly invisible. We redesigned the entire color scheme to meet WCAG contrast guidelines—dark green headers with white text, light cards with dark text, and proper hover states.
Accomplishments that we're proud of
Built a working AI classifier from scratch without relying on pre-trained models or external APIs. Our color-space analysis approach is lightweight, fast, and doesn't require GPU resources.
Achieved real-world impact tracking: The app doesn't just classify waste—it shows users their tangible contribution to environmental protection, making abstract concepts like "carbon savings" concrete and personal.
Created an engaging user experience: Gamification elements like challenges, achievements, and leaderboards transform a mundane task into a rewarding activity. Early testers reported feeling motivated to recycle more.
Successfully deployed to production: Despite dependency challenges, EcoGuard AI is live and accessible to anyone with an internet connection at no cost.
Designed for accessibility: Proper color contrast, clear typography, and intuitive navigation make the app usable by diverse audiences.
Built in under a week: From concept to deployed product, our team executed rapidly while maintaining code quality and documentation.
What we learned
Computer vision fundamentals: Deep understanding of color spaces (RGB vs HSV vs LAB), edge detection algorithms, morphological operations, and feature extraction techniques.
The complexity of waste classification: Different materials have unique visual signatures—glass reflects light creating sharp edges, metal has specular highlights, paper has fibrous texture, and organic matter has irregular natural patterns.
Streamlit's strengths and limitations: It's incredible for rapid prototyping and data apps, but custom styling requires CSS workarounds, and state management needs careful session state handling.
Deployment realities: Cloud platforms have specific environment constraints. Testing locally with
pip installdoesn't guarantee cloud compatibility. Understanding system vs Python dependencies is crucial.Environmental science: We researched EPA data, lifecycle analyses, and recycling processes to accurately calculate impact metrics. For example, recycling 1 kg of aluminum saves 8 kWh of energy—enough to power a laptop for 80 hours.
User psychology: People are more likely to adopt sustainable behaviors when they see immediate, personal impact and receive positive reinforcement. Gamification isn't just fun—it's effective behavior change science.
What's next for EcoGuard AI
Short-term improvements:
- Mobile app: Port to React Native or Flutter for native camera integration and offline classification
- Real CNN model: Train a convolutional neural network on the TrashNet or TACO dataset for higher accuracy
- Barcode scanning: Integrate product database lookups for packaged goods
- Multi-language support: Expand accessibility beyond English
Medium-term goals:
- Municipal integration: Partner with local recycling programs to provide API access to collection schedules and accepted materials
- IoT sensor integration: Connect with smart bins that automatically sort waste
- Community impact tracking: Aggregate anonymous user data to show neighborhood or city-wide recycling statistics
- Carbon credit system: Explore blockchain-based rewards for verified recycling
Long-term vision:
- Global waste database: Create an open-source repository of waste images to improve classification models worldwide
- Circular economy marketplace: Connect recyclers with manufacturers who use recycled materials
- Policy advocacy tools: Provide data to municipalities and governments to improve waste management infrastructure
- Educational curriculum: Develop classroom modules teaching students about AI, sustainability, and environmental science
EcoGuard AI demonstrates that technology doesn't have to choose between innovation and impact. By making recycling smarter, we're proving that artificial intelligence can be a powerful force for environmental good—one classified item at a time. 🌍♻️
Log in or sign up for Devpost to join the conversation.