Downloads · 30 days
16
13% of all-time downloads
ArchitRastogi/vit-food-classifier-3class
vit-food-classifier-3class is a image classification model from ArchitRastogi. Use it when you need a label for an image. It is set up for transformers. The card lists the license as mit.
A fine-tuned Vision Transformer (ViT) model trained to classify pizza, steak, and sushi images. Achieves 96% accuracy on the test set, demonstrating the strong performance of transfer learning for visual food recognit…
Downloads · 30 days
16
13% of all-time downloads
All-time downloads
119
Public
Parameters
85.8M
687 MB on disk
Likes
0
Public
Click a slice to open those files.
.pth343 MB · 50%
From the Hugging Face model README
A fine-tuned Vision Transformer (ViT) model trained to classify pizza, steak, and sushi images. Achieves 96% accuracy on the test set, demonstrating the strong performance of transfer learning for visual food recognition.
google/vit-base-patch16-224-in21k["pizza", "steak", "sushi"]from transformers import ViTImageProcessor, ViTForImageClassification
from PIL import Image
import torch
model = ViTForImageClassification.from_pretrained("archit/vit-chef")
processor = ViTImageProcessor.from_pretrained("archit/vit-chef")
image = Image.open("example.jpg")
inputs = processor(images=image, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
pred = logits.argmax(-1).item()
print(model.config.id2label[pred])
| Metric | Baseline | Fine-tuned | Improvement |
|---|---|---|---|
| Accuracy | 46.67% | 96.00% | +49.33 pp |
| Error Reduction | — | 92.5% | — |