1
votes

**Tf to tflite Conversion issue

I am running tensorflow version 1.13 and i have provide the graph file path and input arrays and output arrays,input shapes required for tf lite**

input_arrays=['DecodeJpeg/contents']#Input tensor   
output_arrays=['final_result']#output tensor

converter=tf.contrib.lite.TFLiteConverter.from_frozen_graph(graph_def_file,input_arrays,output_arrays,input_shapes={'DecodeJpeg/contents':()})

tflite_model = converter.convert()   
open("converted_model.tflite", "wb").write(tflite_model)   

Here converter.convert() throws me below error

if not shape or not shape.as_list():
raise ValueError("Provide an input shape for input array "
 "'{0}'.".format(_tensor_name(tensor)))
       shape_list = shape.as_list()
    if None in shape_list[1:]:

ValueError: Provide an input shape for input array 'DecodeJpeg/contents'.

1

1 Answers

0
votes

In your code you have to assign input shape for you input array. Please change input_shapes={'DecodeJpeg/contents':()} to input_shapes={'DecodeJpeg/contents':None} or according to your input shape like this input_shapes={'DecodeJpeg/contents':[1,16,16,3]}.