Error while inferencing yolov5 tensorrt version on Jetson Xavier NX

Getting this error while running weight.engine for yolov5

command - sudo python3 detect.py --weights best_device0_640x480.engine --imgsz 640 480 --source car.jpg

Tensorrt version - 8.0.1
torch - 1.10.1
torchvision - 0.11.2
NGC container - l4t-tensorrt:r8.0.1-runtime

Loading best_device0_640x480.engine for TensorRT inference…
[TensorRT] INFO: [MemUsageChange] Init CUDA: CPU +353, GPU +0, now: CPU 441, GPU 3790 (MiB)
[TensorRT] INFO: Loaded engine size: 171 MB
[TensorRT] INFO: [MemUsageSnapshot] deserializeCudaEngine begin: CPU 612 MiB, GPU 3961 MiB
[TensorRT] ERROR: 1: [stdArchiveReader.cpp::StdArchiveReader::34] Error Code 1: Serialization (Serialization assertion safeVersionRead == safeSerializationVersion failed.Version tag does not match. Note: Current Version: 43, Serialized Engine Version: 0)
[TensorRT] ERROR: 4: [runtime.cpp::deserializeCudaEngine::76] Error Code 4: Internal Error (Engine deserialization failed.)
None
Traceback (most recent call last):
File “detect.py”, line 244, in
main(opt)
File “detect.py”, line 239, in main
run(**vars(opt))
File “/home/npci-nx1/.local/lib/python3.6/site-packages/torch/autograd/grad_mode.py”, line 27, in decorate_context
return func(*args, **kwargs)
File “detect.py”, line 79, in run
model = DetectMultiBackend(weights, device=device, dnn=dnn)
File “/home/npci-nx1/best_yolo/yolov5/models/common.py”, line 331, in init
for index in range(model.num_bindings):
AttributeError: ‘NoneType’ object has no attribute ‘num_bindings’

Hi,

Error Code 1: Serialization (Serialization assertion safeVersionRead == safeSerializationVersion failed.Version tag does not match. Note: Current Version: 43, Serialized Engine Version: 0)

Based on the error log, the engine file is serialized with a different TensorRT version.

Please note that the TensorRT engine is not portable.
You will need to use the same software version and hardware environment to deserialize it.

Please recreate the best_device0_640x480.engine file on XavierNX directly to solve this issue.
Thanks.

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