如何从冻结的推理图中获取输入形状以进行tflite转换

时间:2020-03-29 08:33:35

标签: python tensorflow

我是编程的新手,我想问一下如何从冻结的推理图中获取输入形状,我将用它来将其转换为tflite格式。您是否有任何命令行或代码来确定它,就像确定输入和输出数组一样?我将所得的输入形状放入代码{'image_tensor' : [1, image_size, image_size, 3]}的这一部分。任何答案将不胜感激,谢谢您

(下面是我用于转换为tflite的代码)

import tensorflow as tf

localpb = 'frozen_inference_graph.pb'
tflite_file = 'frozen_inference_graph.lite'

print("{} -> {}".format(localpb, tflite_file))

converter = tf.lite.TFLiteConverter.from_frozen_graph(localpb, ['image_tensor'], ['raw_detection_scores'], {'image_tensor' : [1, image_size, image_size, 3]} )

tflite_model = converter.convert()

0 个答案:

没有答案