【问题标题】:Tensorflow Convert .pb file to .lite file in windows using pythonTensorflow 使用 python 在 windows 中将 .pb 文件转换为 .lite 文件
【发布时间】:2019-03-12 11:15:13
【问题描述】:

当我尝试按照 Tensorflow for 诗人的说明将 .pb 文件转换为 .tflite 文件时:https://codelabs.developers.google.com/codelabs/tensorflow-for-poets-2-tflite/#2

我收到No module named 'tensorflow.contrib.lite.python.tflite_convert'

我的 TensorFlow 版本:1.10.0

我尝试运行两个命令,但结果相同:

命令 1: tflite_convert --graph_def_file=rounded_graph.pb --output_file=new_graph.lite --input_format=TENSORFLOW_GRAPHDEF --output_format=TFLITE --input_shape=1,224,224,3 --input_array=input --output_array=final_result --inference_type=FLOAT --input_data_type=FLOAT

命令 2: toco --input_file="rounded_graph.pb" --output_file="new_graph.lite" --input_format="TENSORFLOW_GRAPHDEF" --output_format="TFLITE" --input_shape="1,224,224,3" --input_array="input" --output_array="final_result" --inference_type="FLOAT" --input_data_type="FLOAT"

我在windows 中收到此错误。

请帮忙!

【问题讨论】:

    标签: python windows tensorflow


    【解决方案1】:

    最后我在windows上解决了这个问题:

    1. 打开 CMD
    2. 运行:pip install --upgrade pip
    3. 然后,运行:pip install tensorflow --upgrade

    我的 Tensorflow 新版本:1.13.0

    然后使用此链接:https://codelabs.developers.google.com/codelabs/tensorflow-for-poets-2-tflite/#2

    尝试运行以下命令tflite_convert --graph_def_file=rounded_graph.pb --output_file=new_graph.lite --input_format=TENSORFLOW_GRAPHDEF --output_format=TFLITE --input_shape=1,224,224,3 --input_array=input --output_array=final_result --inference_type=FLOAT --input_data_type=FLOAT

    如果您在 输入 中遇到任何错误,请尝试更改 input 名称和 input_shape

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-11
      • 1970-01-01
      • 2021-08-05
      • 1970-01-01
      • 1970-01-01
      • 2020-09-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多