Exercise (Model Conversion)

Practice performing the model conversion process behind the PyTorch Image Model.

The main objective of this exercise is to create an inference script for an ONNX image classification model.

Fill in the missing code in each of the interactive playgrounds. Replace all the <CODE> placeholders with the correct code.

You can click on the “Show Answer” button below each playground to reveal the answer.

Import

Start by adding all the necessary import statements at the top of the inference script:

  • ONNX Runtime
  • Python Imaging Library
  • NumPy

Get hands-on with 1200+ tech skills courses.