【发布时间】:2018-05-30 04:46:13
【问题描述】:
首先,我已经知道如何手动添加浮动或图像摘要。我可以手动构造一个tf.Summary protobuf。但是文本摘要呢?我查看了摘要 protobuf here 的定义,但在那里我没有找到“字符串”值选项。
【问题讨论】:
首先,我已经知道如何手动添加浮动或图像摘要。我可以手动构造一个tf.Summary protobuf。但是文本摘要呢?我查看了摘要 protobuf here 的定义,但在那里我没有找到“字符串”值选项。
【问题讨论】:
TensorBoard 的文本插件提供了一个 pb 方法,可让您在 TensorFlow 环境之外创建文本摘要。
https://github.com/tensorflow/tensorboard/blob/master/tensorboard/plugins/text/summary.py#L74
示例用法:
import tensorboard as tb
text_summary_proto = tb.summary.pb('fooTag', 'text data')
【讨论】:
John Hoffman 的回答很棒,尽管 tb.summary.pb API 从 TF 1.x 开始似乎不可用。您可以改为使用以下 API:
tb.summary.text_pb("key", "content of the text data")
仅供参考,tb.summary 对于其他类型的摘要也有许多类似的方法:
'audio', audio_pb',
'custom_scalar', 'custom_scalar_pb',
'histogram', 'histogram_pb',
'image', 'image_pb',
'pr_curve', 'pr_curve_pb',
'pr_curve_raw_data_op',
'pr_curve_raw_data_pb',
'pr_curve_streaming_op',
'scalar', 'scalar_pb',
'text', 'text_pb'
【讨论】:
/test_summary 附加到您传递给函数的任何标签。确保使用 text_summary.value[0].tag='my/tag' 将标签更改为您想要的