Tensorboard should be started from commnad line like that:
tensorboard --logdir=path
I need to run it from code. Until now I use this:
import os
os.system('tensorboard --logdir=' + path)
However tensorboard do not start because is not included in the system path. I use PyCharm with virtualenv on windows. I don't want to change system paths so the only option is to run it from virtualenv. How to do this?
Using Tensorboard 2 API (2019):
from tensorboard import program
tracking_address = log_path # the path of your log file.
if __name__ == "__main__":
tb = program.TensorBoard()
tb.configure(argv=[None, '--logdir', tracking_address])
url = tb.launch()
print(f"Tensorflow listening on {url}")
Note: tb.launch() create a daemon thread that will die automatically when your process is finished
Probably a bit late for an answer, but this is what worked for me in Python 3.6.2:
import tensorflow as tf
from tensorboard import main as tb
tf.flags.FLAGS.logdir = "/path/to/graphs/"
tb.main()
That runs tensorboard with the default configuration and looks for graphs and summaries in "/path/to/graphs/". You can of course change the log directory and set as many variables as you like using:
tf.flags.FLAGS.variable = value
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With