PingoLH / CenterNet-HarDNet

Object detection achieving 44.3 mAP / 45 fps on COCO dataset
MIT License
169 stars 32 forks source link

onnx to tensorRT,Network validation failed #1

Open zhengjiawen opened 4 years ago

zhengjiawen commented 4 years ago

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
PingoLH commented 4 years ago

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

fee0819 commented 4 years ago

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 commented 4 years ago

@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