Skip to content

Instantly share code, notes, and snippets.

@seatedro
Created October 5, 2020 15:06
Show Gist options
  • Save seatedro/8b1918bf3f13545bf667f86f2af77a6d to your computer and use it in GitHub Desktop.
Save seatedro/8b1918bf3f13545bf667f86f2af77a6d to your computer and use it in GitHub Desktop.
Clean-up checkpoints
output_directory = 'exported-models/'
# goes through the model is the training/ dir and gets the last one.
# you could choose a specfic one instead of the last
lst = os.listdir("models/my_mobilenet/")
# print(lst)
lst = [l for l in lst if 'ckpt-' in l and '.index' not in l]
steps=np.array([int(re.findall('\d+', l)[0]) for l in lst])
last_model = lst[steps.argmax()]
last_model_path = os.path.join('models/my_mobilenet', last_model)
# print(last_model_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment