I have exported the ONNX using “torch.onnx.export”
I have done the inference with PyTorch, OnnxRuntime, and TensorRT. PyTorch and OnnxRuntime give the same result whereas TensorRT is not.
I think some problem with TrtEngine buld from ONNX. I have other Segmentation model as well, that loads fine but the result were not similar. I have tried the polygraphy for segmentation model, Pytorch and OnnRuntime gives same result but the TRT Engine not.
The root cause is from onnx parser rather than TensorRT library itself.
You will still need to use TensorRT v7.1.3 for compatibility.
But upgrade the ONNX parser to solve this issue.
Found Issue after the solution you have provided on ARM64-NX
TensorRT 7.1.3 installed through JetPack 4.5.1
Onnx-Parser installed as per your instruction 7.2.2
Following the issue
/home/onnx-tensorrt/onnx2trt_utils.cpp:291: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32.
/home/onnx-tensorrt/ModelImporter.cpp:703: While parsing node number 37 [Resize -> "300"]:
/home/onnx-tensorrt/ModelImporter.cpp:704: --- Begin node ---
/home/onnx-tensorrt/ModelImporter.cpp:705: input: "295"
input: "299"
input: "526"
output: "300"
name: "Resize_37"
op_type: "Resize"
attribute {
name: "coordinate_transformation_mode"
s: "align_corners"
type: STRING
}
attribute {
name: "cubic_coeff_a"
f: -0.75
type: FLOAT
}
attribute {
name: "mode"
s: "linear"
type: STRING
}
attribute {
name: "nearest_mode"
s: "floor"
type: STRING
}
/home/onnx-tensorrt/ModelImporter.cpp:706: --- End node ---
/home/onnx-tensorrt/ModelImporter.cpp:709: ERROR: /home/onnx-tensorrt/builtin_op_importers.cpp:3074 In function importResize:
[8] Assertion failed: (transformationMode == "asymmetric" || transformationMode == "pytorch_half_pixel" || transformationMode == "half_pixel") && "TensorRT only supports half pixel, pytorch half_pixel, and asymmetric tranformation mode for linear resizes when scales are provided!"
kError: Assertion failed: (transformationMode == "asymmetric" || transformationMode == "pytorch_half_pixel" || transformationMode == "half_pixel") && "TensorRT only supports half pixel, pytorch half_pixel, and asymmetric tranformation mode for linear resizes when scales are provided!"
Network must have at least one output
Network validation failed.
I am facing issue as below, while building onnx parser on TensorRT 7.1.3
/home/aim/Downloads/onnx-tensorrt/builtin_op_importers.cpp:5042:12: error: ‘class nvinfer1::IResizeLayer’ has no member named ‘setSelectorForSinglePixel’
layer->setSelectorForSinglePixel(selector);
^~~~~~~~~~~~~~~~~~~~~~~~~
/home/aim/Downloads/onnx-tensorrt/builtin_op_importers.cpp:5043:12: error: ‘class nvinfer1::IResizeLayer’ has no member named ‘setCoordinateTransformation’
layer->setCoordinateTransformation(transformation);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/aim/Downloads/onnx-tensorrt/builtin_op_importers.cpp:5044:12: error: ‘class nvinfer1::IResizeLayer’ has no member named ‘setNearestRounding’
layer->setNearestRounding(roundMode);