Skip to content

vivekducs/garbage-classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Garbage Classification

Overview

A deep learning project for classifying household waste into six categories: cardboard, glass, metal, paper, plastic, and trash. The project uses image data organized in labeled folders and includes complete pipelines for model training, evaluation, and inference.

Repository Structure

GarbageClassification/
├── Garbage Classification.ipynb   # Main notebook: exploration, training, evaluation
├── Project Report.pdf             # Methodology, results, and conclusions
├── requirements.txt               # Python dependencies
└── GarbageClassification/         # Dataset directory
    ├── cardboard/
    ├── glass/
    ├── metal/
    ├── paper/
    ├── plastic/
    └── trash/

Requirements

  • Python 3.8+
  • pip

Install dependencies:

pip install -r requirements.txt

Usage

Run in Jupyter

  1. Open Garbage Classification.ipynb in Jupyter Notebook or JupyterLab.
  2. Execute cells in order:
    • Load and inspect the dataset
    • Preprocess and augment images
    • Define and compile the model
    • Train and evaluate
    • Plot metrics and confusion matrix

Standalone Script (Optional)

To convert the workflow into a standalone Python script, follow this pattern:

  1. Load images from GarbageClassification/ using ImageDataGenerator or tf.data.
  2. Preprocess and batch images (resize, normalize, augment).
  3. Build a CNN model or apply transfer learning (e.g., MobileNetV2, ResNet50).
  4. Train and validate using an 80/20 train/validation split.
  5. Save the trained model and report test accuracy.

Dataset

The dataset consists of labeled images of household waste, organized by class folder.

  • Split: 80% training / 20% validation (recommended)
  • Augmentation: Strongly recommended to reduce overfitting (flips, rotations, zoom, etc.)
  • Source: Kaggle – Garbage Classification

Key Files

File Description
Garbage Classification.ipynb Main workflow notebook
Project Report.pdf Full project report with results
requirements.txt Required Python packages

Reproducibility

To ensure consistent results across runs, set random seeds at the start of your notebook or script:

import os
import random
import numpy as np
import tensorflow as tf

SEED = 42
os.environ['PYTHONHASHSEED'] = str(SEED)
random.seed(SEED)
np.random.seed(SEED)
tf.random.set_seed(SEED)

About

Garbage classification system using Machine Learning and Deep Learning (Logistic Regression, ANN, CNN) to automate waste segregation into six categories. Built using Python, TensorFlow, and Scikit-learn on the Garbage Classification Dataset.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors