← All models

image-classification Β· vision Β· WASM Β· ~93 MB

Food-101 β€” name the dish, 101 ways

A Swin Transformer fine-tuned on the Food-101 dataset. Give it a plate β€” a slice of pizza, a bowl of ramen, a wedge of tiramisu β€” and it reads the fine-grained texture (crumb, char, garnish) to pick one of 101 dishes, with a probability for each. It runs entirely on your device: the photo never leaves the tab.

At a glance

Modelonnx-community/swin-finetuned-food101-ONNX
Task / pipelineimage-classification
ArchitectureSwin Transformer (base) β€” hierarchical shifted-window attention, fine-tuned on Food-101
LabelsFood-101 β€” 101 fixed dish classes (apple pie β†’ waffles)
Quantizationq8 (8-bit) ONNX β€” model_quantized.onnx
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~93 MB, cached after first load
LicenseApache-2.0
Web APIsWebAssembly, Web Workers, FileReader β€” all Baseline widely available

Run it

Pick or drop a food photo and hit Identify. The bars are the softmax over Food-101's 101 dishes β€” only the top few are shown, but they're drawn from the full distribution.

Drop a food photo here, or click to choose
A margherita pizza A platter of sushi A caesar salad
Selected food photo preview

5 dishes

See inside

The model's final layer produces one raw score β€” a logit β€” for each of the 101 dishes. A softmax turns those logits into probabilities that sum to 100%. The table shows the top dishes with their raw logit next to the softmax probability. Below it, two numbers describe the shape of the whole distribution: the top-1 margin (how far the winner leads the runner-up) and the normalised entropy (0 = the model is certain, 1 = it's spread thin across many dishes). A clear plate of sushi is peaky and low-entropy; a fusion dish or a messy crop is flat and high-entropy β€” and the runners-up are usually its visual neighbours (a steak next to prime rib, a cupcake next to a red-velvet slice).

Run a classification to see the raw numbers.

Why it matters

A fast, private, offline "what dish is this?" is a building block for food apps, restaurant tools, and health trackers β€” and it's a good example of a specialised classifier: it only knows 101 dishes, but within that world it's far sharper than a generic 1,000-class ImageNet model, because every one of its classes is a food.

Use cases

Basics

Drop a plate, read the top dishes and confidence β€” feel food classification first-hand.

Practical

A menu & nutrition tagger: classify a meal and attach an estimated calorie/macro card.

Wild

Ambiguous & plated dishes: crop, zoom, and occlude, and watch the model argue with itself.

Multi-model

Classify β†’ describe: chain the dish label into a full-sentence caption of the plate.

How the API works

The convenience path is two lines with Transformers.js:

import { pipeline } from "@huggingface/transformers";

const classify = await pipeline(
  "image-classification",
  "onnx-community/swin-finetuned-food101-ONNX",
  { dtype: "q8" },
); // downloads + caches ~93 MB once

const output = await classify(imageURL, { top_k: 5 });
// β†’ [{ label: "pizza", score: 0.998 }, { label: "lasagna", score: 0.0006 }, …]

This page goes one level deeper for "See inside": instead of the pipeline it runs the model's own processor then model() in a single forward pass, so it can read the raw logits tensor (all 101 dishes) and compute the softmax, entropy, and margin itself. Same weights, same result β€” just keeping the intermediate numbers. Inference runs in a Web Worker so the page never janks. Labels come back snake_cased (baby_back_ribs); the page pretty-prints them.

References