tf读取图片,matplotlib可视化
代码:
"""
使用tf读取图片
"""
import tensorflow as tf
import matplotlib.pyplot as plt
image_raw = tf.gfile.FastGFile(rC:UsersAdministratorDesktopmeatwicemeatwice 1newCognition
einforcement_learning
ew_test_tensorflowpicture_set023260d27ab8087b5b7d73b837094d.png,
rb).read()
img = tf.image.decode_jpeg(image_raw)
with tf.Session() as sess:
img1 = img.eval()
# print(img1)
print(img1.shape)
plt.figure(1)
plt.imshow(img1)
plt.show() """ 使用tf读取图片 """ import tensorflow as tf import matplotlib.pyplot as plt image_raw = tf.gfile.FastGFile(rC:UsersAdministratorDesktopmeatwicemeatwice 1newCognition
einforcement_learning
ew_test_tensorflowpicture_set023260d27ab8087b5b7d73b837094d.png, rb).read() img = tf.image.decode_jpeg(image_raw) with tf.Session() as sess: img1 = img.eval() # print(img1) print(img1.shape) plt.figure(1) plt.imshow(img1) plt.show()
显示:
代码: """ 使用tf读取图片 """ import tensorflow as tf import matplotlib.pyplot as plt image_raw = tf.gfile.FastGFile(rC:UsersAdministratorDesktopmeatwicemeatwice 1newCognition einforcement_learning ew_test_tensorflowpicture_set023260d27ab8087b5b7d73b837094d.png, rb).read() img = tf.image.decode_jpeg(image_raw) with tf.Session() as sess: img1 = img.eval() # print(img1) print(img1.shape) plt.figure(1) plt.imshow(img1) plt.show() 显示:上一篇:
IDEA上Java项目控制台中文乱码
