动态尺寸输入形状的tflite

时间:2020-10-12 17:49:53

标签: python tensorflow tensorflow-lite tf-lite

我正在将.pb模型转换为tflite。我在推理时使用具有完全卷积网络的图像金字塔。但它显示了此错误(不使用resize_tensor_input)

ValueError: Cannot set tensor: Dimension mismatch. Got 150 but expected 300 for dimension 1 of input 35.

在使用resize_tensor_input之后再一次在allocate_tensors()之前抛出了错误。

RuntimeError: tensorflow/lite/kernels/reshape.cc:66 num_input_elements != num_output_elements (13300 != 56550)Node number 26 (RESHAPE) failed to prepare.

我的tensorflow版本是1.15.2 如何设置动态尺寸的tflite输入张量?

1 个答案:

答案 0 :(得分:0)

TFLite在2.x版本中有了很多改进,具有更好的转换器和操作支持。您可能想在TF 2.X发行版中尝试一下。

要将TF1迁移到TF2, 请检查https://www.tensorflow.org/guide/migrate