Skip to content

A deep learning-based web application that classifies different types of waste materials using computer vision. The system helps in proper waste segregation by identifying whether an item belongs to categories like cardboard, glass, metal, paper, plastic, or trash.

Notifications You must be signed in to change notification settings

tanishq-ctrl/waste-classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—‘οΈ Waste Management Classification System

Python TensorFlow Flask License


A deep learning-based web application that classifies different types of waste materials using computer vision. The system helps in proper waste segregation by identifying whether an item belongs to categories like cardboard, glass, metal, paper, plastic, or trash.

Waste Management demo

🎯 Categories

Cardboard β€’ Glass β€’ Metal β€’ Paper β€’ Plastic β€’ Trash

✨ Features

  • πŸš€ Real-time waste classification using deep learning
  • 🌐 Web-based user interface for easy interaction
  • πŸ“Έ Support for common image formats (PNG, JPG, JPEG)
  • ⚑ Instant classification results with visual feedback

πŸ› οΈ Technology Stack

  • Backend:
    • Python
    • Flask
  • Deep Learning:
    • TensorFlow
    • Keras
  • Frontend:
    • HTML5
    • CSS3

🧠 Model Architecture

The waste classification model is built using transfer learning with MobileNetV2 as the base model:

  1. πŸ—οΈ Base Model: Pre-trained MobileNetV2 on ImageNet
  2. πŸ”„ Fine-tuning: Last 50 layers unfrozen for training
  3. βž• Additional Layers:
    β”œβ”€β”€ Global Average Pooling
    β”œβ”€β”€ Dense Layer (128 units, ReLU)
    β”œβ”€β”€ Dropout (0.6)
    └── Output Layer (6 units, Softmax)
    

πŸ“Š Model Training

  • πŸ–ΌοΈ Input Image Size: 128x128 pixels
  • πŸ“¦ Batch Size: 32
  • 🎯 Training Strategy:
    β”œβ”€β”€ Data augmentation (rotation, shift, shear, zoom, flip)
    β”œβ”€β”€ Learning rate scheduling with exponential decay
    β”œβ”€β”€ L2 regularization
    └── Class weight balancing
    
  • πŸ“ˆ Training Results:
    • Training Accuracy: 98%
    • Validation Accuracy: 75%

πŸ“ Project Structure

waste_management/
β”œβ”€β”€ 🌐 app.py                 # Flask application
β”œβ”€β”€ πŸ› οΈ utils.py              # Utility functions
β”œβ”€β”€ πŸ““ WASTE_MANAGEMENT.ipynb # Model training notebook
β”œβ”€β”€ πŸ“‚ static/
β”‚   β”œβ”€β”€ 🎨 css/
β”‚   β”‚   └── style.css        # Custom styling
β”‚   └── πŸ“€ uploads/          # Image upload directory
└── πŸ“‚ templates/
    β”œβ”€β”€ 🏠 index.html        # Home page
    └── πŸ“Š result.html       # Results page

πŸ“Έ Dataset Overview

  • Total Images: 2527 Images
  • Image Format: JPG
  • Resolution: 128x128

πŸ—‚οΈ Category Distribution

dataset-resized/
β”œβ”€β”€ πŸ“¦ cardboard/  β”‚  403 images  β”‚  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘  β”‚  15.7%
β”œβ”€β”€ πŸ” glass/      β”‚  501 images  β”‚  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘  β”‚  19.5%
β”œβ”€β”€ βš™οΈ metal/      β”‚  410 images  β”‚  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘  β”‚  15.9%
β”œβ”€β”€ πŸ“„ paper/      β”‚  594 images  β”‚  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘  β”‚  23.1%
β”œβ”€β”€ 🏷️ plastic/    β”‚  482 images  β”‚  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘  β”‚  18.7%
└── πŸ—‘οΈ trash/      β”‚  182 images  β”‚  β–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘  β”‚   7.1%

πŸ’Ύ Getting the Dataset

πŸ”„ From Kaggle:

πŸš€ Setup and Installation

  1. Clone the repository:
git clone <repository-url>
cd waste_management
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the application:
python app.py
  1. Open your browser and navigate to http://localhost:5000

πŸ“± Usage

  1. 🌐 Access the web interface through your browser
  2. πŸ“€ Upload an image of the waste item you want to classify
  3. ✨ Click submit to get the classification result
  4. πŸ“Š View the predicted category and confidence score

πŸ”¬ Model Training Process

The model was trained using transfer learning on MobileNetV2:

  1. πŸ“₯ Data Preparation:

    β”œβ”€β”€ Dataset split: 80% training, 20% validation
    β”œβ”€β”€ Image resizing to 128x128 pixels
    └── Data augmentation for better generalization
    
  2. βš™οΈ Training Configuration:

    β”œβ”€β”€ Optimizer: Adam with learning rate scheduling
    β”œβ”€β”€ Loss function: Categorical Cross-entropy
    β”œβ”€β”€ Metrics: Accuracy
    └── Epochs: 50
    
  3. 🎯 Performance Optimization:

    β”œβ”€β”€ Dropout for reducing overfitting
    β”œβ”€β”€ L2 regularization
    └── Class weight balancing
    

🏷️ Topics

🏷️ Topics

🀝 Contributing

Feel free to submit issues, fork the repository, and create pull requests for any improvements.

πŸ“„ License

This project is licensed under the MIT License


Made with ❀️ for a cleaner 🌍

About

A deep learning-based web application that classifies different types of waste materials using computer vision. The system helps in proper waste segregation by identifying whether an item belongs to categories like cardboard, glass, metal, paper, plastic, or trash.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published