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_spot
  • bean_rust
  • healthy

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

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
Safetensors
Model size
11.2M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Zharasbek/resnet18-bean-disease-classifier

Finetuned
(74)
this model

Dataset used to train Zharasbek/resnet18-bean-disease-classifier