Skip to content
imaged

Image classification

ResNet-50

The classic image classifier: names the main subject of a photo among 1,000 categories.

BSD-3-Clauseimagenetcnnbaseline
Choose a variant

About this model

ResNet-50 is the best-known image classifier and the usual point of comparison. It names the main subject of a photo among the 1,000 ImageNet categories (25.6 million parameters).

These are torchvision's IMAGENET1K_V2 weights, with 80.9% top-1 accuracy on ImageNet as torchvision reports it. They were trained with label smoothing, so their scores are lower than other models' for the same confidence (a top score of 0.3 to 0.4 is typical).

What you can build

  • A well-understood baseline for photo classification
  • Feature extraction backbone for your own classifier

Golden retriever dog

f16
Input
Golden-retriever-dog-1362597631o6g

Karen Arnold, CC0, https://commons.wikimedia.org/wiki/File:Golden-retriever-dog-1362597631o6g.jpg

Output
Top 5 on the Apple Neural Engine (FP16 pack):
golden retriever: 39.2%
flat-coated retriever: 1.0%
tennis ball: 1.0%
soccer ball: 0.5%
clumber: 0.4%

Macaw parrot

f16
Input
Macaw parrot sitting on a tree branch.jpg

Christopher Kuszajewski, CC0, https://commons.wikimedia.org/wiki/File:Macaw_parrot_sitting_on_a_tree_branch.jpg_.jpg

Output
Top 5 on the Apple Neural Engine (FP16 pack):
macaw: 34.1%
African grey: 0.2%
sulphur-crested cockatoo: 0.2%
lorikeet: 0.2%
screen: 0.1%

Steam locomotive

f16
Input
JA1271 crossing the Otaki River

Karora, Public domain, https://commons.wikimedia.org/wiki/File:JA1271_crossing_the_Otaki_River.jpg

Output
Top 5 on the Apple Neural Engine (FP16 pack):
steam locomotive: 31.2%
viaduct: 10.9%
freight car: 4.2%
passenger car: 3.7%
pier: 1.2%

Variants & downloads

Choose the build for your app

Model files are hosted on Google Drive. Large files may open a confirmation page before downloading.

Small

Slab

Weights stored as int8 in blocks of 64: about a quarter of FP32. Slab decodes them to float when loading, so it runs at the same speed; accuracy is measured below.

Platforms: macos · android

resnet-50-int8.slab

27.1 MB · Hosted download

Download
SHA-256 checksum
4ad84a7518afc638efe4965d7f44caf7f5169f976b55414cff991349bb0ff537

LICENSE-torchvision.txt

1 KB

Download
SHA-256 checksum
6502f676851cfe25f8af75531dfb32375b7325b73c37e7b43741fa422893e71d
Conversion details
command
python -c "import torch, torchvision; m = torchvision.models.resnet50(weights='IMAGENET1K_V2').eval(); torch.onnx.export(m, torch.randn(1, 3, 224, 224), 'model.onnx', input_names=['image'], output_names=['logits'], opset_version=17, dynamo=False)" python -c "import torchvision; open('labels.txt', 'w').write('\n'.join(torchvision.models.ResNet50_Weights.IMAGENET1K_V2.meta['categories']))" slab-load convert model.onnx model.slab --input image=1x3x224x224 --meta task=classify --meta resize=center_crop --meta resize_size:i64=232 --meta interpolation=bilinear --meta antialias:bool=true --meta normalize=imagenet --meta color=rgb --meta labels:labels=@labels.txt slab-load quantize model.slab resnet-50-int8.slab slab-load meta set resnet-50-int8.slab default_backend.macos=npu

Integration examples

Python

python

import slab

cfg = slab.Config(cache_dir="/tmp/slab_cache", license=open("license.slablic.txt").read())
session = slab.Session(cfg, "resnet-50-f16.slab", warmup=True)
out = session.run(slab.Input(frame=slab.Frame.open("photo.jpg")))
for c in out.top_k(5):
    print(f"{c.label}: {c.score:.1%}")

Device & backend compatibility

Pack default: macos / NPU. Fastest on the Mac (about 1 to 2 ms per photo) and quick to prepare.

Available execution backends for ResNet-50
PlatformEngineStatusPrecision
apple

CPU

CPU

Supported

Measured on macOS.

f32
apple

Metal

GPU

Supported

Measured on macOS.

f32
apple

Apple Neural Engine

NPU

Supported

Measured on macOS. The Neural Engine computes in FP16; preparing the model for it takes noticeably longer than for the GPU (see open time under Performance).

f16
android

CPU

CPU

Supported

Measured on a Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2, Adreno 740), Android 17.

f32
android

Vulkan

GPU

Supported

Measured on a Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2, Adreno 740), Android 17.

f32
android

Qualcomm Hexagon NPU (QNN)

NPU

Supported

Measured on a Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2, Adreno 740), Android 17. The NPU computes in FP16 (the int8 pack's weights are widened to FP16).

f16

Performance

Results depend on the device, runtime, and test conditions. Each measurement keeps its own context.

Mac with Apple M1 Max

Slab · CPU

macOS 26.6.2

21.5 ms

Measured time · scope below

int8Session open (ms): 28 Platform: macos Runs: 100 Input: 1, 3, 224, 224 Measured: 2026-10-28

Median of 100 warm runs of the model (Slab's run time). From a 1920 x 1080 photo, preprocessing included: 22.37 ms median. open_ms: opening the session, including preparing the model for the CPU.

Mac with Apple M1 Max

Slab · GPU

macOS 26.6.2

5.2 ms

Measured time · scope below

int8Session open (ms): 51 Platform: macos Runs: 100 Input: 1, 3, 224, 224 Measured: 2026-10-28

Median of 100 warm runs of the model (Slab's run time). From a 1920 x 1080 photo, preprocessing included: 5.75 ms median. open_ms: opening the session, including preparing the model for the Metal.

Mac with Apple M1 Max

Slab · NPU

macOS 26.6.2

2.0 ms

Measured time · scope below

int8Session open (ms): 700 Platform: macos Runs: 100 Input: 1, 3, 224, 224 Measured: 2026-10-28

Median of 100 warm runs of the model (Slab's run time). From a 1920 x 1080 photo, preprocessing included: 4.33 ms median. open_ms: opening the session, including preparing the model for the Apple Neural Engine.

Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2)

Slab · CPU

Android 17

113.0 ms

Measured time · scope below

int8Session open (ms): 44 Platform: android Runs: 100 Input: 1, 3, 224, 224 Measured: 2026-11-06

Median of 100 warm runs of the model (Slab's run time). From a 1920 x 1080 photo, preprocessing included: 112 ms median. open_ms: opening the session. Peak memory (resident) after the runs: 163 MB.

Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2)

Slab · GPU

Android 17

39.7 ms

Measured time · scope below

int8Session open (ms): 98 Platform: android Runs: 100 Input: 1, 3, 224, 224 Measured: 2026-11-06

Median of 100 warm runs of the model (Slab's run time). From a 1920 x 1080 photo, preprocessing included: 42.6 ms median. open_ms: opening the session with the GPU programs already in the cache folder (the first open on a device compiles them, about 0.3 s more). Peak memory (resident) after the runs: 167 MB.

Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2)

Slab · NPU

Android 17

3.1 ms

Measured time · scope below

int8Session open (ms): 508 Platform: android Runs: 100 Input: 1, 3, 224, 224 Measured: 2026-11-06

Median of 100 warm runs of the model (Slab's run time). From a 1920 x 1080 photo, preprocessing on the CPU included: 5.41 ms median. open_ms: opening the session, including preparing the model for the Hexagon NPU. Peak memory (resident) after the runs: 205 MB.

Accuracy checks

macos · CPU · int8

The upstream PyTorch model with its own preprocessing, on 53 public-domain photos (Wikimedia Commons)

Same top answer on 53/53 photos with Slab doing the preprocessing; on identical input tensors, same top answer on 53/53, upstream's answer among Slab's top 5 on 53/53, largest probability difference 0.065.

macos · GPU · int8

The upstream PyTorch model with its own preprocessing, on 53 public-domain photos (Wikimedia Commons)

Same top answer on 53/53 photos with Slab doing the preprocessing; on identical input tensors, same top answer on 53/53, upstream's answer among Slab's top 5 on 53/53, largest probability difference 0.065.

macos · NPU · int8

The upstream PyTorch model with its own preprocessing, on 53 public-domain photos (Wikimedia Commons)

Same top answer on 53/53 photos with Slab doing the preprocessing; on identical input tensors, same top answer on 53/53, upstream's answer among Slab's top 5 on 53/53, largest probability difference 0.068.

android · NPU · int8

Slab's CPU engine (FP32) on the same 1920 x 1080 photo

Cosine similarity of the output with the CPU's: 1.00000; the same top answer and the same top 5.

Before you choose this model

  • Knows only the 1,000 ImageNet categories.
  • One label per photo.
  • Scores are low by design (label smoothing); compare rankings, not absolute values.