@[TOC](pb模型转tflite(fp16, uint8))
pb模型转tflite
def convert_pb_into_tflite_file():
# create a session
input_tensor_name=["pb网络输入名"]
input_tensor_shape={
"pb网络输入名":[x,x,x,x]} #输入shape
out_tensor_name = ["pb网络输出名"]
converter = tf.lite.TFLiteConverter.from_frozen_graph(pb_PATH,
input_tensor_name, out_tensor_name,
input_shapes = input_tensor_shape)
tflite_model = converter.convert()
with open(OUTPUT_FILE_PATH,"wb") as f:
f.write(tflite_model)
pb模型转tflite-fp16
def convert_pb_into_tflite_file():
# create a session
input_tensor_name=["pb网络输入名"]
input_tensor_shape={
"pb网络输入名":[x,x,x,x]} #输入shape
out_tensor_name = ["pb网络输出名"]
converter