For the complete documentation index, see llms.txt. This page is also available as Markdown.

ResNet

Use ResNet image classification through our Serverless Cloud API

Run ImageNet-pretrained ResNet image classification through the Serverless Cloud API, or self-host using Roboflow Inference.

Default aliases

Pass any of these aliases as the model_id when using the inference-sdk:

  • resnet18

  • resnet34

  • resnet50

  • resnet101

Accuracy and inference speed

Latency is measured with Roboflow Inference on 1x NVIDIA L4, batch size 1, mean of 1,000 inferences (100 warmup). These aliases run on ONNX (no prebuilt TensorRT engine). Batching does not help: these checkpoints export a fixed batch dimension of 1.

Accuracy is the published ImageNet-1k spec for the standard torchvision weights (source).

Alias
Top-1
Top-5
Latency (ms)

resnet18

69.8

89.1

1.4

resnet34

73.3

91.4

2.2

resnet50

76.1

92.9

2.4

resnet101

77.4

93.5

3.7

Code sample

1

Get your API Key

Create a Roboflow account, find your key on the Roboflow API settings page and make it available to your shell:

2

Install the dependencies

This package calls the model:

3

Run the model

The sample below runs resnet50 against a remote image.

Set api_url to match your deployment target:

  • https://serverless.roboflow.com for the Serverless Cloud API.

  • http://localhost:9001 for a local Inference server.

  • Your Dedicated Deployment URL for a private endpoint.

Last updated

Was this helpful?