Skip to content

Instantly share code, notes, and snippets.

@Alakhator
Created April 6, 2020 07:02
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Alakhator/e9b2a05e3c1929817b74dc3b76f45add to your computer and use it in GitHub Desktop.
def load_model(model_name):
base_url = 'http://download.tensorflow.org/models/object_detection/'
model_file = model_name + '.tar.gz'
model_dir = tf.keras.utils.get_file(
fname=model_name,
origin=base_url + model_file,
untar=True)
model_dir = pathlib.Path(model_dir)/"saved_model"
model = tf.saved_model.load(str(model_dir))
model = model.signatures['serving_default']
return model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment