【发布时间】:2018-04-30 22:05:17
【问题描述】:
我正在使用TensorFlow's Dataset API 来加载和预处理图像。我想将预处理图像的摘要添加到 Tensorboard。
推荐的方法是什么?
到目前为止,我的代码如下所示:
def get_data():
dataset = FixedLengthRecordDataset(...)
dataset = dataset.map(dataset_parser, ...)
if is_training:
dataset = dataset.map(preprocess_for_train, ...)
# Do shuffling, batching...
return dataset
def preprocess_for_train(image, label):
# Do preprocessing...
image = tf.image.random_flip_left_right(image)
# Add summary
tf.summary.image('preprocessed_image', tf.expand_dims(image, 0))
return image, label
在preprocess_for_train 内,我的图像列在SUMMARIES 集合中,但在返回外部函数时,它不再是图形的一部分。我认为这是因为map 使用了不同的线程,因此引用了tf.Graph 的不同实例。
由于这不起作用,我还有哪些其他选项可以在 Tensorboard 中显示我的图像?
【问题讨论】:
标签: api tensorflow dataset summary tensorboard