Image Classification
Keras
LiteRT
English
computer-vision
waste-management
mobilenetv2
sustainability
Instructions to use tahzaya/trash-sorter-ai with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use tahzaya/trash-sorter-ai with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://tahzaya/trash-sorter-ai") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
tags:
|
| 5 |
+
- computer-vision
|
| 6 |
+
- image-classification
|
| 7 |
+
- waste-management
|
| 8 |
+
- mobilenetv2
|
| 9 |
+
- sustainability
|
| 10 |
+
datasets:
|
| 11 |
+
- waste-classification-data
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# 🗑️ Trash Sorter AI
|
| 15 |
+
|
| 16 |
+
Classifies waste as **Organic** or **Recyclable** with 93.37% accuracy.
|
| 17 |
+
|
| 18 |
+
## Quick Start
|
| 19 |
+
|
| 20 |
+
```python
|
| 21 |
+
# 1. Install
|
| 22 |
+
!pip install tensorflow
|
| 23 |
+
|
| 24 |
+
# 2. Load model
|
| 25 |
+
from huggingface_hub import hf_hub_download
|
| 26 |
+
from tensorflow import keras
|
| 27 |
+
|
| 28 |
+
model_path = hf_hub_download(
|
| 29 |
+
repo_id="tahazyan/trash-sorter-ai",
|
| 30 |
+
filename="trash_sorter.keras"
|
| 31 |
+
)
|
| 32 |
+
model = keras.models.load_model(model_path)
|
| 33 |
+
|
| 34 |
+
# 3. Use
|
| 35 |
+
import cv2
|
| 36 |
+
import numpy as np
|
| 37 |
+
|
| 38 |
+
def classify_waste(image_path):
|
| 39 |
+
img = cv2.imread(image_path)
|
| 40 |
+
img = cv2.resize(img, (224, 224))
|
| 41 |
+
img = img / 255.0
|
| 42 |
+
img = np.expand_dims(img, axis=0)
|
| 43 |
+
|
| 44 |
+
prediction = model.predict(img)[0]
|
| 45 |
+
classes = ["Organic", "Recyclable"]
|
| 46 |
+
return classes[np.argmax(prediction)]
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
## Model Details
|
| 50 |
+
|
| 51 |
+
**Architecture:** MobileNetV2 + Custom layers
|
| 52 |
+
**Input:** 224×224 RGB images
|
| 53 |
+
**Output:** 2 classes (Organic, Recyclable)
|
| 54 |
+
**Accuracy:** 93.37% on validation set
|
| 55 |
+
**Training data:** 22,564 images
|
| 56 |
+
**Training time:** ~6 hours on Colab GPU
|
| 57 |
+
|
| 58 |
+
## Example Results
|
| 59 |
+
|
| 60 |
+
| Organic Waste | Recyclable Waste |
|
| 61 |
+
|--------------|------------------|
|
| 62 |
+
| Food scraps | Plastic bottles |
|
| 63 |
+
| Yard waste | Glass jars |
|
| 64 |
+
| Paper towels | Aluminum cans |
|
| 65 |
+
|
| 66 |
+
## About the Creator
|
| 67 |
+
|
| 68 |
+
This model was created as part of an AI waste management project to help reduce improper waste disposal.
|
| 69 |
+
|
| 70 |
+
## License
|
| 71 |
+
|
| 72 |
+
Apache 2.0 - Free for personal and commercial use.
|