Minimal inference example


I’ve been working on the getting started with jetson nano dli course. I’ve developed a great custom pythorch resnet-34 model that i would like to run in a python file by itself. So super simple: i have a file .pth and i would like to:

  1. Load model
  2. Grab image
  3. Print class + confidence

Are there any examples showing this simple setup?

Thanks in advance!


On Nano, it’s recommended to use TensorRT for inference.
Please convert your pth model into the ONNX format first.

After that, you can check the below sample to read images (using OpenCV) and print the model output.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.