I want to predict jpeg image in cloud-ml.
My training model is the initial model, and I would like to send the entrance to the first level of the chart: 'DecodeJpeg/contents:0'(where I need to send a jpeg image). I set this layer as a possible input by adding to retrain.py :
inputs = {'image_bytes': 'DecodeJpeg/contents:0'}
tf.add_to_collection('inputs', json.dumps(inputs))
Then I save the training results in two files (export and export.meta) with:
saver.save(sess, os.path.join(output_directory,'export'))
and I create a model in cloud-ml using these files.
As suggested in some posts ( here , here and here from the official Google cloud blog) I'm trying to make a forecast using
gcloud beta ml predict --json-instances=request.json --model=MODEL
where the instance is a jpeg image decoded in base64 format with:
python -c 'import base64, sys, json; img = base64.b64encode(open(sys.argv[1], "rb").read()); print json.dumps({"key":"0", "image_bytes": {"b64": img}})' image.jpg &> request.json
:
error: 'Prediction failed: '
? ?
this post , cloud-ml base64 jpeg image_bytes. ? , ?