ysfad commited on
Commit
2d47b82
Β·
verified Β·
1 Parent(s): 18b5f98

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +151 -12
README.md CHANGED
@@ -1,12 +1,151 @@
1
- ---
2
- title: Mae Waste Classifier Demo
3
- emoji: 😻
4
- colorFrom: purple
5
- colorTo: gray
6
- sdk: gradio
7
- sdk_version: 5.35.0
8
- app_file: app.py
9
- pinned: false
10
- ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: MAE Waste Classifier
3
+ emoji: πŸ—‚οΈ
4
+ colorFrom: green
5
+ colorTo: blue
6
+ sdk: gradio
7
+ sdk_version: 4.44.0
8
+ app_file: app.py
9
+ pinned: false
10
+ license: mit
11
+ models:
12
+ - ysfad/mae-waste-classifier
13
+ datasets:
14
+ - garythung/trashnet
15
+ tags:
16
+ - computer-vision
17
+ - image-classification
18
+ - waste-management
19
+ - recycling
20
+ - mae
21
+ - vision-transformer
22
+ - environmental
23
+ ---
24
+
25
+ # πŸ—‚οΈ MAE Waste Classification System
26
+
27
+ An intelligent waste classification system using a **finetuned MAE (Masked Autoencoder) ViT-Base model** that achieves **93.27% validation accuracy** on 9 waste categories.
28
+
29
+ ## 🎯 Features
30
+
31
+ - **High Accuracy**: 93.27% validation accuracy on waste classification
32
+ - **Fast Inference**: Optimized ViT-Base architecture for real-time classification
33
+ - **Comprehensive**: Covers 9 major waste categories
34
+ - **Smart Instructions**: Provides specific disposal instructions for each item
35
+ - **Modern UI**: Clean, intuitive Gradio interface
36
+
37
+ ## πŸ† Model Performance
38
+
39
+ - **Architecture**: Vision Transformer (ViT-Base) with MAE pretraining
40
+ - **Training Data**: RealWaste dataset (4,752 images)
41
+ - **Validation Accuracy**: 93.27%
42
+ - **Training Accuracy**: 99.89%
43
+ - **Parameters**: 86M parameters
44
+ - **Preprocessing**: MAE-style image preprocessing
45
+
46
+ ## πŸ“Š Waste Categories
47
+
48
+ The model can classify the following 9 waste categories:
49
+
50
+ 1. **Cardboard** - Recyclable paper-based packaging
51
+ 2. **Food Organics** - Compostable food waste
52
+ 3. **Glass** - Recyclable glass containers
53
+ 4. **Metal** - Recyclable metal items (cans, foil)
54
+ 5. **Miscellaneous Trash** - General non-recyclable waste
55
+ 6. **Paper** - Recyclable paper products
56
+ 7. **Plastic** - Various plastic items
57
+ 8. **Textile Trash** - Fabric and clothing waste
58
+ 9. **Vegetation** - Organic plant matter
59
+
60
+ ## πŸ”¬ Technical Details
61
+
62
+ ### Model Architecture
63
+ - **Base Model**: Vision Transformer (ViT-Base/16)
64
+ - **Pretraining**: MAE (Masked Autoencoder) self-supervised learning
65
+ - **Finetuning**: Supervised classification on RealWaste dataset
66
+ - **Input Size**: 224x224 pixels
67
+ - **Patch Size**: 16x16 pixels
68
+
69
+ ### Training Process
70
+ 1. **Pretraining**: MAE self-supervised learning on ImageNet
71
+ 2. **Finetuning**: Classification head training on RealWaste dataset
72
+ 3. **Optimization**: AdamW optimizer with learning rate scheduling
73
+ 4. **Data Augmentation**: Standard vision transforms
74
+
75
+ ### Performance Metrics
76
+ - **Validation Accuracy**: 93.27%
77
+ - **Training Accuracy**: 99.89%
78
+ - **Training Time**: ~15 epochs
79
+ - **Hardware**: NVIDIA RTX 3080 Ti
80
+
81
+ ## πŸš€ Usage
82
+
83
+ ### Online Demo
84
+ Simply upload an image of a waste item to get:
85
+ - **Classification** with confidence score
86
+ - **Disposal instructions** for proper waste management
87
+ - **Top-k predictions** with detailed breakdown
88
+
89
+ ### Model Access
90
+ The trained model is available on Hugging Face Hub:
91
+ - **Model**: [ysfad/mae-waste-classifier](https://huggingface.co/ysfad/mae-waste-classifier)
92
+ - **Format**: PyTorch checkpoint
93
+ - **Size**: ~1GB
94
+
95
+ ### Local Usage
96
+ ```python
97
+ from mae_waste_classifier import MAEWasteClassifier
98
+
99
+ # Load model from HF Hub
100
+ classifier = MAEWasteClassifier(hf_model_id="ysfad/mae-waste-classifier")
101
+
102
+ # Classify image
103
+ result = classifier.classify_image("path/to/image.jpg")
104
+ print(f"Predicted: {result['predicted_class']} ({result['confidence']:.3f})")
105
+ ```
106
+
107
+ ## 🌍 Environmental Impact
108
+
109
+ This system supports sustainable waste management by:
110
+ - **Reducing contamination** in recycling streams
111
+ - **Educating users** about proper disposal methods
112
+ - **Improving sorting accuracy** in waste facilities
113
+ - **Promoting recycling** awareness
114
+
115
+ ## πŸ“ˆ Dataset
116
+
117
+ Trained on the **RealWaste** dataset:
118
+ - **Total Images**: 4,752
119
+ - **Training Split**: 3,801 images (80%)
120
+ - **Validation Split**: 951 images (20%)
121
+ - **Categories**: 9 waste types
122
+ - **Quality**: High-resolution real-world images
123
+
124
+ ## πŸ”§ Technical Requirements
125
+
126
+ - **Python**: 3.8+
127
+ - **PyTorch**: 2.0+
128
+ - **Transformers**: Latest
129
+ - **Gradio**: 4.44.0+
130
+ - **PIL**: Image processing
131
+ - **NumPy**: Numerical operations
132
+
133
+ ## πŸ“ License
134
+
135
+ This project is licensed under the MIT License. See the model repository for more details.
136
+
137
+ ## 🀝 Contributing
138
+
139
+ Contributions are welcome! Areas for improvement:
140
+ - Additional waste categories
141
+ - Multi-language support
142
+ - Mobile optimization
143
+ - Integration with IoT devices
144
+
145
+ ## πŸ“ž Contact
146
+
147
+ For questions or collaboration opportunities, please reach out through the Hugging Face model repository.
148
+
149
+ ---
150
+
151
+ **🌱 Built for a sustainable future through AI-powered waste management**