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
我该如何解决这个问题?
答案 0 :(得分:0)
将模型输入(image_tensor占位符)更改为数据类型为tf.float32。