Edit model card

ResNet-50

Model Description

ResNet-50 model from Deep Residual Learning for Image Recognition paper.

Original implementation

Follow this link to see the original implementation.

How to use

You can use the base model that returns last_hidden_state.

from transformers import AutoFeatureExtractor
from onnxruntime import InferenceSession
from datasets import load_dataset

# load image
dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]

# load model
feature_extractor = AutoFeatureExtractor.from_pretrained("microsoft/resnet-50")
session = InferenceSession("onnx/model.onnx")

# ONNX Runtime expects NumPy arrays as input
inputs = feature_extractor(image, return_tensors="np")
outputs = session.run(output_names=["last_hidden_state"], input_feed=dict(inputs))

Or you can use the model with classification head that returns logits.

from transformers import AutoFeatureExtractor
from onnxruntime import InferenceSession
from datasets import load_dataset

# load image
dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]

# load model
feature_extractor = AutoFeatureExtractor.from_pretrained("microsoft/resnet-50")
session = InferenceSession("onnx/model_cls.onnx")

# ONNX Runtime expects NumPy arrays as input
inputs = feature_extractor(image, return_tensors="np")
outputs = session.run(output_names=["logits"], input_feed=dict(inputs))
Downloads last month
0
Unable to determine this model's library. Check the docs .