Downloads · 30 days
0
maia2000/food-classifier-binary-vit
food-classifier-binary-vit is a image classification model from maia2000. Use it when you need a label for an image. The card lists the license as apache-2.0.
Frozen ViT-B/16 + linear head. Trained on ethz/food101.
Downloads · 30 days
0
Access
Public
Updated Apr 12, 2026
Repo size
1 GB
Likes
1
Public
Click a slice to open those files.
.pt344 MB · 33%
From the Hugging Face model README
Frozen ViT-B/16 + linear head. Trained on ethz/food101.
| File | Format | Use |
|---|---|---|
best.pth | PyTorch state dict | training / fine-tuning |
model.torchscript.pt | TorchScript | server / LibTorch |
model_mobile.ptl | TorchScript Lite | iOS / Android (PyTorch Mobile) |
model.onnx | ONNX | Core ML, TFLite (via onnx2tf), ONNX Runtime Mobile |
import torch, torchvision.transforms as T
from PIL import Image
m = torch.jit.load("model.torchscript.pt").eval()
tf = T.Compose([T.Resize((224,224)), T.ToTensor(),
T.Normalize([0.485,0.456,0.406],[0.229,0.224,0.225])])
img = tf(Image.open("food.jpg").convert("RGB")).unsqueeze(0)
probs = torch.softmax(m(img), dim=-1)[0]
print({"healthy": probs[0].item(), "unhealthy": probs[1].item()})