0

I trained a Pet dataset onto Google cloud, downloaded the trained model to local PC, using gcloud. Task: To classify test set, locally with the trained model

A) If I use gcloud like

    $ gcloud ml-engine local predict --model-dir=saved_model/ --json-instances=inputs.json

Error: prediction_lib.PredictionError: (4, "Exception during running the graph: invalid literal for long() with base 10: '\xff\xd8\xff\xe0'")

Nayeem
  • 91
  • 14
  • Can you provide the contents of inputs.json (feel free to "Edit out" binary blobs). – rhaertel80 Oct 26 '17 at 14:37
  • It looks like your model accepts a numpy array of a graph but the input contains some string (jpeg string?). Can you run: $ saved_model_cli show --dir ${YOUR_LOCAL_MODEL_DIR --all and paste the results here as well as a snippet of inputs.json as rhaertel80 said? – yxshi Oct 26 '17 at 16:39
  • JSON : {"b64": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAMABAADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+T ......................... – Nayeem Oct 27 '17 at 05:03
  • ```signature_def['serving_default']: The given SavedModel SignatureDef contains the following input(s): inputs['inputs'] tensor_info: dtype: DT_UINT8 shape: (-1, -1, -1, 3) name: image_tensor:0 The given SavedModel SignatureDef contains the following output(s): outputs['detection_boxes'] tensor_info: dtype: DT_FLOAT shape: (-1, 300, 4) name: detection_boxes:0 outputs['detection_classes'] tensor_info: dtype: DT_FLOAT shape: (-1, 300) name: detection_classes:0``` – Nayeem Oct 27 '17 at 05:05

1 Answers1

2

Your model does accept an array for the image, not JPG strings. Please see the answer to tensorflow serving prediction not working with object detection pets example

If you want to use your current input, you may re-export the model with --input_type encoded_image_string_tensor.

yxshi
  • 244
  • 1
  • 5