File size: 4,145 Bytes
9dee90b ea7435c ee65b2d 69592b1 ee65b2d 9dee90b 6205d42 2fb9eff 63c4b41 9dee90b 63c4b41 9dee90b 2fb9eff |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
---
license: apache-2.0
datasets:
- viola77data/recycling-dataset
library_name: transformers
language:
- en
base_model:
- google/siglip2-so400m-patch14-384
pipeline_tag: image-classification
tags:
- Waste
- Recycling
- Net
- '11'
- Image
- SigLIP2
---

# **Recycling-Net-11**
> **Recycling-Net-11** is an image classification model fine-tuned from **google/siglip2-base-patch16-224** using the **SiglipForImageClassification** architecture. The model classifies images into 11 categories related to recyclable materials, helping to automate and enhance waste sorting systems.
```py
Classification Report:
precision recall f1-score support
aluminium 0.9213 0.9145 0.9179 269
batteries 0.9833 0.9933 0.9883 297
cardboard 0.9660 0.9343 0.9499 274
disposable plates 0.9078 0.9744 0.9399 273
glass 0.9621 0.9490 0.9555 294
hard plastic 0.8675 0.7250 0.7899 280
paper 0.8702 0.8941 0.8820 255
paper towel 0.9333 0.9622 0.9475 291
polystyrene 0.8188 0.8385 0.8285 291
soft plastics 0.8425 0.8693 0.8557 283
takeaway cups 0.9575 0.9767 0.9670 300
accuracy 0.9128 3107
macro avg 0.9119 0.9119 0.9111 3107
weighted avg 0.9127 0.9128 0.9119 3107
```

The model categorizes images into the following classes:
- **0:** aluminium
- **1:** batteries
- **2:** cardboard
- **3:** disposable plates
- **4:** glass
- **5:** hard plastic
- **6:** paper
- **7:** paper towel
- **8:** polystyrene
- **9:** soft plastics
- **10:** takeaway cups
---
# **Run with Transformers 🤗**
```python
!pip install -q transformers torch pillow gradio
```
```python
import gradio as gr
from transformers import AutoImageProcessor, SiglipForImageClassification
from PIL import Image
import torch
# Load model and processor
model_name = "prithivMLmods/Recycling-Net-11" # Update with your actual Hugging Face model path
model = SiglipForImageClassification.from_pretrained(model_name)
processor = AutoImageProcessor.from_pretrained(model_name)
# Label mapping
id2label = {
0: "aluminium",
1: "batteries",
2: "cardboard",
3: "disposable plates",
4: "glass",
5: "hard plastic",
6: "paper",
7: "paper towel",
8: "polystyrene",
9: "soft plastics",
10: "takeaway cups"
}
def classify_recyclable_material(image):
"""Predicts the type of recyclable material in the image."""
image = Image.fromarray(image).convert("RGB")
inputs = processor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
predictions = {id2label[i]: round(probs[i], 3) for i in range(len(probs))}
return predictions
# Gradio interface
iface = gr.Interface(
fn=classify_recyclable_material,
inputs=gr.Image(type="numpy"),
outputs=gr.Label(label="Recyclable Material Prediction Scores"),
title="Recycling-Net-11",
description="Upload an image of a waste item to identify its recyclable material type."
)
# Launch the app
if __name__ == "__main__":
iface.launch()
```
---
# **Intended Use**
**Recycling-Net-11** is ideal for:
- **Smart Waste Sorting:** Automating recycling processes in smart bins or factories.
- **Environmental Awareness Tools:** Helping people learn how to sort waste correctly.
- **Municipal Waste Management:** Classifying and analyzing urban waste data.
- **Robotics:** Assisting robots in identifying and sorting materials.
- **Education:** Teaching children and communities about recyclable materials. |