Views
No views yet
| Attribute | Value |
|---|---|
| Base Model | `google/vit-base-patch16-224-in21k |
| Dataset | Beans Dataset (train/val/test) |
| Task Type | Image Classification |
| Image Size | 224 × 224 |
| Epochs | 3 |
| Batch Size | 16 |
| Optimizer | AdamW |
| Loss Function | CrossEntropyLoss |
| Framework | PyTorch + Transformers |
| Hardware | CUDA-enabled GPU |
| Metric | Score |
|---|---|
| Accuracy | 0.98 |
| F1-Score | 0.99 |
| Precision | 0.98 |
| Recall | 0.99 |
1from transformers import AutoImageProcessor, AutoModelForImageClassification
2from PIL import Image
3import torch
4
5model_name = "AventIQ-AI/Beans-Image-Classification-AI-Model"
6
7processor = AutoImageProcessor.from_pretrained(model_name)
8model = AutoModelForImageClassification.from_pretrained(model_name)
9model.eval()
10
11def predict(image_path):
12 image = Image.open(image_path).convert("RGB")
13 inputs = processor(images=image, return_tensors="pt").to(model.device)
14 with torch.no_grad():
15 outputs = model(**inputs)
16 preds = torch.argmax(outputs.logits, dim=1)
17 return model.config.id2label[preds.item()]
18
19# Example
20print(predict("example_leaf.jpg"))
21
22.
beans-vit-finetuned/
├── config.json ✅ Model architecture & config
├── pytorch_model.bin ✅ Model weights
├── preprocessor_config.json ✅ Image processor config
├── special_tokens_map.json ✅ (Auto-generated, not critical for ViT)
├── training_args.bin ✅ Training metadata
├── README.md ✅ Model card