【问题标题】:tensorflow toco command for .tflite.tflite 的 tensorflow toco 命令
【发布时间】:2018-10-17 18:47:43
【问题描述】:

我正在按照TFLite Android的步骤进行操作

我无法使用 toco 命令,因此无法生成:“optimized_graph.lite”

这是我使用的命令:

    IMAGE_SIZE=224
toco \
  --graph_def_file=tf_files/retrained_graph.pb \
  --output_file=tf_files/optimized_graph.lite \
  --input_format=TENSORFLOW_GRAPHDEF \
  --output_format=TFLITE \
  --input_shape=1,${IMAGE_SIZE},${IMAGE_SIZE},3 \
  --input_array=input \
  --output_array=final_result \
  --inference_type=FLOAT \
  --input_data_type=FLOAT

错误是:

F tensorflow/contrib/lite/toco/toco.cc:46] 检查失败:parsed_toco_flags.input_file.specified() Missing required flag: input_file

我已经仔细按照说明,在 Mac OS 上,tensorflow 版本是 1.7

【问题讨论】:

  • 我在 TFLite Android codelab 的同一步骤中遇到了完全相同的错误。
  • 很遗憾,我无法尝试您的解决方案。我试图升级我的 tensorflow,但现在我遇到了其他奇怪的错误。我希望我能解决这个问题并尝试您的解决方案

标签: tensorflow toco


【解决方案1】:

我跑的时候

toco --help

我在这个命令的选项中没有看到--graph_def_file。 相反我找到了--input_file,它的意思是 输入文件(任何支持格式的模型)。对于 Protobuf 格式,无论文件扩展名如何,都支持文本和二进制。

在我将--graph_def_file 替换为--input_file 后,该命令起作用并且我得到了一个optimized_graph.lite 文件。

下面是完整的命令。

toco \
  --input_file=tf_files/retrained_graph.pb \
  --output_file=tf_files/optimized_graph.lite \
  --input_format=TENSORFLOW_GRAPHDEF \
  --output_format=TFLITE \
  --input_shape=1,${IMAGE_SIZE},${IMAGE_SIZE},3 \
  --input_array=input \
  --output_array=final_result \
  --inference_type=FLOAT \
  --input_data_type=FLOAT

【讨论】:

  • 一直在寻找解决方案。谢谢男人。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-07
  • 1970-01-01
  • 1970-01-01
  • 2020-07-13
  • 2018-07-27
相关资源
最近更新 更多