← All models

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

MobileNet β€” the backbone built to run on a phone

Same 1,000-way ImageNet job as the ViT and ConvNeXt demos, but with a model a fraction of their size. MobileNetV2 is ~3.5M parameters of depthwise-separable convolutions β€” designed for on-device, real-time inference. Classify an image and read the real millisecond latency; the story here is tiny + fast.

At a glance

Modelonnx-community/mobilenet_v2_1.0_224
Task / pipelineimage-classification
ArchitectureMobileNetV2 β€” ~3.5M params, depthwise-separable convs + inverted residuals with linear bottlenecks
LabelsImageNet-1k + a background class = 1,001 outputs (the ViT/ConvNeXt demos have 1,000)
Quantizationfp32 (see note) β€” q8 is degenerate for this model
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~14 MB β€” vs ~29 MB (ConvNeXt) and ~88 MB (ViT)
Licenseother (Google, per the original model card)
Web APIsWebAssembly, Web Workers, FileReader, getUserMedia (webcam demo) β€” all Baseline widely available
Why fp32 and not q8?

This repo prefers 8-bit (q8) weights, but MobileNetV2's depthwise-separable convolutions quantise degenerately with the generic int8 export: the ConvInteger operator has no WebAssembly kernel, and the uint8/q8 builds emit garbage labels (verified β€” a tiger photo comes back "envelope"). fp32 is the honest, correct choice and is still tiny at ~14 MB β€” a fraction of the heavier backbones, which is exactly the point.

Run it

Pick or drop an image and hit Classify. Watch the latency read-out β€” MobileNet is built to be quick.

Drop an image here, or click to choose
Two cats sleeping on a pink couch A cozy sunlit bedroom with a bookshelf A riverside at golden hour with a swan
Selected image preview

5 labels

See inside

MobileNet's final layer produces one raw logit per class, and a softmax turns those into probabilities. The table shows the top classes with their raw logit next to the softmax probability, plus the shape of the distribution: top-1 margin and normalised entropy.

Run a classification to see the raw numbers.

Size & latency: mobile backbone vs the heavier ones

Download size and parameter counts are fixed facts. The "latency here" cell fills in with a real measured run once you classify above.

ModelParamsDownloadOutputsLatency here
MobileNetV2~3.5M~14 MB1,001run above ↑
ConvNeXt-Tiny~28M~29 MB1,0008Γ— the params
ViT-B/16~86M~88 MB1,00025Γ— the params

Why it matters

MobileNet is the workhorse of on-device vision: small enough to ship inside an app or a web page, fast enough to run on every frame of a camera feed, and accurate enough for a huge range of real tasks. When the constraint is battery, bandwidth, or latency β€” not the last point of accuracy β€” this is the backbone you reach for.

Use cases

Basics

Classify a sample and read the top-k with a real latency read-out.

Practical

Real-time webcam tagging β€” the mobile use case: classify live camera frames.

Wild

Torture test: shrink and JPEG-crush an image and find where the tiny model breaks.

Multi-model

Fast prefilter β†’ confirm: MobileNet triages, ViT double-checks only the uncertain ones.

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/mobilenet_v2_1.0_224",
  { dtype: "fp32" },
); // downloads + caches ~14 MB once

const output = await classify(imageURL, { top_k: 5 });
// β†’ [{ label: "tiger, Panthera tigris", score: 0.70 }, { label: "tiger cat", score: 0.21 }, …]

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 1,001 classes, including the background class at index 0) and compute the softmax, entropy, and margin itself. Inference runs in a Web Worker so the page never janks.

References