tf.summary.image(name, tensor, max_outputs=3, collections=None)
Tensor必须为4个维度:
[batch_size, height, width, channels] 且,通道数可以为1,3,4:
- 1:
tensor is interpreted as Grayscale. - 3:
tensor is interpreted as RGB. - 4:
tensor is interpreted as RGBA.
name : A name for the generated node. Will also serve as a series name in TensorBoard.tensor : A 4-D uint8 or float32 Tensor of shape [batch_size, height, width, channels] where channels is 1, 3, or 4.max_outputs : Max number of batch elements to generate images for.collections : Optional list of ops.GraphKeys. The collections to add the summary to. Defaults to [_ops.GraphKeys.SUMMARIES]
Returns:A scalar Tensor of type string . The serialized Summary protocol buffer.
之后的操作,就是同其他的summary,通过FileWriter写入磁盘。
通过tensorboard看图
如下所示:
|