Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
242 views
in Technique[技术] by (71.8m points)

python - How to transfer a tf.saved_model with specific signature to a tf.keras model

I'm now using this YOLOv4 code, and the inference is done (as code below) by 1) calling a tf.saved_model, and 2) get the signature wrapper for a forward pass.

self.saved_model_loaded = tf.saved_model.load(self.weights_path, tags=[tag_constants.SERVING])
self.infer = self.saved_model_loaded.signatures['serving_default']

But what should I do, if I want to simply save this model at inference mode, as a tf.keras object? I found this official tutorial a bit helpful, but still cannot figure out how...

My ultimate goal is to use tf.keras to construct a new model, where I can output both intermediate layer and final output. So I need to infer without using this signature function, i.e. making it a default setting.

Or you have other solutions? Thanks in advance!!

question from:https://stackoverflow.com/questions/65933995/how-to-transfer-a-tf-saved-model-with-specific-signature-to-a-tf-keras-model

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...