I have been trying to follow, https://www.tensorflow.org/lite/examples/object_detection/overview#model_customization all day to convert any of the tensorflow Zoo models to a TensorFlow lite model for running on Android with no luck.
I downloaded several of the models from here, https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf1_detection_zoo.md (FYI, Chrome does not let you down these links as not https, I had to right click Inspect the link and click on the link in inspector)
I have the script,
import tensorflow as tf
converter = tf.lite.TFLiteConverter.from_frozen_graph(
graph_def_file='frozen_graph.pb',
input_shapes = {'normalized_input_image_tensor':[1,300,300,3]},
input_arrays = ['normalized_input_image_tensor'],
output_arrays = ['TFLite_Detection_PostProcess','TFLite_Detection_PostProcess:1', 'TFLite_Detection_PostProcess:2','TFLite_Detection_PostProcess:3']
)
tflite_model = converter.convert()
with open('model.tflite', 'wb') as f:
f.write(tflite_model)
but gives the error, ValueError: Invalid tensors 'normalized_input_image_tensor' were found
so the lines, input_shapes = {'normalized_input_image_tensor':[1,300,300,3]}, input_arrays = ['normalized_input_image_tensor'], output_arrays = ['TFLite_Detection_PostProcess','TFLite_Detection_PostProcess:1', 'TFLite_Detection_PostProcess:2','TFLite_Detection_PostProcess:3']
must be wrong, need a different shape, but how do I get this for each of the zoo models, or is there some preconvert code I need to run first?
from How to convert frozen graph to TensorFlow lite
No comments:
Post a Comment