-
Notifications
You must be signed in to change notification settings - Fork 654
Support for tf.SavedModel #46
Comments
How to exactly load the TF saved model in lucid? Thanks. |
Has there been an update on this? I'm currently trying to wrap my head around freezing a tf-slim model and having no luck. Thanks. |
@xn8812 @harritaylor while I don't think I can do proper SavedModel support until TF2.0, we recently added a simple way to save a model in a lucid-compatible format. :-) I'll add more documentation as we use this functionality more, but you may already want to give it a try! Saving/exportingThe main reason importing and exporting models is so complex is that Lucid needs to know some additional metadata about your model. We now save this information in the exported model, so you need to provide it to Lucid at the time of exporting. from lucid.modelzoo.vision_base import Model
with tf.Session.as_default():
# ...load or construct your own model
Model.save("path/to/graphdef.pb", input_name, output_names, image_shape, image_value_range)
To help you find out these parameters, we built some heuristics, though they may not work in all cases: from lucid.modelzoo.vision_base import Model
with tf.Session.as_default():
# ...load or construct your own model
Model.suggest_save_args() We hope the output can be helpful in certain cases:
LoadingThis is now easy since the saved graphdef contains all the necessary information: from lucid.modelzoo.vision_base import Model
model = Model.load("path/to/graphdef.pb") |
@ludwigschubert fantastic!! Thank you very much. I managed to get the tf-slim model imported the old way after a few hours of slugging through it, but this method worked straight away. I'm now having issues with creating a greyscale visualisation for an odd shaped image, but I don't think that would warrant an issue... |
@ludwigschubert Looks like Model.save has been removed. Can you please tell if there is any alternative to it? |
Is it possible you're using a really old version of lucid? |
It looks like modelzoo could directly support the new SavedModel standard. We would still need the metadata entries in modelzoo, but no longer require manual freezing of Variables into Constants in the graph definition.
The text was updated successfully, but these errors were encountered: