Image Classification
Keras
PyTorch
object-detection
waste-classification
recycling
mobilenet
yolov8
tensorflow
Instructions to use SabaTariq510/waste-classification-models with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use SabaTariq510/waste-classification-models with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://SabaTariq510/waste-classification-models") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- image-classification
|
| 5 |
+
- object-detection
|
| 6 |
+
- waste-classification
|
| 7 |
+
- recycling
|
| 8 |
+
- mobilenet
|
| 9 |
+
- yolov8
|
| 10 |
+
- tensorflow
|
| 11 |
+
- pytorch
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Smart Waste Classification Models
|
| 15 |
+
|
| 16 |
+
Is repository mein 2 trained models hain jo waste (kachra) images ko classify karne ke liye use hote hain. Dono models ek Flask/Gradio app mein integrate kiye gaye hain jahan user apni marzi se koi bhi ek model select kar sakta hai.
|
| 17 |
+
|
| 18 |
+
## Models
|
| 19 |
+
|
| 20 |
+
### 1. `best_mobilenet.keras` — MobileNetV2 (Image Classification)
|
| 21 |
+
|
| 22 |
+
- **Task:** Whole-image classification (5 classes)
|
| 23 |
+
- **Framework:** TensorFlow / Keras
|
| 24 |
+
- **Input size:** 224x224 RGB image
|
| 25 |
+
- **Classes:**
|
| 26 |
+
- cardboard
|
| 27 |
+
- glass
|
| 28 |
+
- metal
|
| 29 |
+
- paper
|
| 30 |
+
- plastic
|
| 31 |
+
- trash
|
| 32 |
+
|
| 33 |
+
Ye model poori image ko dekh kar batata hai ke image mein sabse zyada kis waste category ka material hai. Har class ke liye ek confidence score bhi milta hai.
|
| 34 |
+
|
| 35 |
+
### 2. `bestyolomodel.pt` — YOLOv8 (Object Detection)
|
| 36 |
+
|
| 37 |
+
- **Task:** Object detection (3 classes)
|
| 38 |
+
- **Framework:** Ultralytics YOLOv8 / PyTorch
|
| 39 |
+
- **Classes:** 3 waste categories (bounding-box ke sath localization)
|
| 40 |
+
|
| 41 |
+
Ye model image ke andar waste object ko detect karta hai aur uske around bounding box + class + confidence deta hai. MobileNet ke muqable ye batata hai ke object **kahan** hai, sirf ye nahi ke image mein kya hai.
|
| 42 |
+
|
| 43 |
+
## Recyclability Mapping
|
| 44 |
+
|
| 45 |
+
Dono models ke output ko is mapping ke zariye Recyclable / Non-Recyclable mein convert kiya jata hai:
|
| 46 |
+
|
| 47 |
+
| Class | Status |
|
| 48 |
+
|------------|----------------|
|
| 49 |
+
| cardboard | Recyclable |
|
| 50 |
+
| glass | Recyclable |
|
| 51 |
+
| metal | Recyclable |
|
| 52 |
+
| paper | Recyclable |
|
| 53 |
+
| plastic | Recyclable |
|
| 54 |
+
| trash | Non-Recyclable |
|
| 55 |
+
|
| 56 |
+
## Usage
|
| 57 |
+
|
| 58 |
+
```python
|
| 59 |
+
from huggingface_hub import hf_hub_download
|
| 60 |
+
from tensorflow.keras.models import load_model
|
| 61 |
+
from ultralytics import YOLO
|
| 62 |
+
|
| 63 |
+
REPO_ID = "SabaTariq510/waste-classification-models"
|
| 64 |
+
|
| 65 |
+
# MobileNetV2
|
| 66 |
+
mobilenet_path = hf_hub_download(repo_id=REPO_ID, filename="best_mobilenet.keras")
|
| 67 |
+
mobilenet_model = load_model(mobilenet_path)
|
| 68 |
+
|
| 69 |
+
# YOLOv8
|
| 70 |
+
yolo_path = hf_hub_download(repo_id=REPO_ID, filename="bestyolomodel.pt")
|
| 71 |
+
yolo_model = YOLO(yolo_path, task="detect")
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
## App
|
| 75 |
+
|
| 76 |
+
Ye models ek Gradio app mein deploy kiye gaye hain jahan user image upload kar ke MobileNetV2 ya YOLOv8 mein se koi bhi model select kar sakta hai prediction ke liye.
|