Expand SavedModel retrained start for google cloud ml engine

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_nameand tag, but no one worked.

Code added to the original source code,

  ### DEFINE SAVED MODEL SIGNATURE

  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'
  )


  ### SAVE OUT THE MODEL

  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, .

, ?

+6
1

signature_def_map "serve_default", signature_constants DEFAULT_SERVING_SIGNATURE_DEF_KEY:

b.add_meta_graph_and_variables(sess,
                               [tf.saved_model.tag_constants.SERVING],
                               signature_def_map={'serving_default': signature})
+7

Source: https://habr.com/ru/post/1016002/


All Articles