admin管理员组文章数量:1397102
I have questions about a model obtained from TensorFlow Hub.
I am trying to use "movenet" with the following source code.
(1) The Input Shape of this model is (1, None, None, 3), but how can I fix the None part? To create a fixed TensorFlow Lite model, I want to fix the input shape to (1, 256, 256, 3).
(2) Also, I can't display the summary of this model. What should I do?
(3) I want to check the input shape and output shape after tf.saved_model.load, but when I run loaded.signatures['serving_default'], a KeyError occurs. How can I check the input shape and output shape after loading?
input_size = 256
model_url = ";
model = tfhub.load(model_url)
movenet = model.signatures['serving_default']
print(movenet.structured_input_signature)
print(movenet.structured_outputs)
tf.saved_model.save(model, './saved_model')
model.summary() # -->> ERROR
loaded = tf.saved_model.load('./saved_model')
print(list(loaded.signatures.keys())) # -->> [] # empty!
movenet = loaded.signatures['serving_default'] # -->> ERROR
print(movenet.structured_input_signature)
print(movenet.structured_outputs)
((), {'input': TensorSpec(shape=(1, None, None, 3), dtype=tf.int32, name='input')})
{'output_0': TensorSpec(shape=(1, 6, 56), dtype=tf.float32, name='output_0')}
### model.summary() # -->> ERROR
'_UserObject' object has no attribute 'summary'
File "/home/debian/sandbox/movenet/python/movenet_multi.py", line 126, in main
model.summary() # -->> ERROR
File "/home/debian/sandbox/movenet/python/movenet_multi.py", line 356, in <module>
main()
AttributeError: '_UserObject' object has no attribute 'summary'
### movenet = loaded.signatures['serving_default'] # -->> ERROR
'serving_default'
File "/home/debian/sandbox/movenet/python/movenet_multi.py", line 127, in main
movenet = loaded.signatures['serving_default'] # -->> ERROR
File "/home/debian/sandbox/movenet/python/movenet_multi.py", line 355, in <module>
main()
KeyError: 'serving_default'
本文标签:
版权声明:本文标题:tensorflow - How can I save a model with input shape (1, None, None, 3) with None fixed to 256? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744149456a2592993.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论