CenterNet-HarDNet icon indicating copy to clipboard operation
CenterNet-HarDNet copied to clipboard

onnx to tensorRT,Network validation failed

Open zhengjiawen opened this issue 5 years ago • 3 comments

Hi, @PingoLH , Thank you for your work. When I run demo_trt.py to convert pytorch weight to tensorRT, I encountered an error. Cound you tell me how to fix it ?

It is my commond:

python3 demo_trt.py ctdet --demo webcam --arch hardnet_85 --load_model ../models/centernet_hardnet85_coco.pth --input_w 256 --input_h 256

Error infomation:

Building an engine from file ctdet_hardnet_85_256x256.onnx; this may take a while...
[TensorRT] ERROR: Layer: Where_1305's output can not be used as shape tensor.
[TensorRT] ERROR: Network validation failed.

Completed creating Engine
Traceback (most recent call last):
  File "demo_trt.py", line 313, in <module>
    demo(opt)
  File "demo_trt.py", line 253, in demo
    engine = get_engine(1, onnx_model_path, trt_engine_path, fp16_mode=True, overwrite=True)
  File "demo_trt.py", line 138, in get_engine
    return build_engine(max_batch_size)
  File "demo_trt.py", line 127, in build_engine
    f.write(engine.serialize())
AttributeError: 'NoneType' object has no attribute 'serialize'

My enviorment:

Jetson Agx xavier
jetpack 4.4
cuda10.2
tensorRT 7.1.0.16
torch 1.5.0
torchvison 0.6.0

zhengjiawen avatar Sep 10 '20 07:09 zhengjiawen

Hi, thank you for your feedback. Could you try pytorch 1.6.0? which is the one I installed on Jetson. Because it seems that Jetpack 4.4 only support this version: The JetPack 4.4 production release (L4T R32.4.3) only supports PyTorch 1.6.0 or newer, due to updates in cuDNN. https://forums.developer.nvidia.com/t/pytorch-for-jetson-version-1-6-0-now-available/72048

PingoLH avatar Sep 10 '20 16:09 PingoLH

Hi. I also have the same problem, i have tried with torch version 1.6.0 My enviroment: Screenshot from 2020-10-28 17-33-00

fee0819 avatar Oct 28 '20 09:10 fee0819

@PingoLH Hi, I am trying python3 demo_trt.py ctdet --demo webcam --arch hardnet_85 --load_model ./../models/centernet_hardnet85_coco.pth --input_w 416 --input_h 416

I am using in Xavier NX and I also tried with pytorch 1.6.0 and 1.5.0 but still have the same issue. My TensorRT and other systems specs are shown in the attached image. What is the possible reason? Have you tested with TensorRT? if yes then what was the exact versions and libraries you used?

Looking forward to hearing from you. Screenshot from 2020-10-28 17-33-00

fee0819 avatar Nov 04 '20 07:11 fee0819