Summary
class tf.Summary.FileWriter
init
创建一个writer
1 | __init__( |
add_summary
将summary string添加至事件文件中
1 | add_summary( |
flush
将事件文件写到磁盘1
flush()
close
将事件文件写到磁盘并关闭FileWriter。
1 | close() |
visulization Function
scalar
1 | tf.summary.scalar( |
Args:
name: 显示的名字
family: 同一族
Return: 一个
operation
image
1 | tf.summary.image( |
Args:
name: 显示的名字
tensor: shape [batch_size, height, width, channels], channels可以是1,3,4,分别对应于Grayscale,RGB,RGBA。
histogram
1 |
|
name: 显示的名称
values: 处理的数据,可以是任意形状
text
1 |
|
- tensor: a string-type Tensor to summarize.
audio
合并可视化操作
目的: 使得1次forward propagation,获取多个summary
tf.summary.merge
1 |
|
- inputs: A list of string Tensor objects containing serialized Summary protocol buffers.
tf.summary.merge_all
1 | tf.summary.merge_all( |
Merges all summaries collected in the default graph.
Args:
- key: GraphKey used to collect the summaries. Defaults to GraphKeys.SUMMARIES.
- scope: Optional scope used to filter the summary ops, using re.match
Return: 返回一个ops
Conclusion
可视化主要流程:
预定义Summary objects
合并Summary objects
启动Session
定义tf.summary.FileWriter
获取summary string : sess.run(summary_ops, feed_dict={})
添加至事件文件
写入磁盘
For example
1 |
|