【问题标题】:How to convert a HED model to Tensorflow Lite model如何将 HED 模型转换为 Tensorflow Lite 模型
【发布时间】:2019-04-14 22:16:48
【问题描述】:

我正在使用holy-edge 创建一个模型。然后,我想将此模型转换为 Tensorflow Lite 以供移动使用。我关注steps here 并能够使用 output_node_names=predictions 将模型转换为 .pg 文件。对于下一步,我需要使用toco 将 .pg 文件转换为 Tensorflow Lite 模型,但我不知道在哪里可以找到一些必需的参数,例如 input_array、output_array、input_shape 和 output_node_names。

有人知道如何将 HED 模型转换为 Tensorflow Lite 模式吗?请帮忙。

谢谢, 杜克

【问题讨论】:

    标签: tensorflow tensorflow-lite


    【解决方案1】:

    您可以使用此代码:

    import tensorflow as tf
    gf = tf.GraphDef()   
    m_file = open('frozen_inference_graph.pb','rb')
    gf.ParseFromString(m_file.read())
    
    with open('somefile.txt', 'a') as the_file:
        for n in gf.node:
            the_file.write(n.name+'\n')
    
    file = open('somefile.txt','r')
    data = file.readlines()
    print ("\noutput name = ")
    print (data[len(data)-1])
    
    print ("Input name = ")
    file.seek ( 0 )
    print (file.readline())
    

    在我的情况下,我有

    output name: SemanticPredictions
    input name: ImageTensor
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-18
      • 2020-12-03
      • 2019-05-14
      • 1970-01-01
      • 1970-01-01
      • 2020-10-14
      相关资源
      最近更新 更多