Swiss Food Classifier (ResNet50)
A transfer learning model fine-tuned on a custom Swiss food dataset.
Classes
- fondue
- raclette
- rosti
- bircher_muesli
- zuercher_geschnetzeltes
Architecture
- Base: ResNet50 (ImageNet pretrained)
- Head: Dropout(0.4) โ Linear(2048 โ 5)
- Training: 2-phase (head only โ full fine-tune)
Performance
| Metric | Value |
|---|---|
| Val Accuracy | ~88% |
| Val Loss | ~0.35 |
Usage
import torch
from torchvision import models, transforms
from PIL import Image
import json
labels = json.load(open("labels.json"))
model = models.resnet50()
model.fc = torch.nn.Sequential(
torch.nn.Dropout(0.4),
torch.nn.Linear(2048, len(labels))
)
model.load_state_dict(torch.load("swiss_food_resnet50.pth", map_location="cpu"))
model.eval()
Space
๐ Live Demo