3

I've successfully deployed locally trained TF model to ML-engine however upon invoking test command for prediction:

gcloud ml-engine predict --model=$modelname --text-instances=test.txt

I got this error: { "error": "Prediction failed: Error processing input: Expected float32, got u'0.18189938740640676506643558241194 … 0.23270735134367070973127056277008' of type 'unicode' instead." }

The model expects an input of shape (28, 28, 1)

If someone could clarify what I'm doing wrong or could provide an example of correct format for input .txt or .json for this kind of data? Thanks in advance!

  • Looks like you are sending your data as a string. It would be helpful to see how you exactly you defined your inputs (in particular how many inputs you have and their names), but best I can tell, you need to use --json-instances and it should look something like: [[[1.1, 1.2, ..., 1.28], ..., [28.1, 28.2, ..., 28.2]]] Two further notes: you'll need None to be the outer dimension of your input. There are also some tips on different encodings here: https://stackoverflow.com/a/46222990/1399222, but your input is small enough it may not make much of a difference. – rhaertel80 Oct 18 '17 at 18:20

0 Answers0