Advertisement

pb模型转tflite(fp16, uint8)

阅读量:

@[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)
    

全部评论 (0)

还没有任何评论哟~