Skip to content Skip to sidebar Skip to footer

Convert Keras H5 To Tensorflow Pb For Batch Inference

I have a problem with making batch inference using a tensorflow protobuf graph exported from a keras h5 model. Eventhough the exported pb graph can accept multiple inputs (samples)

Solution 1:

It turns out this is due to a bug I inherited from k2tf_convert

pred[i] = tf.identity(model.output[i], name=pred_node_names[i])

should be

pred[i] = tf.identity(model.outputs[i], name=pred_node_names[i])

It seems the keras model class has both 'output' and 'outputs' members that makes this bug hard to track.

Post a Comment for "Convert Keras H5 To Tensorflow Pb For Batch Inference"