Skip to content

Instantly share code, notes, and snippets.

@akakitani
Created June 19, 2019 19:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akakitani/fd26d489267bea3d00b6db8a4616fced to your computer and use it in GitHub Desktop.
Save akakitani/fd26d489267bea3d00b6db8a4616fced to your computer and use it in GitHub Desktop.
saved_model_to_tflite.py
graph_def_file =model_name.pb
input_arrays = [“input_tensor_name”] # this array can have more than one input name if the model requires multiple inputs
output_arrays = [“output_tensor_name”] # this array can have more than one input name if the model has multiple outputs
converter = lite.TFLiteConverter.from_frozen_graph(
graph_def_file, input_arrays, output_arrays)
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment