ViT Beans Model
This model was fine-tuned using transfer learning on the "beans" dataset from the Hugging Face Datasets Hub.
It classifies bean plant leaves into the following categories:
LABEL_0: angular_leaf_spotLABEL_1: bean_rustLABEL_2: healthy
Model architecture
The base model is google/vit-base-patch16-224.
Training
Transfer learning was used with a ViT model pre-trained on ImageNet-21k.
Evaluation
This model was compared to a zero-shot classification using CLIP (openai/clip-vit-base-patch32).
Zero-Shot Results on Oxford Pets (as required):
- Accuracy: 0.9993189573287964
- Precision: 0.5794700118713081
- Recall: 0.10156987264053896
- Model used:
openai/clip-vit-base-patch32
Example
from transformers import ViTFeatureExtractor, ViTForImageClassification
from PIL import Image
import torch
image = Image.open("example_input.png")
extractor = ViTFeatureExtractor.from_pretrained("LindiSimon/vit-beans-model")
inputs = extractor(images=image, return_tensors="pt")
model = ViTForImageClassification.from_pretrained("LindiSimon/vit-beans-model")
with torch.no_grad():
logits = model(**inputs).logits
predicted_class = logits.argmax(-1).item()
- Downloads last month
- 10