Image Classification
Transformers
Safetensors
timm
timm_wrapper
vision
Generated from Trainer
Eval Results (legacy)
Instructions to use omaralshareef/beans-image-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use omaralshareef/beans-image-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="omaralshareef/beans-image-classifier") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# pip install -U transformers accelerate # Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("omaralshareef/beans-image-classifier") model = AutoModelForImageClassification.from_pretrained("omaralshareef/beans-image-classifier", device_map="auto") - timm
How to use omaralshareef/beans-image-classifier with timm:
import timm model = timm.create_model("hf-hub:omaralshareef/beans-image-classifier", pretrained=True) - Notebooks
- Google Colab
- Kaggle
|
Download README.md from omaralshareef/beans-image-classifier: direct link, hf CLI and curl.
- Browser
- Download file 1.96 kB
-
https://huggingface.co/omaralshareef/beans-image-classifier/resolve/main/README.md
- Command line
-
hf download hf://omaralshareef/beans-image-classifier/README.md
-
curl -L -o README.md https://huggingface.co/omaralshareef/beans-image-classifier/resolve/main/README.md
1.96 kB
metadata
library_name: transformers
license: apache-2.0
base_model: timm/mobilenetv3_small_100.lamb_in1k
tags:
- image-classification
- vision
- timm
- generated_from_trainer
datasets:
- AI-Lab-Makerere/beans
metrics:
- accuracy
pipeline_tag: image-classification
model-index:
- name: beans-image-classifier
results:
- task:
type: image-classification
name: Image Classification
dataset:
name: AI-Lab-Makerere/beans
type: AI-Lab-Makerere/beans
metrics:
- type: accuracy
value: 0.9549
name: Validation Accuracy
- type: accuracy
value: 0.8984
name: Test Accuracy
Bean Leaf Disease Classifier
Fine-tuned MobileNetV3-Small on AI-Lab-Makerere/beans.
Given a photo of a bean leaf, the model predicts one of:
angular_leaf_spotbean_rusthealthy
Metrics
| Split | Accuracy | Loss |
|---|---|---|
| Validation (best checkpoint) | 95.49% | 0.235 |
| Test | 89.84% | 0.303 |
Training ran for 5 epochs on Apple Silicon (MPS). The best checkpoint was restored before export.
Usage
from transformers import pipeline
clf = pipeline("image-classification", model="omaralshareef/beans-image-classifier")
print(clf("leaf.jpg"))
Training hyperparameters
- learning rate:
5e-5 - train batch size: 16
- eval batch size: 16
- epochs: 5
- optimizer: AdamW
- seed: 42
Training results
| Training Loss | Epoch | Step | Validation Loss | Accuracy |
|---|---|---|---|---|
| 0.5874 | 1.0 | 65 | 0.4124 | 0.8346 |
| 0.4042 | 2.0 | 130 | 0.2352 | 0.9549 |
| 0.2805 | 3.0 | 195 | 0.1679 | 0.9549 |
| 0.2367 | 4.0 | 260 | 0.1370 | 0.9549 |
| 0.1933 | 5.0 | 325 | 0.1394 | 0.9398 |