A deep learning-based web application that classifies different types of waste materials using computer vision. The system helps in proper waste segregation by identifying whether an item belongs to categories like cardboard, glass, metal, paper, plastic, or trash.
- π Real-time waste classification using deep learning
- π Web-based user interface for easy interaction
- πΈ Support for common image formats (PNG, JPG, JPEG)
- β‘ Instant classification results with visual feedback
The waste classification model is built using transfer learning with MobileNetV2 as the base model:
- ποΈ Base Model: Pre-trained MobileNetV2 on ImageNet
- π Fine-tuning: Last 50 layers unfrozen for training
- β Additional Layers:
βββ Global Average Pooling βββ Dense Layer (128 units, ReLU) βββ Dropout (0.6) βββ Output Layer (6 units, Softmax)
- πΌοΈ Input Image Size: 128x128 pixels
- π¦ Batch Size: 32
- π― Training Strategy:
βββ Data augmentation (rotation, shift, shear, zoom, flip) βββ Learning rate scheduling with exponential decay βββ L2 regularization βββ Class weight balancing
- π Training Results:
waste_management/
βββ π app.py # Flask application
βββ π οΈ utils.py # Utility functions
βββ π WASTE_MANAGEMENT.ipynb # Model training notebook
βββ π static/
β βββ π¨ css/
β β βββ style.css # Custom styling
β βββ π€ uploads/ # Image upload directory
βββ π templates/
βββ π index.html # Home page
βββ π result.html # Results page
dataset-resized/
βββ π¦ cardboard/ β 403 images β ββββββββββββββββββ β 15.7%
βββ π glass/ β 501 images β ββββββββββββββββββ β 19.5%
βββ βοΈ metal/ β 410 images β ββββββββββββββββββ β 15.9%
βββ π paper/ β 594 images β ββββββββββββββββββ β 23.1%
βββ π·οΈ plastic/ β 482 images β ββββββββββββββββββ β 18.7%
βββ ποΈ trash/ β 182 images β ββββββββββββββββββ β 7.1%
π From Kaggle:
- Visit TrashNet Dataset
- Click 'Download' button
- Extract the downloaded archive
- Clone the repository:
git clone <repository-url>
cd waste_management
- Install dependencies:
pip install -r requirements.txt
- Run the application:
python app.py
- Open your browser and navigate to
http://localhost:5000
- π Access the web interface through your browser
- π€ Upload an image of the waste item you want to classify
- β¨ Click submit to get the classification result
- π View the predicted category and confidence score
The model was trained using transfer learning on MobileNetV2:
-
π₯ Data Preparation:
βββ Dataset split: 80% training, 20% validation βββ Image resizing to 128x128 pixels βββ Data augmentation for better generalization
-
βοΈ Training Configuration:
βββ Optimizer: Adam with learning rate scheduling βββ Loss function: Categorical Cross-entropy βββ Metrics: Accuracy βββ Epochs: 50
-
π― Performance Optimization:
βββ Dropout for reducing overfitting βββ L2 regularization βββ Class weight balancing
Feel free to submit issues, fork the repository, and create pull requests for any improvements.
This project is licensed under the MIT License