Add custom data to Tensorboard display _tensorflow

Source: Internet
Author: User

Typically, we add summary when we train the network by using the following methods:

Tf.scalar_summary (tags, values)
#
... Summary_op = Tf.summary.merge_all ()
summary_writer = Tf.summary.FileWriter (LogDir, graph=sess.graph)
Summary_str = Sess.run (summary_op)
summary_writer.add_summary (Summary_str, Global_step)

When we want to add other data to the Tensorboard (such as the validation of the loss, etc.), this approach is too cumbersome, in fact, we can add custom data in the following way to display in Tensorboard.

Summary_writer = Tf.summary.FileWriter (logdir)
summary = tf. Summary (value=[
    TF. Summary.value (tag= "Summary_tag", simple_value=0), 
    TF. Summary.value (tag= "Summary_tag2", simple_value=1),
])
# x represents the horizontal coordinate
summary_writer.add_summary (Summary, X

Or:

Summary_writer = Tf.summary.FileWriter (logdir)
summary = tf. Summary ()
summary.value.add (tag= "Summary_tag", simple_value=0)
Summary.value.add (tag= "Summary_tag2", simple_value=1)
# x represents the horizontal coordinate
summary_writer.add_summary (summary, X)

Note that the x here can only be an integer, and if it is a decimal, it automatically becomes an integer type.

Here's a complete sample code

Import TensorFlow as tf
summary_writer = tf.summary.FileWriter ('/tmp/test ')
summary = tf. Summary (value=[
    TF. Summary.value (tag= "Summary_tag", simple_value=0), 
    TF. Summary.value (tag= "Summary_tag2", simple_value=1),
]
summary_writer.add_summary (Summary, 1)

Summary = TF. Summary (value=[
    TF. Summary.value (tag= "Summary_tag", simple_value=1), 
    TF. Summary.value (tag= "Summary_tag2", simple_value=3),
])
summary_writer.add_summary (Summary, 2)

Summary_writer.close ()

The display effect looks like this:

Resources:

How to manually create a TF. Summary

Modify History:
2017-2-19 accomodation 1.0api

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.