AI-Powered Garbage Segmentation & Classification System
An intelligent waste classification system using Deep Learning for smart waste management and environmental sustainability
- About the Project
- Features
- Tech Stack
- Dataset
- Model Architecture
- Installation
- Usage
- Results
- Team
- Acknowledgments
Waste management is a critical global issue, and improper segregation of garbage contributes to pollution, health hazards, and inefficient recycling. Manual waste sorting is error-prone and labor-intensive.
This project presents an intelligent Garbage Classifier for Waste Management using Deep Learning techniques. The system employs:
- YOLOv8 for detecting and segmenting garbage objects
- MobileNetV2 for refined classification into six categories
- Gradio for a user-friendly web interface with real-time predictions
The expected outcome is a reliable and scalable solution that can support smart cities, recycling plants, and households in effective waste segregation, thereby promoting environmental sustainability.
| Feature | Description |
|---|---|
| π― Instance Segmentation | Precise pixel-level detection of garbage objects |
| π 6-Class Classification | Biological, Cardboard, Glass, Metal, Paper, Plastic |
| π Web Interface | User-friendly Gradio app for image uploads |
| π Visual Analytics | Pie charts showing garbage distribution |
| β‘ Real-time Processing | Fast inference on CPU/GPU |
| π§ Adjustable Confidence | Configurable detection threshold |
| Category | Technologies |
| Deep Learning | PyTorch, YOLOv8 (Ultralytics), MobileNetV2 |
| Computer Vision | OpenCV, PIL/Pillow |
| Web Interface | Gradio |
| Visualization | Matplotlib, NumPy |
| Data Source | Roboflow |
| Property | Details |
|---|---|
| Source | Roboflow Universe |
| Total Images | 481 |
| Annotation Format | YOLOv8 Segmentation |
| Image Size | 640Γ640 (resized) |
| License | CC BY 4.0 |
| Class | Description | Color |
|---|---|---|
| π’ Biological | Food waste, organic matter | Green |
| π€ Cardboard | Boxes, packaging | Brown |
| π΅ Glass | Bottles, jars | Blue |
| βͺ Metal | Cans, foils | Gray |
| π‘ Paper | Documents, newspapers | Yellow |
| π΄ Plastic | Bottles, bags, containers | Red |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β INPUT IMAGE β
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β YOLOv8 SEGMENTATION MODEL β
β β’ Object Detection (Bounding Boxes) β
β β’ Instance Segmentation (Pixel Masks) β
β β’ Primary Classification β
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β OPTIONAL: MobileNetV2 CLASSIFIER β
β β’ Refined classification on cropped regions β
β β’ Higher accuracy for ambiguous cases β
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β GRADIO INTERFACE β
β β’ Annotated image with masks & labels β
β β’ Pie chart distribution β
β β’ Detection summary β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Python 3.8 or higher
- pip package manager
- (Optional) CUDA-compatible GPU for faster inference
# Clone the repository
git clone https://github.com/YOUR_USERNAME/garbage-segmentation-app.git
cd garbage-segmentation-app
# Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtDownload the trained model weights and place in weights/ directory:
# Create weights directory
mkdir -p weights
# Download best.pt (link will be provided/you can train your own)
# Place the file as: weights/best.ptNote: Model weights (~90MB) are not included in the repository due to size. See
weights/README.mdfor download instructions.
python app.pyThen open your browser to http://127.0.0.1:7860
# Create public shareable link
python app.py --share
# Custom port
python app.py --port 8080
# Custom host
python app.py --host 0.0.0.0from models import GarbageSegmentor
# Initialize model
segmentor = GarbageSegmentor()
# Run inference
results = segmentor.predict("path/to/image.jpg")
# Get annotated image
annotated = segmentor.visualize(results)
# Get detection summary
summary = segmentor.get_detection_summary("path/to/image.jpg")
print(f"Total objects: {summary['total_detections']}")
print(f"Classes: {summary['class_counts']}")| Metric | Value |
|---|---|
| Model | YOLOv8 Segmentation |
| Epochs | 100+ |
| Image Size | 640Γ640 |
| Batch Size | 16 |
Minor Project | 5th Semester | BTech (Hons.) CSE - Artificial Intelligence
University Teaching Department (UTD), CSVTU Bhilai
Group Number: 09
| Team Member | Contributions |
| Abhay Singh Sisoodiya | Model Development, Deployment (Gradio Web Interface) |
| Abhinav Anand | Data Collection (Roboflow Dataset), Documentation & Testing |
| Aditya Verma | Utilities (Preprocessing & Visualization), Deployment, Presentation |
| Anshul Yadav | Integration (Inference Pipeline) |
| Aman Banajre | Documentation & Testing (Report, README, Testing) |
| Harsh Kumar Chandrakar | Data Collection, Model Development, Integration |
garbage-segmentation-app/
βββ app.py # Entry point for Gradio app
βββ requirements.txt # Python dependencies
βββ .gitignore
βββ LICENSE
βββ README.md
β
βββ models/ # Core model code
β βββ __init__.py
β βββ yolo_segmentation.py
β βββ mobilenet_classifier.py
β βββ inference.py
β βββ gradio_app.py
β βββ utils/
β βββ preprocessing.py
β βββ visualization.py
β
βββ weights/ # Model weights (download separately)
β βββ README.md
β
βββ results/ # Training metrics & curves
β βββ confusion_matrix.png
β βββ results.png
β βββ ...
β
βββ data/ # Dataset documentation
β βββ README.md
β
βββ docs/ # Documentation
β βββ screenshots/
β
βββ notebooks/ # Jupyter notebooks
- Ultralytics - YOLOv8 framework
- Roboflow - Dataset hosting and annotation tools
- Gradio - Web interface framework
- CSVTU Bhilai - University Teaching Department
This project is licensed under the MIT License - see the LICENSE file for details.
π± Supporting UN SDG 11: Sustainable Cities and Communities
Made with β€οΈ by Group 09 | UTD CSVTU Bhilai


