【问题标题】:Unable to convert the tensorflow model to tflite无法将 tensorflow 模型转换为 tflite
【发布时间】:2019-06-17 12:56:44
【问题描述】:

张量的输入大小与张量的输出大小不匹配

我在命令提示符下执行了以下操作

tflite_convert /
 --output_file=C:\Users\TS-PC04\Desktop\toutput.tflite /
--graph_def_file=C:\Users\TS-PC04\Desktop\t.pb /
 --input_shape=1,513,513,3 /
 --input_arrays=ImageTensor /
 --output_arrays=SemanticPredictions

我得到的错误是 检查失败:input_shape.dims().size() == op->size.size() (4 vs. 3)。

【问题讨论】:

  • 输入的形状必须是一个列表,而不是一个字符串。
  • 我改了,还是一样的错误
  • 不,应该是[1,513,513,3]
  • 它不应该是列表看到这个link。此外,它也没有将错误视为 ValueError: invalid literal for int() with base 10: '[1'
  • 您可以尝试完全省略--input_shape。但最有可能的是,转换器期望--input_shape=513,513,3

标签: python-3.x tensorflow tensorflow-lite


【解决方案1】:

pip install --upgrade tensorflow.
这对我有用,我成功地将 .pb 转换为 .tflite

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-06
    • 2020-12-03
    • 2021-02-13
    • 2019-09-05
    • 2020-09-10
    • 1970-01-01
    • 2019-07-21
    • 2018-08-17
    相关资源
    最近更新 更多