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
File size: 1,958 Bytes
1772cc5 | 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 | ---
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](https://huggingface.co/timm/mobilenetv3_small_100.lamb_in1k) on [AI-Lab-Makerere/beans](https://huggingface.co/datasets/AI-Lab-Makerere/beans).
Given a photo of a bean leaf, the model predicts one of:
- `angular_leaf_spot`
- `bean_rust`
- `healthy`
## 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
```python
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 |
|