tensorboard-理解tensorboard IMAGE标签
tensorboard-Understanding tensorboard IMAGE tag
我正在使用 tensorboard 可视化我的火车图像(cifar10 数据集)。但是 TensorBoard 向我展示了一些非常奇怪的图像。下面是屏幕截图。
the strange images
这里是一些相关的代码。注意DISPLAY_STEP
是10,BATCH_SIZE
是64。
x = tf.placeholder(tf.float32, shape=[None, N_FEATURES], name='x')
x_image = tf.reshape(x, [-1, 32, 32, 3])
tf.summary.image('input', x_image, max_outputs=BATCH_SIZE)
y = tf.placeholder(tf.float32, [None, N_CLASSES], name='labels')
'''There is other code.'''
with tf.Session() as sess:
sess.run(init)
summary_writer = tf.summary.FileWriter('./cifar10_model/6', graph=tf.get_default_graph())
for i in range(TRAINING_EPOCHS):
batch_x, batch_y = cifar10.train.next_batch(BATCH_SIZE)
if i % DISPLAY_STEP == 0:
s = sess.run(merged_summary, feed_dict={x: batch_x, y: batch_y})
summary_writer.add_summary(s, i)
sess.run(train_step, feed_dict={x: batch_x, y: batch_y})
谁能告诉我这是怎么回事?提前致谢。
看起来 cifar 图像没有正确整形。 According to the dataset website:
data -- a 10000x3072 numpy array of uint8s. Each row of the array stores a 32x32 colour image. The first 1024 entries contain the red channel values, the next 1024 the green, and the final 1024 the blue. The image is stored in row-major order, so that the first 32 entries of the array are the red channel values of the first row of the image.
您应该确保这个 3072 长的数组已正确重塑。
我正在使用 tensorboard 可视化我的火车图像(cifar10 数据集)。但是 TensorBoard 向我展示了一些非常奇怪的图像。下面是屏幕截图。
the strange images
这里是一些相关的代码。注意DISPLAY_STEP
是10,BATCH_SIZE
是64。
x = tf.placeholder(tf.float32, shape=[None, N_FEATURES], name='x')
x_image = tf.reshape(x, [-1, 32, 32, 3])
tf.summary.image('input', x_image, max_outputs=BATCH_SIZE)
y = tf.placeholder(tf.float32, [None, N_CLASSES], name='labels')
'''There is other code.'''
with tf.Session() as sess:
sess.run(init)
summary_writer = tf.summary.FileWriter('./cifar10_model/6', graph=tf.get_default_graph())
for i in range(TRAINING_EPOCHS):
batch_x, batch_y = cifar10.train.next_batch(BATCH_SIZE)
if i % DISPLAY_STEP == 0:
s = sess.run(merged_summary, feed_dict={x: batch_x, y: batch_y})
summary_writer.add_summary(s, i)
sess.run(train_step, feed_dict={x: batch_x, y: batch_y})
谁能告诉我这是怎么回事?提前致谢。
看起来 cifar 图像没有正确整形。 According to the dataset website:
data -- a 10000x3072 numpy array of uint8s. Each row of the array stores a 32x32 colour image. The first 1024 entries contain the red channel values, the next 1024 the green, and the final 1024 the blue. The image is stored in row-major order, so that the first 32 entries of the array are the red channel values of the first row of the image.
您应该确保这个 3072 长的数组已正确重塑。