Instructions to use W4ashabii/waste_classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use W4ashabii/waste_classifier with ultralytics:
from huggingface_hub import hf_hub_download from ultralytics import YOLO # pick the weights file from this repo's "Files and versions" tab weights = hf_hub_download("W4ashabii/waste_classifier", "<weights>.pt") model = YOLO(weights) source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
Waste Classifier (Bio vs Non-Bio) โ YOLOv8s-cls
A lightweight image classifier that sorts waste photos into biodegradable (Bio) and non-biodegradable (Non_Bio). It is YOLOv8s-cls fine-tuned from the COCO/ImageNet-pretrained checkpoint on the Waste_SIP_Dataset.
- Task: binary image classification
- Classes:
Bio,Non_Bio - Architecture: YOLOv8s-cls (~10 MB checkpoint)
- Input size: 224 ร 224
- Best validation top-1 accuracy: 0.96 (epoch 19 of 20)
Quick start
pip install ultralytics huggingface_hub
from huggingface_hub import hf_hub_download
from ultralytics import YOLO
weights = hf_hub_download(repo_id="W4ashabii/waste_classifier", filename="best.pt")
model = YOLO(weights)
results = model.predict("your_image.jpg", imgsz=224)
r = results[0]
print(r.names[r.probs.top1], float(r.probs.top1conf))
Batch prediction on a folder:
results = model.predict("path/to/images/", imgsz=224)
for r in results:
print(r.path, r.names[r.probs.top1], round(float(r.probs.top1conf), 3))
Results
Metrics from the validation split, using the best checkpoint (best.pt, epoch 19):
| Metric | Value |
|---|---|
| Top-1 accuracy | 0.960 |
| Final-epoch (20) top-1 accuracy | 0.955 |
| Final training loss | 0.038 |
Per-class recall (from the normalized confusion matrix):
| Class | Recall |
|---|---|
| Bio | 0.97 |
| Non_Bio | 0.95 |
Top-5 accuracy is always 1.0 because there are only two classes, so it is not informative.
Training lasted about 2.3 minutes (140 s for 20 epochs).
Note:
best.ptwas chosen by validation accuracy, so the validation numbers above are slightly optimistic. For an unbiased estimate, evaluate on the dataset's held-outtestsplit.
Training details
| Setting | Value |
|---|---|
| Base model | yolov8s-cls.pt (pretrained) |
| Framework | Ultralytics YOLOv8 |
| Epochs | 20 (early-stopping patience 5) |
| Image size | 224 |
| Batch size | 64 |
| Optimizer | AdamW |
| Initial learning rate | 1e-3, cosine schedule |
| Precision | FP16 mixed precision (AMP) |
| Hardware | NVIDIA RTX 4070 (8 GB) |
Dataset
Trained on Pramudit/Waste_SIP_Dataset, an image-folder dataset with train, validation and test splits and two classes (Bio, Non_Bio). Please refer to the dataset page for its license, collection method and class distribution.
Intended use
- Demos, teaching and prototyping of automated waste sorting
- A baseline for waste-classification research
- Starting point for further fine-tuning on your own waste images
Limitations
- Binary only. The model tells biodegradable from non-biodegradable. It does not identify material types (plastic, glass, metal, paper) and does not detect or locate objects in an image.
- Single-object assumption. It classifies the whole image, so photos with mixed waste or cluttered scenes may give unreliable results.
- Domain shift. Accuracy was measured on images from one dataset. Performance can drop with different cameras, lighting, backgrounds, or waste types that are rare in the training data.
- Not safety-critical. Do not rely on it as the sole decision-maker for real waste handling, hygiene or compliance.
License
The weights are released under AGPL-3.0, in line with the Ultralytics YOLOv8 license. The training data has its own license; check the dataset page before commercial use.
Citation
@software{jocher2023ultralytics,
author = {Jocher, Glenn and Chaurasia, Ayush and Qiu, Jing},
title = {Ultralytics YOLOv8},
version = {8.0.0},
year = {2023},
url = {https://github.com/ultralytics/ultralytics},
license = {AGPL-3.0}
}
- Downloads last month
- -
Model tree for W4ashabii/waste_classifier
Base model
Ultralytics/YOLOv8
