I am trying to deploy a revised version of the original model on a Google Cloud engine. Gathering information from the SavedModel documentation , this link , and this post from rhaertel80, I successfully exported my retrained model to SavedModel, loaded it into a bucket, and tried to deploy it to the millimeter motor version.
This last task actually creates a version, but it throws this error:
Create Version failed. Bad model detected with error: "Error loading the model: Unexpected error when loading the model"
And when I try to get predictions from the model using the command line, I get this error message:
"message": "Field: name Error: Online prediction is unavailable for this version. Please verify that CreateVersion has completed successfully."
I made several attempts, trying different options method_name
and tag
, but no one worked.
Code added to the original source code,
in_image = graph.get_tensor_by_name('DecodeJpeg/contents:0')
inputs = {'image_bytes': tf.saved_model.utils.build_tensor_info(in_image)}
out_classes = graph.get_tensor_by_name('final_result:0')
outputs = {'prediction': tf.saved_model.utils.build_tensor_info(out_classes)}
signature = tf.saved_model.signature_def_utils.build_signature_def(
inputs=inputs,
outputs=outputs,
method_name='tensorflow/serving/predict'
)
b = saved_model_builder.SavedModelBuilder('new_export_dir')
b.add_meta_graph_and_variables(sess,
[tf.saved_model.tag_constants.SERVING],
signature_def_map={'predict_images': signature})
b.save()
, :
a trained_graph.pb
graph_def.SerializeToString()
, , , saved_model.pb
, .
, ?