Hello!
I’m trying to deploy a model from the Tensorflow 2 Object Detection API on a Nvidia Jetson Xavier NX running Jetpack 4.4.
The idea is to retrain the network (ssd_mobilenet_v2_320x320_coco17_tpu-8) with custom data on my PC with a RTX3090, convert the model to onnx using tf2onnx. The model in onnx format can then be used by the ros deep learning node of dusty-nv (GitHub - dusty-nv/ros_deep_learning: Deep learning inference nodes for ROS with support for NVIDIA Jetson TX1/TX2/Xavier and TensorRT).
The first steps and solving the UINT8 Problem using onnx-gs were straightforward. But when the parser tries to read the onnx model I have a problem with the Squeeze layer. I get the following error message:
[04/01/2021-20:54:37] [V] [TRT] ModelImporter.cpp:125: Resize__47 [Resize] inputs: [Transpose__38:0 -> (1, 3, 320, 320)], [const_empty_float__37 -> ()], [const_empty_float__37 -> ()], [Concat__46:0 -> (4)],
[04/01/2021-20:54:37] [V] [TRT] ImporterContext.hpp:141: Registering layer: Resize__47 for ONNX node: Resize__47
[04/01/2021-20:54:37] [V] [TRT] ImporterContext.hpp:116: Registering tensor: Resize__47:0 for ONNX tensor: Resize__47:0
[04/01/2021-20:54:37] [V] [TRT] ModelImporter.cpp:179: Resize__47 [Resize] outputs: [Resize__47:0 -> (-1, -1, -1, -1)],
[04/01/2021-20:54:37] [V] [TRT] ModelImporter.cpp:103: Parsing node: StatefulPartitionedCall/Preprocessor/ResizeImage/resize/Squeeze [Squeeze]
[04/01/2021-20:54:37] [V] [TRT] ModelImporter.cpp:119: Searching for input: Resize__47:0
[04/01/2021-20:54:37] [V] [TRT] ModelImporter.cpp:119: Searching for input: const_starts__3991
[04/01/2021-20:54:37] [V] [TRT] ModelImporter.cpp:125: StatefulPartitionedCall/Preprocessor/ResizeImage/resize/Squeeze [Squeeze] inputs: [Resize__47:0 -> (-1, -1, -1, -1)], [const_starts__3991 -> (1)],
terminate called after throwing an instance of 'std::out_of_range'
what(): Attribute not found: axes
I’ve read, that fixing the input might solve the problem. So I added this line to my onnx_graphsurgeon file (I wasn’t sure about the shape, so I tried [1,3,320,320] too):
graph.inputs[0].shape=[1,320,320,3]
Unfortunately the parser throws the same error.
- What can I do to solve this?
- Is there a better way to deploy a retrained model from the tensorflow 2 object detection api in a jetson environment?
- From the release notes of Tensorrt (Release Notes :: NVIDIA Deep Learning TensorRT Documentation) I get that it was only testet with tf1.15. Might this cause the problem, since I am using tf 2.4.1 on my machine.
I would really appreciate some guidance.