Downloads · 30 days
0
Heliosoph/mobilenetv2-onnx
mobilenetv2-onnx is a image classification model from Heliosoph. Use it when you need a label for an image. It is set up for onnx. The card lists the license as apache-2.0.
ONNX checkpoint of Google's MobileNetV2, trained on ImageNet-1K. Tiny (~14 MB), CPU-friendly, and a sensible baseline for whole-image classification, embedding extraction, or as a backbone for fine-tuning.
Downloads · 30 days
0
Access
Public
Updated May 17, 2026
Repo size
14 MB
Likes
0
Public
Click a slice to open those files.
.onnx14 MB · 100%
From the Hugging Face model README
ONNX checkpoint of Google's MobileNetV2, trained on ImageNet-1K. Tiny (~14 MB), CPU-friendly, and a sensible baseline for whole-image classification, embedding extraction, or as a backbone for fine-tuning.
Not converted locally — this is the opset-12 checkpoint the ONNX Model Zoo publishes alongside the MobileNetV2 reference release.
Credit: Sandler, Howard, Zhu, Zhmoginov, Chen — Google AI Research.
mobilenetv2-12.onnx # ~14 MB — opset 12, fp32, full ImageNet-1K classifier
imagenet-classes.json # 1000-entry array: index = class id, value = human label
The .onnx and the .json are designed to travel together — the model emits a [1, 1000] logits tensor whose argmax index is meaningless without the matching synset → label table. Bundling both in one repo means a single download gives you a usable classifier.
| Spec | |
|---|---|
| Input name | input |
| Input shape | [1, 3, 224, 224] (NCHW) |
| Input dtype | float32 |
| Input color order | RGB |
| Preprocessing | Resize shortest side to 256, center-crop to 224×224, scale to [0,1], then normalize: mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225] (ImageNet) |
| Output name | output |
| Output shape | [1, 1000] |
| Output | Raw logits — apply softmax for probabilities, argmax for top-1, top-k sort for top-k |
import json
import numpy as np
import onnxruntime as ort
from PIL import Image
# Load model + class table
sess = ort.InferenceSession("mobilenetv2-12.onnx")
with open("imagenet-classes.json") as f:
classes = json.load(f) # list of 1000 labels
# Preprocess
img = Image.open("photo.jpg").convert("RGB")
img = img.resize((256, 256), Image.BILINEAR)
left = (256 - 224) // 2
img = img.crop((left, left, left + 224, left + 224))
arr = np.asarray(img, dtype=np.float32) / 255.0
arr = (arr - [0.485, 0.456, 0.406]) / [0.229, 0.224, 0.225]
arr = arr.transpose(2, 0, 1)[None, ...] # NCHW
# Inference
logits = sess.run(None, {"input": arr.astype(np.float32)})[0]
probs = np.exp(logits[0] - logits[0].max())
probs /= probs.sum()
top5 = np.argsort(probs)[-5:][::-1]
for idx in top5:
print(f"{classes[idx]}: {probs[idx]:.3f}")
For embedding extraction (pooled feature vector instead of class probabilities), MobileNetV2's penultimate global-average-pool output is the conventional choice — a small modeling adjustment turns this into a 1280-dim image embedder.
Apache-2.0 — both the ONNX Model Zoo checkpoint and the original Google MobileNetV2 weights / reference code ship under Apache-2.0. LICENSE file included.