Tensorboard: No graph definition files were found.

穿精又带淫゛_ 提交于 2019-12-08 05:55:28

问题


In my Python code I execute train_writer = tf.summary.FileWriter(TBOARD_LOGS_DIR) train_writer.add_graph(sess.graph)

I can see 1.6MB file created in E:\progs\tensorboard_logs (and no other file) but then when I execute tensorboard --logdir=E:\progs\tensorboard_logs it loads, but says: "No graph definition files were found." when I click on Graph. Additionally, running tensorboard --inspect --logdir=E:\progs\tensorboard_logs displays Found event files in: E:\progs\tensorboard_logs

These tags are in E:\progs\tensorboard_logs: audio - histograms - images -

scalars -

Event statistics for E:\progs\tensorboard_logs: audio - graph first_step 0 last_step 0 max_step 0 min_step 0 num_steps 1 outoforder_steps [] histograms - images - scalars - sessionlog:checkpoint - sessionlog:start -

sessionlog:stop -

This is TF 1.01 or so, on Windows 10.


回答1:


The problem might be the parameter --logdir. make sure you have type the correct

example:

in the code: writer = tf.summary.FileWriter('./log/', s.graph)

open powershell

cd to your work directory and type tensorboard --logdir=log

you can also use --debug to see if there is a problem in finding the log file. if you see: TensorBoard path_to_run is: {'C:\\Users\\example\\log': None} that means it can not find the file.




回答2:


I had similar issue. The issue occurred when I specified 'logdir' folder inside single quotes instead of double quotes. Hope this may be helpful to you.

egs: tensorboard --logdir='my_graph' -> Tensorboard didn't detect the graph

 tensorboard --logdir="my_graph"  -> Tensorboard detected the graph



回答3:


In Tensorflows dealing with graphs, there are three parts: 1) creating the graph 2) Writing the graph to event file 3) Visualizing the graph in tensorboard

Example: Creating graph in tensorflow

a = tf.constant(5, name="input_a")
b = tf.constant(3, name="input_b")

c = tf.multiply(a,b, name="mul_c")
d = tf.add(a,b, name="add_d")

e = tf.add(c,d, name="add_e")

sess = tf.Session() 

sess.run(c) <--check, value should be 15
sess.run(d) <--check, value should be 8
sess.run(e) <--check, value should be 23

Writing graph in event file

 writer = tf.summary.FileWriter('./tensorflow_examples', sess.graph)

It is very important to specify a directory(in this case, the directory is tensorflow_examples), where the event file will be written to. writer = tf.summary.FileWriter('./', sess.graph) didnt work for me, because the shell command => tensorboard --logdir expects a directory name.

After executing this step, verify if event file has been created in specified directory.

Visualizing graph in Tensorboard

Open terminal(bash), under working directory type: tensorboard --logdir='tensorflow_examples' --host=127.0.0.1

Then open a new browser in http://127.0.0.1:6006/ or http://localhost/6006 and now tensorboard shows the graph successfully.




回答4:


You may need to change the powershell directory to your log file. And the logdir need not the single quotation marks.(Double quotation marks or without the quotes will be both OK)



来源:https://stackoverflow.com/questions/43153455/tensorboard-no-graph-definition-files-were-found

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!