0

I'm new to Google Cloud ML Engine. I'm deploying my first model and I trained a model that receives images in float32 format. I'm following ML Engine tutorial but the they encode the image in base64. Is there a way to encode it using float32? Or can I create a task that is in float32?

python -c 'import base64, sys, json; img = base64.b64encode(open(sys.argv[1], "rb").read()); print json.dumps({"inputs": {"key":"0", "image_bytes": {"b64": im g}}})' flower.jpg &> request.json
Daniel Zapata
  • 812
  • 3
  • 9
  • 31

1 Answers1

0

There are multiple ways to encode image data, some more efficient than others. These are outlined in this answer. You are looking for the "Raw Tensor Encoded AS JSON" section, which shows how to export your model and also how to construct the JSON. Please also consider the tradeoff of the inefficiency of using floats in JSON and consider the alternative approaches.

rhaertel80
  • 8,254
  • 1
  • 31
  • 47