Deprecated tf.Session removed in label_image.py

This commit is contained in:
Siju Samuel 2019-07-10 16:32:13 +05:30
parent 4257acce5c
commit 82262e0244

View File

@ -58,7 +58,7 @@ def read_tensor_from_image_file(file_name,
dims_expander = tf.expand_dims(float_caster, 0)
resized = tf.image.resize_bilinear(dims_expander, [input_height, input_width])
normalized = tf.divide(tf.subtract(resized, [input_mean]), [input_std])
sess = tf.Session()
sess = tf.compat.v1.Session()
result = sess.run(normalized)
return result
@ -128,7 +128,7 @@ if __name__ == "__main__":
input_operation = graph.get_operation_by_name(input_name)
output_operation = graph.get_operation_by_name(output_name)
with tf.Session(graph=graph) as sess:
with tf.compat.v1.Session(graph=graph) as sess:
results = sess.run(output_operation.outputs[0], {
input_operation.outputs[0]: t
})