Instructions to use Zharasbek/resnet18-bean-disease-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Zharasbek/resnet18-bean-disease-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="Zharasbek/resnet18-bean-disease-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("Zharasbek/resnet18-bean-disease-classifier") model = AutoModelForImageClassification.from_pretrained("Zharasbek/resnet18-bean-disease-classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
ResNet-18 Bean Leaf Disease Classifier
This model is a fine-tuned version of microsoft/resnet-18, trained on the AI-Lab-Makerere/beans dataset.
It classifies bean-leaf images into three categories:
angular_leaf_spotbean_rusthealthy
Test results
The model was evaluated on the official test split containing 128 images.
| Metric | Result |
|---|---|
| Accuracy | 0.9453 |
| Macro-F1 | 0.9460 |
| Test loss | 0.1533 |
Per-class results
| Class | Precision | Recall | F1 | Support |
|---|---|---|---|---|
| Angular leaf spot | 0.9512 | 0.9070 | 0.9286 | 43 |
| Bean rust | 0.8913 | 0.9535 | 0.9213 | 43 |
| Healthy | 1.0000 | 0.9762 | 0.9880 | 42 |
Confusion matrix
Training configuration
- Base model: Microsoft ResNet-18
- Epochs: 10
- Learning rate: 5e-5
- Training batch size: 8
- Gradient accumulation steps: 2
- Effective batch size: 16
- Weight decay: 0.01
- Random seed: 42
- Best checkpoint selected using validation macro-F1
Example usage
from PIL import Image
from transformers import pipeline
classifier = pipeline(
"image-classification",
model="Zharasbek/resnet18-bean-disease-classifier",
)
image = Image.open("bean_leaf.jpg").convert("RGB")
predictions = classifier(image, top_k=3)
print(predictions)
Intended use
This model was created as an educational project demonstrating fine-tuning, evaluation, model publishing, and deployment.
Limitations
The model supports only the three classes present in the Beans dataset. It may produce unreliable predictions for:
- Other crops or plant species
- Diseases absent from the dataset
- Images captured under substantially different conditions
- Images that do not contain bean leaves
The model has not been clinically or agriculturally validated and should not be used as the sole basis for crop-management decisions.
Licenses and attribution
The base model is distributed under the Apache 2.0 license.
The Beans dataset is distributed under the MIT license.
- Downloads last month
- 19
Model tree for Zharasbek/resnet18-bean-disease-classifier
Base model
microsoft/resnet-18