This project is an image classification system that looks at a photo of waste and tells you exactly what kind of garbage it is: cardboard, glass, metal, paper, plastic, or general trash.
The model is built on top of EfficientNetB0 (pre-trained on ImageNet) using transfer learning — meaning instead of training from scratch, we fine-tuned a model that already understands visual features, then taught it to recognize waste categories. It ships with a Gradio web interface so anyone can upload a photo and get a classification instantly, no code required.
Waste misclassification is a real problem at scale. When people throw plastic into cardboard bins or glass into general trash, it contaminates entire recycling batches and sends recoverable material to landfill. An automated classifier like this can be integrated into smart bin systems, conveyor-belt sorting lines, or mobile apps to catch misclassification at the point of disposal — not after contamination has already happened.
The internship this was built for (Edunet Foundation / Shell India / AICTE) specifically targeted this problem, and the model achieved 94% inference accuracy on a custom dataset of 5,500+ images after pipeline optimization.
| Parameter | Value |
|---|---|
| Architecture | EfficientNetB0 |
| Training strategy | Transfer Learning (ImageNet weights) |
| Test accuracy | 89.24% (public dataset) / 94% (internship dataset) |
| Output classes | Cardboard, Glass, Metal, Paper, Plastic, Trash |
| Input size | 124 × 124 px |
| Regularization | Dropout (0.2), Global Average Pooling |
| Optimizer | Adam |
- Python 3.8+
- TensorFlow 2.x
- Gradio, NumPy, Pillow
git clone https://github.com/Rakeshgr962/GarbageClassfication.git
cd GarbageClassfication
pip install tensorflow gradio numpy Pillowpython app.pyOpen the URL printed in the terminal (usually http://127.0.0.1:7860). Drop in any image of waste and the model returns a ranked probability for each of the 6 categories.
import tensorflow as tf
import numpy as np
from PIL import Image
model = tf.keras.models.load_model("EfficientNetB0.keras")
class_names = ['cardboard', 'glass', 'metal', 'paper', 'plastic', 'trash']
img = Image.open("your_image.jpg").resize((124, 124))
img_array = np.expand_dims(np.array(img) / 255.0, axis=0)
predictions = model.predict(img_array)[0]
top_class = class_names[np.argmax(predictions)]
confidence = predictions.max() * 100
print(f"{top_class} ({confidence:.1f}% confidence)")GarbageClassfication/
├── app.py # Gradio web interface — run this to use the model
├── FinalSave.ipynb # Full training notebook: data loading, augmentation,
│ # model fine-tuning, evaluation, and confusion matrix
├── EfficientNetB0.keras # Saved trained model weights
└── README.md
Open FinalSave.ipynb in Jupyter. The notebook walks through:
- Loading and splitting the dataset
- Applying augmentation (horizontal flip, zoom, rotation)
- Building the EfficientNetB0 transfer learning head
- Training with early stopping
- Evaluating with accuracy/loss curves and a full confusion matrix
MIT — see LICENSE.