How to manually create text summaries in TensorFlo

2019-08-18 08:05发布

First of all, I already know how to manually add float or image summaries. I can construct a tf.Summary protobuf manually. But what about text summaries? I look at the definition for summary protobuf here, but I don't find a "string" value option there.

2条回答
姐就是有狂的资本
2楼-- · 2019-08-18 08:41

John Hoffman's answer is great, though the tb.summary.pb API seems not available as of TF 1.x. You can instead use the following APIs:

tb.summary.text_pb("key", "content of the text data")

Just FYI, tb.summary has many similar methods for other types of summary as well:

'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'
查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-08-18 08:51

TensorBoard's text plugin offers a pb method that lets you create text summaries outside of a TensorFlow environment. https://github.com/tensorflow/tensorboard/blob/master/tensorboard/plugins/text/summary.py#L74

Example usage:

import tensorboard as tb
text_summary_proto = tb.summary.pb('fooTag', 'text data')
查看更多
登录 后发表回答