Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tensorflow-hub model to frozen graph #16

Open
ClarkChin08 opened this issue Aug 12, 2020 · 0 comments
Open

tensorflow-hub model to frozen graph #16

ClarkChin08 opened this issue Aug 12, 2020 · 0 comments

Comments

@ClarkChin08
Copy link

ClarkChin08 commented Aug 12, 2020

Hi lei mao:
Thanks for your blog <<Save, Load and Inference From TensorFlow Frozen Graph>> , that benefits a lot to me as I’m enabling
a style transfer model from tf-hub.
I come across some problems, simply using codes it’s like this:

import tensorflow_hub as hub
hub_handle = 'https://hub.tensorflow.google.cn/google/magenta/arbitrary-image-stylization-v1-256/2’
style_model = hub.load(hub_handle)

The style_model is a saved model: tensorflow.python.saved_model.load.Loader._recreate_base_user_object._UserObject
we can use the style_model to get stylized image prediction:

outputs = style_model(tf.constant(content_image), tf.constant(style_image))

I can also get the signatures as a function to run the model

func = style_model.signatures['serving_default']
outputs = func(tf.constant(content_image), tf.constant(style_image))

Then I try to freeze the func.graph but I come across problems

[op.type for op in func.graph.get_operations()]

The feeds and variables all become Placeholder!

['Placeholder', 'Placeholder', 'Placeholder', 'Placeholder', 'Placeholder’….. 'StatefulPartitionedCall', 'Identity']

Do you know how this happened? Or any solutions about this issue? Many thanks!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant