Spaces:
Runtime error
Runtime error
metadata
title: MAE Waste Classifier
emoji: ποΈ
colorFrom: green
colorTo: blue
sdk: gradio
sdk_version: 4.44.0
app_file: app.py
pinned: false
license: mit
models:
- ysfad/mae-waste-classifier
datasets:
- garythung/trashnet
tags:
- computer-vision
- image-classification
- waste-management
- recycling
- mae
- vision-transformer
- environmental
ποΈ MAE Waste Classification System
An intelligent waste classification system using a finetuned MAE (Masked Autoencoder) ViT-Base model that achieves 93.27% validation accuracy on 9 waste categories.
π― Features
- High Accuracy: 93.27% validation accuracy on waste classification
- Fast Inference: Optimized ViT-Base architecture for real-time classification
- Comprehensive: Covers 9 major waste categories
- Smart Instructions: Provides specific disposal instructions for each item
- Modern UI: Clean, intuitive Gradio interface
π Model Performance
- Architecture: Vision Transformer (ViT-Base) with MAE pretraining
- Training Data: RealWaste dataset (4,752 images)
- Validation Accuracy: 93.27%
- Training Accuracy: 99.89%
- Parameters: 86M parameters
- Preprocessing: MAE-style image preprocessing
π Waste Categories
The model can classify the following 9 waste categories:
- Cardboard - Recyclable paper-based packaging
- Food Organics - Compostable food waste
- Glass - Recyclable glass containers
- Metal - Recyclable metal items (cans, foil)
- Miscellaneous Trash - General non-recyclable waste
- Paper - Recyclable paper products
- Plastic - Various plastic items
- Textile Trash - Fabric and clothing waste
- Vegetation - Organic plant matter
π¬ Technical Details
Model Architecture
- Base Model: Vision Transformer (ViT-Base/16)
- Pretraining: MAE (Masked Autoencoder) self-supervised learning
- Finetuning: Supervised classification on RealWaste dataset
- Input Size: 224x224 pixels
- Patch Size: 16x16 pixels
Training Process
- Pretraining: MAE self-supervised learning on ImageNet
- Finetuning: Classification head training on RealWaste dataset
- Optimization: AdamW optimizer with learning rate scheduling
- Data Augmentation: Standard vision transforms
Performance Metrics
- Validation Accuracy: 93.27%
- Training Accuracy: 99.89%
- Training Time: ~15 epochs
- Hardware: NVIDIA RTX 3080 Ti
π Usage
Online Demo
Simply upload an image of a waste item to get:
- Classification with confidence score
- Disposal instructions for proper waste management
- Top-k predictions with detailed breakdown
Model Access
The trained model is available on Hugging Face Hub:
- Model: ysfad/mae-waste-classifier
- Format: PyTorch checkpoint
- Size: ~1GB
Local Usage
from mae_waste_classifier import MAEWasteClassifier
# Load model from HF Hub
classifier = MAEWasteClassifier(hf_model_id="ysfad/mae-waste-classifier")
# Classify image
result = classifier.classify_image("path/to/image.jpg")
print(f"Predicted: {result['predicted_class']} ({result['confidence']:.3f})")
π Environmental Impact
This system supports sustainable waste management by:
- Reducing contamination in recycling streams
- Educating users about proper disposal methods
- Improving sorting accuracy in waste facilities
- Promoting recycling awareness
π Dataset
Trained on the RealWaste dataset:
- Total Images: 4,752
- Training Split: 3,801 images (80%)
- Validation Split: 951 images (20%)
- Categories: 9 waste types
- Quality: High-resolution real-world images
π§ Technical Requirements
- Python: 3.8+
- PyTorch: 2.0+
- Transformers: Latest
- Gradio: 4.44.0+
- PIL: Image processing
- NumPy: Numerical operations
π License
This project is licensed under the MIT License. See the model repository for more details.
π€ Contributing
Contributions are welcome! Areas for improvement:
- Additional waste categories
- Multi-language support
- Mobile optimization
- Integration with IoT devices
π Contact
For questions or collaboration opportunities, please reach out through the Hugging Face model repository.
π± Built for a sustainable future through AI-powered waste management