Onnx to tensorrt JetPack 4.4

Hi, I try to run this code in TX2 and Xavier NX:

In TX2, I use JetPack 4.3 and I can run the onnx_to_tensorrt.py smoothly.
In Xavier, I can only use JetPack 4.4 and when I run onnx_to_tensorrt.py I got this error:

AttributeError: ‘NoneType’ object has no attribute ‘serialize’

I try other onnx_to_tensorrt.py in:
Everything is run ok.

So, I try to copy the yolo.trt file from the second link to run the first link.
Then I got error as follows:

[TensorRT] ERROR: INVALID_ARGUMENT: Cannot deserialize with an empty memory buffer.
[TensorRT] ERROR: INVALID_CONFIG: Deserialize the cuda engine failed.
Traceback (most recent call last):
File “run_tracker.py”, line 116, in
File “run_tracker.py”, line 97, in main
tracker = Tracker(cfg, args.engine_path)
File “/home/xavier/tracklite/tracker/tracker.py”, line 24, in init
self.context = self.engine.create_execution_context()

Am I miss something?


I solve it.

I add this line:

EXPLICIT_BATCH = if trt.version[0] < ‘7’ else
[1 << (int)(trt.NetworkDefinitionCreationFlag.EXPLICIT_BATCH)]

and put the (*EXPLICIT_BATCH) here:

with trt.Builder(TRT_LOGGER) as builder, builder.create_network(*EXPLICIT_BATCH) as network, trt.OnnxParser(network, TRT_LOGGER) as parser: