An end-to-end Deep Learning application that classifies waste images into recyclable categories and acts as an intelligent sustainability assistant — recommending disposal methods, recycling processes, and environmental impact insights.
Built with TensorFlow / Keras (MobileNetV2 Transfer Learning) and deployed with an interactive Streamlit web application.
Improper waste segregation is one of the biggest barriers to effective recycling worldwide. EcoVision AI tackles this problem by using computer vision to automatically identify the type of waste from an image and guide the user on how to dispose of or recycle it correctly.
Unlike a simple image classifier, EcoVision AI behaves like a smart recycling assistant — providing decomposition timelines, preparation steps, recyclability status, environmental impact notes, and downloadable PDF reports for every prediction.
- 🔍 Waste Image Classification into 6 categories (Cardboard, Glass, Metal, Paper, Plastic, Trash)
- 📊 Confidence Scores & Top-3 Predictions with probability bar charts
- ♻️ Smart Recycling Recommendations — bin color, decomposition time, prep steps, recycled outputs
- 🌱 Environmental Impact Insights for every waste category
- 📄 Downloadable PDF Report summarizing the prediction and recycling guidance
- 🎨 Modern Multi-Page Streamlit UI (Home, Upload, Prediction, Model Info)
- 🧠 Transfer Learning with MobileNetV2, fine-tuned on the TrashNet dataset
- ⚖️ Class-weighted training to handle dataset imbalance
- 🧪 Fully documented Jupyter Notebook with interview-style explanations for every step
Dataset Used: TrashNet
| Class | Description |
|---|---|
| Cardboard | Boxes, packaging material |
| Glass | Bottles, jars |
| Metal | Cans, tins, foil |
| Paper | Newspapers, documents, paper waste |
| Plastic | Bottles, containers, wrappers |
| Trash | Non-recyclable general waste |
Split Strategy: Stratified split into 70% Train / 15% Validation / 15% Test to preserve class distribution.
Due to the relatively small dataset size, strong data augmentation (rotation, zoom, shifts, brightness, horizontal flip) and class weighting are applied to improve generalization and reduce bias toward majority classes.
| Category | Tools |
|---|---|
| Language | Python 3.11+ |
| Deep Learning | TensorFlow 2.x, Keras |
| Computer Vision | OpenCV, Pillow |
| Data Handling | NumPy, Pandas |
| Visualization | Matplotlib, Seaborn, Plotly |
| ML Utilities | Scikit-learn |
| Web App | Streamlit |
| Reporting | ReportLab (PDF generation) |
| Notebook | Jupyter |
Base Model: MobileNetV2 (pretrained on ImageNet, transfer learning)
Input (224 x 224 x 3)
│
▼
MobileNetV2 Base (frozen initially, ImageNet weights)
│
▼
GlobalAveragePooling2D
│
▼
BatchNormalization
│
▼
Dropout (0.3)
│
▼
Dense (128, ReLU)
│
▼
Dropout (0.2)
│
▼
Dense (6, Softmax) → Cardboard / Glass / Metal / Paper / Plastic / Trash
Training Strategy:
- Stage 1 — Feature Extraction: Base model frozen, only the custom head is trained.
- Stage 2 — Fine-Tuning: Last 20 layers of MobileNetV2 unfrozen and trained with a lower learning rate.
Callbacks used: EarlyStopping, ReduceLROnPlateau, ModelCheckpoint
Saved Model: model/waste_classifier.keras
EcoVision_AI/
│
├── notebooks/
│ └── EcoVision_AI.ipynb # Full training & evaluation notebook
│
├── model/
│ └── waste_classifier.keras # Trained model (generated after training)
│
├── app.py # Streamlit web application
├── utils.py # Preprocessing & model utility functions
├── recommendations.py # Recycling knowledge base & PDF report logic
├── test_recommendations.py # Sanity-check test suite (no TensorFlow required)
│
├── assets/ # Images, icons, sample assets
├── reports/ # Generated PDF reports
│
├── requirements.txt
├── .gitignore
├── README.md
└── LICENSE
# 1. Clone the repository
git clone https://github.com/<your-username>/EcoVision_AI.git
cd EcoVision_AI
# 2. Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txtjupyter notebook notebooks/EcoVision_AI.ipynbRun all cells to preprocess data, train, fine-tune, evaluate, and save the model to model/waste_classifier.keras.
streamlit run app.pyThen open the local URL (typically http://localhost:8501) shown in your terminal.
A lightweight test suite validates the recycling knowledge base and PDF report generation — no TensorFlow or trained model required, so it runs fast and works in any CI environment:
python -m unittest test_recommendations.py -vAdd screenshots of the Home, Upload, and Prediction pages here after running the app.
| Home Page | Prediction Page |
|---|---|
assets/screenshot_home.png |
assets/screenshot_prediction.png |
- Expand dataset with more real-world, in-the-wild waste images
- Add object detection to classify multiple waste items in a single frame
- Deploy as a mobile app using TensorFlow Lite
- Integrate with municipal recycling APIs for location-based guidance
- Add multilingual support for recycling recommendations
- Real-time classification via webcam feed
This project is licensed under the MIT License — see the LICENSE file for details.
- TrashNet Dataset by Gary Thung & Mindy Yang
- TensorFlow / Keras team for MobileNetV2 pretrained weights