tf36:使用tensorbord显示图片

下面代码是使用tensorboard显示图片:

#coding=utf-8
import tensorflow as tf

# 获取图片数据
file = open('lp.jpg', 'rb')
data = file.read()
file.close()

# 图片处理
image = tf.image.decode_jpeg(data, channels=3)
image = tf.expand_dims(image, 0)

# 添加到日志中
sess = tf.Session()
writer = tf.summary.FileWriter('logs')
summary_op = tf.summary.image("image1", image)

# 运行并写入日志
summary = sess.run(summary_op)
writer.add_summary(summary)

# 关闭
writer.close()
sess.close()


在终端输入:tensorboard --logd=logs



更多学习资料可以看:http://geek.csdn.net/news/detail/197155

还可以看:https://segmentfault.com/a/1190000008302430


猜你喜欢

转载自blog.csdn.net/u014365862/article/details/79532380