TensorFlow: Optimize for Inference a SavedModel exported by Estimator

Viewed 1977

I'm trying to optimize a saved graph for inference, so I can use it in Android.

My first attempt at using the optimize_for_inference script failed with

google.protobuf.message.DecodeError: Truncated message

So my question is whether the input/output nodes are wrong or the script cannot handle SavedModels (although it's the same extension as a frozen graph .pb)

Regarding the first: since with Estimators we provide input_fn instead of the data itself, which should be considered the input? The first tf operation on it? Like:

x = x_dict['gestures']

# Data input is a 1-D vector of x_dim * y_dim features ("pixels")
# Reshape to match format [Height x Width x Channel]
# Tensor input become 4-D: [Batch Size, Height, Width, Channel]
x = tf.reshape(x, shape=[-1, x_dim, y_dim, 1], name='input')

(...)

pred_probs = tf.nn.softmax(logits, name='output')

BTW: if there is something different in loading a SavedModel in Android, I'd like to know too.

Thank you in advance!

1 Answers
Related