Closed prathmesh36 closed 5 years ago
A few questions:
A few hours back I was able to resolve the issue it was with the model, I had trained the model using keras so after training while obtaining the saved model directory (containing the .pb file) from the .h5 model I had referred this code
model = tf.keras.models.load_model('my_model.h5') export_path = 'saved_server_model_new/1' inputs={'input_image': model.input} outputs={t.name: t for t in model.outputs} #OLD outputs={"output_class": t for t in model.outputs} #NEW
with tf.keras.backend.get_session() as sess: tf.saved_model.simple_save( sess, export_path, inputs, outputs)
by changing the #OLD code to #NEW in the above code, it worked. I am new to Google Cloud ML Engine I guess it was some issue with the naming of output using t.name gave the output name as activation_2/softmax:0 which must have conflicted somewhere with the code. Thanks for your help though, ill close the issue.
ERROR: (gcloud.ml-engine.predict) Expected ) in projection expression [table(activation_2 HERE /Softmax:0)]. This Error occured while i was trying online prediction after deploying my model on google cloud storage bucket. The same error appears while performing local predictions as well. The input to this model is a json file which contains the image to be classify as follows {"input_image": [[[0.0], [0.0], [0.0], [0.0], [0.0], [0.0], .............. ]]}
Source code / logs Prathmeshs-MacBook-Air:fyp prathmeshmhapsekar$ gcloud ml-engine predict --model $MODEL_NAME --version $VERSION_NAME --json-instances $INPUT_DATA_FILE --verbosity debug DEBUG: Running [gcloud.ml-engine.predict] with arguments: [--json-instances: "data.json", --model: "dcr", --verbosity: "debug", --version: "dcr"] DEBUG: (gcloud.ml-engine.predict) Expected ) in projection expression [table( activation_2 HERE /Softmax:0 )]. Traceback (most recent call last): File "/Users/prathmeshmhapsekar/Documents/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 987, in Execute resources = calliope_command.Run(cli=self, args=args) File "/Users/prathmeshmhapsekar/Documents/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 797, in Run display_info=self.ai.display_info).Display() File "/Users/prathmeshmhapsekar/Documents/google-cloud-sdk/lib/googlecloudsdk/calliope/display.py", line 450, in Display self._InitPrinter() File "/Users/prathmeshmhapsekar/Documents/google-cloud-sdk/lib/googlecloudsdk/calliope/display.py", line 424, in _InitPrinter self._format, defaults=self._defaults, out=log.out) File "/Users/prathmeshmhapsekar/Documents/google-cloud-sdk/lib/googlecloudsdk/core/resource/resource_printer.py", line 222, in Printer console_attr=console_attr) File "/Users/prathmeshmhapsekar/Documents/google-cloud-sdk/lib/googlecloudsdk/core/resource/table_printer.py", line 188, in init defaults=defaults) File "/Users/prathmeshmhapsekar/Documents/google-cloud-sdk/lib/googlecloudsdk/core/resource/resource_printer_base.py", line 282, in Printer return self._printer(*args, *kwargs) File "/Users/prathmeshmhapsekar/Documents/google-cloud-sdk/lib/googlecloudsdk/core/resource/resource_printer.py", line 204, in Printer defaults=defaults, symbols=resource_transform.GetTransforms())) File "/Users/prathmeshmhapsekar/Documents/google-cloud-sdk/lib/googlecloudsdk/core/resource/resource_projector.py", line 552, in Compile expression, defaults=defaults, symbols=symbols, compiler=Compile) File "/Users/prathmeshmhapsekar/Documents/google-cloud-sdk/lib/googlecloudsdk/core/resource/resource_projection_parser.py", line 533, in Parse compiler=compiler).Parse(expression) File "/Users/prathmeshmhapsekar/Documents/google-cloud-sdk/lib/googlecloudsdk/core/resource/resource_projection_parser.py", line 495, in Parse self._ParseKeys() File "/Users/prathmeshmhapsekar/Documents/google-cloud-sdk/lib/googlecloudsdk/core/resource/resource_projection_parser.py", line 438, in _ParseKeys self._lex.Annotate())) ExpressionSyntaxError: Expected ) in projection expression [table( activation_2 HERE /Softmax:0 )]. ERROR: (gcloud.ml-engine.predict) Expected ) in projection expression [table( activation_2 HERE* /Softmax:0 )].
To Reproduce Steps to reproduce the behavior:
Expected behavior Prediction of the image given in the input.
System Information