lucid icon indicating copy to clipboard operation
lucid copied to clipboard

Saving modelzoo model to .pb and mailing list

Open Uiuran opened this issue 5 years ago • 3 comments

Hi, maybe this is a silly question out of my ignorance, if it is pls pardon me.

I cant save modelzoo .pb graphs like i do with keras models loaded from applications module. The .pb written from modelzoo Model is empty. Is there some trick iam missing ? since modelzoo and keras Models inherit from Tensorflow Model is no sense that tf.train.write_graph cant save modelzoo in .pb.

Is there a mailing list for Lucid ? Maybe it would be a more appropriated place to questions like this.

Thank you cheers.

Uiuran avatar May 07 '19 20:05 Uiuran

Hi, If i understand correctly, you are trying to save modelzoo model as protocol buffers? If yes, all the modelzoo are already saved as .pb and uploaded to GCP! For example, ResnetV2_50_slim graph is uploaded at gs://modelzoo/vision/slim_models/ResnetV2_50.pb. You can just download it. If you are still looking at saving the graph yourself, i don't think you directly pass the lucid model to tf.train.write_graph and save it. As a hack, all lucid models, after loading, should have graph def stored in model.graph_def. You can try to use this and save it. Good luck!

hegman12 avatar May 09 '19 10:05 hegman12

that's right, however i still thinking on change model(run/eval) -> save model again, so that's why i found the question pertinent. Already tried the model.graph_def saving, empty .pb, i think iam missing variable initialization and them freezing (turning on constants).

Uiuran avatar May 10 '19 02:05 Uiuran

Hi @Uiuran! It sounds like you want to:

(1) Load a model from lucid modelzoo (2) Run inference on some examples. (3) Re-save the model using tf.train.write_graph

Is that right?

My first thought is that running inference shouldn't change the model, so I think you can avoid this.

Regarding your exporting problems, I don't have much experience using tf.train.write_graph but I would guess that, if you're somehow getting empty .pb files, that you're somehow passing it empty graph_defs. If you're passing model.graph_def, it's possible that it is None if you haven't loaded the model. If you're using sess.graph_def, it may mean that you haven't loaded the model into your present default graph.

colah avatar May 18 '19 19:05 colah