繁体   English   中英

无法将冻结的模型文件 .pb 转换为 .tflite

[英]Can't convert frozen model file .pb to .tflite

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

我该如何解决这个问题?

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM