Resnet onnx to trt conversion failed

I am encountering an issue while attempting to convert a ResNet onnx model to trt format using the trtexec command provided by TensorRT. The ResNet model is originally in TensorFlow format and has been converted to ONNX using the tf2onnx.converter . Please find the logs.
trtexec.log (190.7 KB)

This is the error message


[03/15/2024-19:34:56] [V] [TRT] Parsing node: StatefulPartitionedCall/resnet50/predictions/MatMul [MatMul]
[03/15/2024-19:34:56] [V] [TRT] Searching for input: StatefulPartitionedCall/resnet50/avg_pool/Mean:0
[03/15/2024-19:34:56] [V] [TRT] Searching for input: StatefulPartitionedCall/resnet50/predictions/MatMul/ReadVariableOp:0
[03/15/2024-19:34:56] [V] [TRT] StatefulPartitionedCall/resnet50/predictions/MatMul [MatMul] inputs: [StatefulPartitionedCall/resnet50/avg_pool/Mean:0 -> ()[FLOAT]], [StatefulPartitionedCall/resnet50/predictions/MatMul/ReadVariableOp:0 -> (2048, 1000)[FLOAT]], 
[03/15/2024-19:34:56] [V] [TRT] Registering layer: StatefulPartitionedCall/resnet50/predictions/MatMul/ReadVariableOp:0 for ONNX node: StatefulPartitionedCall/resnet50/predictions/MatMul/ReadVariableOp:0
[03/15/2024-19:34:56] [V] [TRT] Registering layer: StatefulPartitionedCall/resnet50/predictions/MatMul for ONNX node: StatefulPartitionedCall/resnet50/predictions/MatMul
[03/15/2024-19:34:56] [E] Error[4]: StatefulPartitionedCall/resnet50/predictions/MatMul: last dimension of input0 = 1 and second to last dimension of input1 = 2048 but must match.
[03/15/2024-19:34:56] [E] [TRT] ModelImporter.cpp:726: While parsing node number 123 [MatMul -> "StatefulPartitionedCall/resnet50/predictions/MatMul:0"]:
[03/15/2024-19:34:56] [E] [TRT] ModelImporter.cpp:727: --- Begin node ---
[03/15/2024-19:34:56] [E] [TRT] ModelImporter.cpp:728: input: "StatefulPartitionedCall/resnet50/avg_pool/Mean:0"
input: "StatefulPartitionedCall/resnet50/predictions/MatMul/ReadVariableOp:0"
output: "StatefulPartitionedCall/resnet50/predictions/MatMul:0"
name: "StatefulPartitionedCall/resnet50/predictions/MatMul"
op_type: "MatMul"

[03/15/2024-19:34:56] [E] [TRT] ModelImporter.cpp:729: --- End node ---
[03/15/2024-19:34:56] [E] [TRT] ModelImporter.cpp:732: ERROR: ModelImporter.cpp:185 In function parseGraph:
[6] Invalid Node - StatefulPartitionedCall/resnet50/predictions/MatMul
StatefulPartitionedCall/resnet50/predictions/MatMul: last dimension of input0 = 1 and second to last dimension of input1 = 2048 but must match.
[03/15/2024-19:34:56] [E] Failed to parse onnx file
[03/15/2024-19:34:56] [I] Finish parsing network model
[03/15/2024-19:34:56] [E] Parsing model failed
[03/15/2024-19:34:56] [E] Failed to create engine from model or file.
[03/15/2024-19:34:56] [E] Engine set up failed

Please find the onnx file as well.
Gdrive link

Can use TAO Resnet model finetuning and transition to tensorrt for best performance

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