ethz/food101
Viewer • Updated • 101k • 29.1k • 136
This model is a fine-tuned version of google/vit-base-patch16-224 for food image classification across 10 categories.
| Metric | Value |
|---|---|
| Accuracy | 98.04% |
| Epoch | Training Loss | Validation Loss | Accuracy |
|---|---|---|---|
| 1 | 0.3254 | 0.1076 | 97.20% |
| 2 | 0.1216 | 0.0904 | 97.68% |
| 3 | 0.0361 | 0.0770 | 97.88% |
| 4 | 0.0118 | 0.0764 | 98.00% |
| 5 | 0.0084 | 0.0767 | 98.04% |
Training Summary:
from datasets import load_dataset
from transformers import pipeline
from tqdm import tqdm
# Load model
classifier = pipeline("image-classification", model="Nav772/vit-food-classifier", device=0)
# Load same test split
dataset = load_dataset("food101", split="validation")
# Filter to same 10 classes
selected_classes = ["pizza", "sushi", "hamburger", "ice_cream", "steak",
"baklava", "cheesecake", "pancakes", "tacos", "ramen"]
class_names = dataset.features['label'].names
selected_indices = [class_names.index(c) for c in selected_classes]
filtered = dataset.filter(lambda x: x['label'] in selected_indices)
# Evaluate
correct = 0
total = 0
for example in tqdm(filtered):
pred = classifier(example['image'])[0]['label']
true_label = class_names[example['label']]
if pred == true_label:
correct += 1
total += 1
print(f"Accuracy: {correct/total:.4f} ({correct}/{total})")
from transformers import pipeline
classifier = pipeline("image-classification", model="Nav772/vit-food-classifier")
result = classifier("path/to/food/image.jpg")
print(result)