onnx-tensorrt
onnx-tensorrt copied to clipboard
Assertion failed: (transformationMode != "tf_half_pixel_for_nn" || nearest_mode == "round_prefer_floor") && "This version of TensorRT only support round_prefer_floor nearest mode in tf_half_pixel_for_nn!"
Description
[04/22/2023-00:47:09] [E] [TRT] ModelImporter.cpp:768: While parsing node number 117 [Resize -> "Resize__610:0"]: [04/22/2023-00:47:09] [E] [TRT] ModelImporter.cpp:769: --- Begin node --- [04/22/2023-00:47:09] [E] [TRT] ModelImporter.cpp:770: input: "StatefulPartitionedCall/model_1/relu1/Relu:0" input: "const_empty_float__602" input: "const_empty_float__602" input: "Concat__609:0" output: "Resize__610:0" name: "Resize__610" op_type: "Resize" attribute { name: "coordinate_transformation_mode" s: "tf_half_pixel_for_nn" type: STRING } attribute { name: "exclude_outside" i: 0 type: INT } attribute { name: "mode" s: "nearest" type: STRING } attribute { name: "nearest_mode" s: "floor" type: STRING } domain: ""
[04/22/2023-00:47:09] [E] [TRT] ModelImporter.cpp:771: --- End node --- [04/22/2023-00:47:09] [E] [TRT] ModelImporter.cpp:774: ERROR: builtin_op_importers.cpp:3770 In function importResize: [8] Assertion failed: (transformationMode != "tf_half_pixel_for_nn" || nearest_mode == "round_prefer_floor") && "This version of TensorRT only support round_prefer_floor nearest mode in tf_half_pixel_for_nn!" [04/22/2023-00:47:09] [E] Failed to parse onnx file
Environment
TensorRT Version:8.6 ONNX-TensorRT Version / Branch:latest GPU Type nvidia rtx A5000 Nvidia Driver Version 525: CUDA Version 12.0 CUDNN Version 8.6 L. Ubuntu + 20.04
TensorFlow + TF2ONNX Version (if applicable): latest #################>>>>>>>>>>>>> changing to previous version the bug goes away but many hours of work
Relevant Files
Steps To Reproduce
build tensorrt /usr/src/tensorrt/bin ./trtexec --onnx=<model_path> --saveEngine=<engine_path> --fp16 --shapes=input_1:1x256x256x3
here the link to the model: https://drive.google.com/drive/folders/1lM_7tpq4gzYl0E7ZsOys34Q-98WJysi6?usp=sharing write me and i'll give you access
Any support for this issue? I am encountering the same problem
+1
This seems to be directly related to https://github.com/onnx/tensorflow-onnx/pull/2130 which was included in release v1.14.0. Running tf2onnx on the immediate older release worked for me
+1
This seems to be directly related to onnx/tensorflow-onnx#2130 which was included in release v1.14.0. Running tf2onnx on the immediate older release worked for me
I've been facing the same issue I reverted my tf2onnx to v1.13.0 however this didn't seem to work. I've been using tf=2.11, onnx=1.14 and the model has been trained in Keras, saved in the saved_model format - it converts fine but fails at the serialization stage. Does anyone know of a fix?
Solved this problem, in tf2onnx/onnx_opset/nn.py, line 1438, change "tf_half_pixel_for_nn" to "half_pixel". My reasoning for why this works is that in opset 13 the tf_half_pixel_for_nn attribute was removed (https://github.com/onnx/onnx/issues/3924), meaning that attribute should be changed. I have managed to use the latest version of tf2onnx and tensorrt to convert a model successfully into a tensorrt engine and perform inference