I am able to train my model and use ML Engine for prediction but my results don\'t include any identifying information. This works fine when submitting one row at a time for
Great question. The Cloud ML Engine flowers sample does this, by using the tf.identity operation to pass a string straight through from input to output. Here are the relevant lines during graph construction.
keys_placeholder = tf.placeholder(tf.string, shape=[None])
inputs = {
'key': keys_placeholder,
'image_bytes': tensors.input_jpeg
}
# To extract the id, we need to add the identity function.
keys = tf.identity(keys_placeholder)
outputs = {
'key': keys,
'prediction': tensors.predictions[0],
'scores': tensors.predictions[1]
}
For batch prediction you need to insert "key": "some_key_value" into your instance records. For online prediction you would query the above graph with a JSON request like:
{'instances' : [
{'key': 'first_key', 'image_bytes' : {'b64': ...}},
{'key': 'second_key', 'image_bytes': {'b64': ...}}
]
}