AI-Lab-Makerere/beans
Viewer • Updated • 1.3k • 6.56k • 47
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") # 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")How to use omaralshareef/beans-image-classifier with timm:
import timm
model = timm.create_model("hf_hub:omaralshareef/beans-image-classifier", pretrained=True)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| 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.
from transformers import pipeline
clf = pipeline("image-classification", model="omaralshareef/beans-image-classifier")
print(clf("leaf.jpg"))
5e-5| 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 |
Base model
timm/mobilenetv3_small_100.lamb_in1k