2
votes

I'm creating a model from using holy-edge. Then, I would like to convert this model to Tensorflow Lite for Mobile usage. I followed steps here and was able to convert the model to .pg file with output_node_names=predictions . For next step, I need to convert .pg file to Tensorflow Lite model by using toco but I don't know where to find some required parameters such as input_array, output_array, input_shape and output_node_names.

Does anyone know how to convert a HED model to Tensorflow Lite mode? Please help.

Thanks, Duc

1

1 Answers

0
votes

You can use this code:

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())

In my case I had

output name: SemanticPredictions
input name: ImageTensor