Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—‘οΈ Garbage Classifier for Waste Management

AI-Powered Garbage Segmentation & Classification System

Python YOLOv8 Gradio License

An intelligent waste classification system using Deep Learning for smart waste management and environmental sustainability

Application Screenshot

πŸ“‹ Table of Contents


🎯 About the Project

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.


✨ Features

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

πŸ› οΈ Tech Stack

Category Technologies
Deep Learning PyTorch, YOLOv8 (Ultralytics), MobileNetV2
Computer Vision OpenCV, PIL/Pillow
Web Interface Gradio
Visualization Matplotlib, NumPy
Data Source Roboflow

πŸ“ Dataset

Property Details
Source Roboflow Universe
Total Images 481
Annotation Format YOLOv8 Segmentation
Image Size 640Γ—640 (resized)
License CC BY 4.0

Classes (6 Categories)

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

πŸ—οΈ Model Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    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                                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Installation

Prerequisites

  • Python 3.8 or higher
  • pip package manager
  • (Optional) CUDA-compatible GPU for faster inference

Setup

# 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.txt

Download Model Weights

Download 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.pt

Note: Model weights (~90MB) are not included in the repository due to size. See weights/README.md for download instructions.


πŸ’» Usage

Launch Web Interface

python app.py

Then open your browser to http://127.0.0.1:7860

Command Line Options

# Create public shareable link
python app.py --share

# Custom port
python app.py --port 8080

# Custom host
python app.py --host 0.0.0.0

Python API

from 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']}")

πŸ“Š Results

Training Metrics

Metric Value
Model YOLOv8 Segmentation
Epochs 100+
Image Size 640Γ—640
Batch Size 16

Confusion Matrix

Confusion Matrix

Training Curves

Training Results

Sample Detections

Detection Example


πŸ‘₯ Team

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

πŸ“ Project Structure

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

πŸ™ Acknowledgments


πŸ“„ License

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

About

An intelligent waste classification system using Deep Learning for smart waste management and environmental sustainability

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages