This repository contains a Computer Vision project to classify waste images into "Recyclable" or "Household Waste." It employs transfer learning with MobileNetV2 and a custom-built pipeline for preprocessing, training, evaluation, and deployment.
- Overview
- Dataset
- Exploratory Data Analysis (EDA)
- Model Development
- Training and Evaluation
- Deployment
- Usage
- Files in Repository
- Future Work
This project aims to automate waste sorting by classifying images into two categories:
- Recyclable
- Household Waste
Key highlights:
- Comprehensive EDA for dataset understanding.
- Transfer learning with MobileNetV2.
- Deployment using Streamlit for user-friendly interaction.
The Recycling dataset consists of images for machine learning classification, that were divided into two categories:
- Recyclable: Aluminum cans, glass bottles, etc.
- Household Waste: Food waste, plastic straws, etc.
The dataset was split into:
- Training: 70%
- Validation: 15%
- Test: 15%
Images were preprocessed with unique names to avoid duplication and ensure consistency.
- Conducted using custom scripts in
eda_utils.py. - Key analyses include:
- Image size and format.
- Dataset distribution by categories.
A custom Convolutional Neural Network (CNN) was built to establish a baseline for classification performance.
- Architecture: MobileNetV2 pre-trained on ImageNet.
The models were trained and evaluated with:
- Metrics: Accuracy, loss, precision, recall, and F1-score.
- Regularization: learning rate scheduling.
- Callbacks: Early stopping and model checkpoints.
The model is deployed using Streamlit:
- Interface: Upload an image and classify it as "Recyclable" or "Household Waste."
- Backend: Uses a saved Keras model (
best_mobilenet_model.keras) for inference.
# Install dependencies
pip install -r requirements.txt
# Run the app
streamlit run app.pyRun the notebook MyTemplate.ipynb to train and evaluate models:
- Edit paths to match your dataset structure.
- Experiment with different augmentation and transfer learning techniques.
Upload an image to the Streamlit app and receive a prediction with confidence.
| File | Description |
|---|---|
requirements.txt |
List of Python dependencies required for the project.. |
RecyclingClassifier.ipynb |
Notebook for experimenting with the extended dataset. |
eda_utils.py |
Utility functions for EDA and dataset analysis. |
utils.py |
Helper functions for organizing images and assigning unique names. |
app.py |
Streamlit application for deploying the classification model. |
best_mobilenet_model.keras |
Pre-trained MobileNetV2 model saved after fine-tuning. |
RecyclingClassification.pdf |
Presentation detailing the project details and conclusions. |
- Model Optimization: Test alternative architectures like ResNet or EfficientNet.
- Augmentation: Applied transformations like rotation, zoom, and flipping to improve generalization.
- Fine-tuning: Enabled training on specific layers to adapt MobileNetV2 to the dataset.
- Data Expansion: Incorporate more waste categories and diverse images.
- Deployment: Extend deployment to cloud platforms (e.g., AWS, Google Cloud).
