onnx 转 pb 错误记录


0、版本错误

查看每个版本说明下载安装相关库,类似这种:onnx-tensorflow/support_status_v1_10_0.md at main · onnx/onnx-tensorflow (github.com)

1、RuntimeError: Resize coordinate_transformation_mode=pytorch_half_pixel is not supported in Tensorflow

实在不知道怎么办修改源码使他不报错试试,onnx-tensorflow-1.6.0\onnx_tf\handlers\backend\resize.py,79行

  # coordinate_transformation_mode = node.attrs.get(
      #     "coordinate_transformation_mode", "half_pixel")
      coordinate_transformation_mode = "half_pixel"
      cubic_coeff_a = node.attrs.get("cubic_coeff_a", -0.75)
      exclude_outside = node.attrs.get("exclude_outside", 0)
      # mode = node.attrs.get("mode", "nearest")
      mode = "linear"

2、 type to Tensor. Contents: [1, None, 1, 1]. Consider casting elements to a supported 

参照:Add dynamic shape support to ConvTranspose and BatchNormalization · onnx/onnx-tensorflow@6c1213e (github.com),更改源码;

再参照:Fix InstanceNormalization unknown channel size issue · chinhuang007/onnx-tensorflow@fb1cee9 (github.com),更改源码。