ethz/food101
Viewer • Updated • 101k • 63.2k • 142
How to use mnjm/DINOv1-ViT-S-16-food101 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-feature-extraction", model="mnjm/DINOv1-ViT-S-16-food101") # Load model directly
from transformers import AutoImageProcessor, AutoModel
processor = AutoImageProcessor.from_pretrained("mnjm/DINOv1-ViT-S-16-food101")
model = AutoModel.from_pretrained("mnjm/DINOv1-ViT-S-16-food101", device_map="auto")DINOv1 ViT-S/16 model trained from scratch on the Food-101 dataset using a custom training repo.
Weighted k-NN evaluation on Food-101 validation features:
| k | Top-1 accuracy | Top-5 accuracy |
|---|---|---|
| 5 | 64.09% | 79.93% |
| 10 | 66.38% | 83.47% |
| 20 | 67.59% | 86.17% |
| 100 | 67.81% | 88.72% |
from transformers import AutoImageProcessor, ViTModel
processor = AutoImageProcessor.from_pretrained("mnjm/DINOv1-ViT-S-16-food101")
model = ViTModel.from_pretrained("mnjm/DINOv1-ViT-S-16-food101")
inputs = processor(images=image, return_tensors="pt")
outputs = model(**inputs)
image_features = outputs.last_hidden_state[:, 0]