Skip to content

Repository files navigation

🌍 AI-Based Smart Waste Segregation System

An intelligent, state-of-the-art dual-model waste classification system that utilizes deep learning and computer vision to classify waste items from images or in real-time using a webcam.

This robust system has been completely retooled to execute simultaneous, dual-inference predictions across two unique MobileNetV2 neural networks—providing you with both a highly specific material class and a broad ecological category at a single glance.

Note: The accuracy of the waste classification may currently vary depending on lighting conditions or complex backgrounds. We are constantly improving our datasets to enhance accuracy in future updates.

✨ Key Features

  • 🚀 Dual Model Architecture: Simultaneously predicts specific material types and broad categories.
  • 💻 Multiple Interfaces: Choose between a modern UI Web Dashboard, Live YOLOv8 Webcam Tracking, or Terminal Drag-n-Drop inference.
  • Real-Time Speeds: Sub-second prediction times powered by MobileNetV2 Transfer Learning.

📸 Integrated Application Suites

1. The Smart Web Dashboard

Our sleek, glassmorphic Flask web interface allows anyone to upload pictures right from their browser and receive an instant breakdown.

Web Application Interface Modern web application calculating both metrics simultaneously.

2. Live Tracker (YOLOv8 + Dual AI)

Run the live classification script to detect waste in real-time. It uses YOLO to draw a dynamic bounding box, then crops and feeds the object into both neural networks continuously!

Live Classifier Feed Live webcam interface showing dual overlays.

3. CLI Drag & Drop Tool

A lightning fast terminal module. Drop an image into your terminal and let the engines decode it instantly.

Image Classifier Script


🤖 Model Intelligence (Dual-Architecture)

The system is powered by two distinct Convolutional Neural Networks based on MobileNetV2. We use Transfer Learning to freeze foundational layers while fine-tuning the heads across specific domains:

1. The Multiclass Material Engine

Located in multiclass_model/, this engine classifies items into 12 distinct material categories:

  • Battery, Biological, Brown Glass, Cardboard, Clothes, Green Glass, Metal, Paper, Plastic, Shoes, Trash (Miscellaneous), White Glass.

2. The Binary Categorization Engine

Located in binary_model/, this localized intelligence sorts inputs broadly to aid recycling operations:

  • ORGANIC
  • RECYCLABLE

Both models operate automatically and simultaneously across all application fronts.


🚀 Setup and Installation

Follow these instructions to set up the project on your local machine.

Step 1: Clone the Repository

git clone https://github.com/Yashraj-Jangra/waste-segregation-project.git
cd waste-segregation-project

Step 2: Create a Virtual Environment

Windows:

python -m venv venv
.\venv\Scripts\activate

macOS / Linux:

python3 -m venv venv
source venv/bin/activate

Step 3: Install Dependencies

pip install -r requirements.txt

⚙️ Usage Breakdown

> Launching the Web Application

python app.py
  • Navigate to http://localhost:5000 (or http://127.0.0.1:5000).
  • Use the modern drag-and-drop dashboard to analyze static images instantly.

> Launching the Live Webcam

python live_classifier.py
  • A window opens with your webcam feed.
  • YOLOv8 scans the feed and snaps a bounding box over central objects.
  • Both models analyze the box and hover the predictions directly above the object.
  • Press 'q' to close the window.

> Launching the Single Image CLI

Classify a static image directly from the terminal or using Drag & Drop.

python image_classifier.py
  • A prompt asks for an image path. Drag and drop .jpg or .png files natively.
  • Output is beautifully structured via a console table and an OpenCV window.

📁 Repository Structure

.
├── app.py                          # Flask web application server integrating both models
├── binary_model/                   # Home of the 2-Class Network (Organic vs Recyclable)
│   ├── DATASET/                    # Localized training imagery
│   ├── train_binary_model.py       # Standalone MobileNetV2 compiler & trainer
│   └── waste_binary_classifier_model.h5
├── image_classifier.py             # CLI Inference (Supports Drag & Drop)
├── live_classifier.py              # Webcam YOLOv8 Object Tracking
├── multiclass_model/               # Home of the primary 12-Class Network
│   ├── dataset-2/                  # Foundational bulk imagery
│   ├── prepare_model.py            # Architectural blueprints
│   ├── train_model.py              # Multiclass Model compiler & trainer
│   └── waste_classifier_model.h5
├── requirements.txt                # Essential Python packages needed to run inference
├── screenshots/                    # Documentation visual assets
├── templates/                      # Raw HTML, CSS (Glassmorphism layout) & JS files
└── uploads/                        # Temporary container for active web transmissions

Developed with Python, TensorFlow, OpenCV & Ultralytics.

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages