A deep learning model for classifying waste images into six categories using transfer learning with EfficientNetV2B2.
Built with TensorFlow & Keras and deployed via Gradio on Hugging Face Spaces.
The model can classify images into the following categories:
- ๐ฆ Cardboard
- ๐ฎ Glass
- โ๏ธ Metal
- ๐ Paper
- ๐งด Plastic
- ๐ฎ Trash
๐ Try the deployed model here: Garbage Classifier on Hugging Face
| Metric | Value |
|---|---|
| โ Accuracy | 92.97% |
| ๐ Test Loss | 0.2643 |
๐ The model performs exceptionally well on all classes except โtrashโ, which is underrepresented and visually ambiguous.
- ๐ Dataset loaded from TrashNet (resized & preprocessed)
- ๐ Data Augmentation: Flip, Zoom, Contrast, Rotation
- โ๏ธ Class balancing using computed weights
- ๐ง Model: EfficientNetV2B2 with top layers replaced
- ๐งช Training: Fine-tuned with EarlyStopping + ReduceLROnPlateau
- TensorFlow / Keras
- EfficientNetV2B2 (ImageNet pretrained)
- Gradio (web deployment)
- Hugging Face Spaces
- Python, NumPy, PIL
| Example Image | Predicted Class | Confidence |
|---|---|---|
| Plastic bottle | Plastic | 0.93 |
| Paper sheet | Paper | 0.91 |
| Metal can | Metal | 0.89 |
| Trash mix (wrong) | Paper โ | 0.61 |
โ ๏ธ Note: The โtrashโ class has lower accuracy due to fewer examples and overlap with other categories.
garbage-classification/
โโโ app.py # Gradio interface
โโโ EfficientNetV2B2_model.keras # Trained model
โโโ requirements.txt # Dependencies
โโโ README.md # This file
๐ Try the live app on Hugging Face
๐งโ๐ป Author
Made with โค๏ธ by Seona Ann Tom
๐ GitHub: @seonaann
๐ License
This project is licensed under the MIT License.
๐ Acknowledgements
Dataset inspired by TrashNet
Hugging Face for free model hosting via Spaces
Gradio for the fast, no-code interface