【问题标题】:How to show input tensor with tensorboard in Keras如何在 Keras 中使用张量板显示输入张量
【发布时间】:2019-07-26 11:02:08
【问题描述】:

我正在使用 Keras 来训练图像分类器。现在我想检查输入到我的 ConvNet 的输入图像是否正确,我想用 Keras 中的 tensorard 显示它们。

在谷歌上搜索后,一些答案说我需要实现一个 Keras tensorboard 回调的子类,如下所示:

class TensorBoardImage(keras.callbacks.Callback):
def __init__(self, tag):
    super().__init__() 
    self.tag = tag

def on_epoch_end(self, epoch, logs={}):
    # Load image
    img = data.astronaut()
    # Do something to the image
    img = (255 * skimage.util.random_noise(img)).astype('uint8')

    image = make_image(img)
    summary = tf.Summary(value=[tf.Summary.Value(tag=self.tag, image=image)])
    writer = tf.summary.FileWriter('./logs')
    writer.add_summary(summary, epoch)
    writer.close()

    return

但是我怎样才能将我的输入图像张量传递给这个回调呢? 如果有人知道怎么做?

【问题讨论】:

    标签: keras tensorboard


    【解决方案1】:

    我建议只使用 matplot lib 保存您的图像。这将变得更容易,无需进入 tf.Summary 的世界。如果您仍然对此感兴趣,则需要使用 tf.image_summary。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-07-15
      • 1970-01-01
      • 2019-10-10
      • 1970-01-01
      • 2019-04-23
      • 1970-01-01
      • 2020-02-18
      相关资源
      最近更新 更多