【问题标题】:Can't convert frozen model file .pb to .tflite无法将冻结的模型文件 .pb 转换为 .tflite
【发布时间】:2020-03-23 04:48:24
【问题描述】:
import tensorflow as tf

path = "C:/Users/LAWSSSS/Desktop/convert_pb_2_tflite/frozen_inference_graph-SteelRoll.pb"

inputs = ["image_tensor"]
outputs = ["detection_boxes"]

converter = tf.lite.TFLiteConverter.from_frozen_graph(path, inputs, outputs, input_shapes={"image_tensor":[1,640,360,3]})
converter.post_training_quantize = True
tflite_model = converter.convert()

open("frozen_inference_graph-SteelRoll.tflite", "wb").write(tflite_model)

总的来说,我是 Tensorflow 的新手。我尝试使用上面的代码将 .pb 转换为 .tflite。但是,我收到一个错误:

array.data_type == array.final_data_type Array "image_tensor" has mis-matching actual and final data types (data_type=uint8, final_data_type=float).
Fatal Python error: Aborted

我该如何解决这个问题?

【问题讨论】:

    标签: python tensorflow tensorflow-lite toco


    【解决方案1】:

    将模型输入(im​​age_tensor 占位符)更改为数据类型为 tf.float32。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-23
      • 2018-12-09
      • 1970-01-01
      • 2019-01-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多