Deprecated tf.Session removed in label_image.py
This commit is contained in:
parent
4257acce5c
commit
82262e0244
@ -58,7 +58,7 @@ def read_tensor_from_image_file(file_name,
|
|||||||
dims_expander = tf.expand_dims(float_caster, 0)
|
dims_expander = tf.expand_dims(float_caster, 0)
|
||||||
resized = tf.image.resize_bilinear(dims_expander, [input_height, input_width])
|
resized = tf.image.resize_bilinear(dims_expander, [input_height, input_width])
|
||||||
normalized = tf.divide(tf.subtract(resized, [input_mean]), [input_std])
|
normalized = tf.divide(tf.subtract(resized, [input_mean]), [input_std])
|
||||||
sess = tf.Session()
|
sess = tf.compat.v1.Session()
|
||||||
result = sess.run(normalized)
|
result = sess.run(normalized)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
@ -128,7 +128,7 @@ if __name__ == "__main__":
|
|||||||
input_operation = graph.get_operation_by_name(input_name)
|
input_operation = graph.get_operation_by_name(input_name)
|
||||||
output_operation = graph.get_operation_by_name(output_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], {
|
results = sess.run(output_operation.outputs[0], {
|
||||||
input_operation.outputs[0]: t
|
input_operation.outputs[0]: t
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user