WasteAI β€” Deep Learning-Based Waste Classification

WasteAI is an academic deep-learning project that classifies waste images into six categories using four convolutional neural network architectures.

The repository contains four trained Keras models, allowing developers and researchers to explore image classification, compare model performance and experiment with waste-category recognition.

Project Overview

WasteAI explores automated waste classification using computer vision and deep learning. It compares a custom CNN architecture with three transfer-learning architectures and provides a common evaluation workflow.

Project links:

Supported Waste Categories

The models classify images into six categories:

  1. Cardboard
  2. Glass
  3. Metal
  4. Paper
  5. Plastic
  6. Trash

The class-index mapping is:

Class Index
Cardboard 0
Glass 1
Metal 2
Paper 3
Plastic 4
Trash 5

Available Models

Four trained models are hosted in this repository.

Model Filename Test Accuracy
Custom CNN cnn_model.keras 73.09%
MobileNetV2 mobilenetv2_model.keras 87.07%
VGG16 vgg16_model.keras 88.65%
VGG19 vgg19_model.keras 91.29%

All models use 224 Γ— 224 RGB image inputs.

Model Evaluation

The models were evaluated on the same held-out test split from the Garbage Classification dataset.

Model Accuracy Macro Precision Macro Recall Macro F1
VGG19 91.29% 90.43% 89.76% 89.93%
VGG16 88.65% 87.58% 88.14% 87.69%
MobileNetV2 87.07% 87.29% 85.67% 86.01%
Custom CNN 73.09% 70.27% 72.12% 69.62%

VGG19 achieved the highest recorded test accuracy, while MobileNetV2 provides a smaller model with a competitive result.

These metrics describe the project's held-out test set. They are not guarantees of performance on unseen real-world waste images.

Dataset

The project uses the Garbage Classification dataset on Kaggle.

The Stage 2 dataset split contains:

Dataset Split Number of Images
Training 1,768
Validation 379
Testing 379
Total 2,526

Dataset configuration:

  • Image dimensions: 224 Γ— 224 pixels
  • Color channels: RGB
  • Random seed: 42
  • Training split: 70%
  • Validation split: 15%
  • Testing split: 15%

The original dataset is not included in this repository.

Image Preprocessing

All models use RGB images resized to 224 Γ— 224 pixels.

The training pipeline first converts images to floating-point values and divides pixel values by 255. Architecture-specific preprocessing is then applied.

Model Preprocessing
Custom CNN Pixel values scaled to [0, 1]
MobileNetV2 Keras MobileNetV2 preprocess_input
VGG16 Keras VGG16 preprocess_input
VGG19 Keras VGG19 preprocess_input

For MobileNetV2, VGG16 and VGG19, the common normalized tensor is multiplied by 255 before applying the corresponding Keras preprocessing function.

Important: Use the preprocessing associated with the selected model. Applying the wrong normalization can significantly affect predictions.

Loading a Model

Install the required libraries:

pip install tensorflow keras huggingface_hub pillow numpy

Example: download and load the VGG19 model.

import tensorflow as tf
from huggingface_hub import hf_hub_download

MODEL_REPO = "Atchyuteswar/wasteai-models"

model_path = hf_hub_download(
    repo_id=MODEL_REPO,
    filename="vgg19_model.keras"
)

model = tf.keras.models.load_model(
    model_path,
    compile=False
)

print("VGG19 model loaded successfully!")

To load another architecture, change the filename to one of:

  • cnn_model.keras
  • mobilenetv2_model.keras
  • vgg16_model.keras
  • vgg19_model.keras

Technology Stack

  • Python 3.11
  • TensorFlow 2.21.0
  • Keras 3.13.2
  • NumPy
  • Pillow
  • scikit-learn
  • Hugging Face Hub
  • Streamlit

Intended Use

These models are intended for:

  • Educational and academic research.
  • Experimentation with image classification.
  • Comparing convolutional neural network architectures.
  • Exploring computer-vision applications for waste classification.
  • Developing experimental waste-recognition applications.

Limitations and Responsible Use

WasteAI is an academic research prototype and is not a certified waste-management or recycling system.

The models predict one of six dataset categories. They do not determine exact material composition, contamination, plastic resin type or whether an item is recyclable under local rules.

Model scores are outputs of the classification model and should not be interpreted as calibrated probabilities of correctness.

Performance on the held-out dataset may not generalize to different environments, lighting conditions, camera types or real-world waste streams.

Project Information

Project: WasteAI
Version: 1.0.0
Category: Computer Vision / Deep Learning
Developer: Atchyuteswar Gottumukkala

Related repositories:


WasteAI β€” Exploring smarter waste recognition through deep learning.

Downloads last month
136
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support