问题
I am trying to use Tensorboard but every time I run any program with Tensorflow, I get an error when I go to localhost:6006 to view the Visualization
Here is my code
a = tf.add(1, 2,)
b = tf.multiply(a, 3)
with tf.Session() as sess:
writer = tf.summary.FileWriter("output", sess.graph)
print(sess.run(b))
writer.close()
When I go to the command prompt and enter
tensorboard --logdir=C:\path\to\output\folder
It returns with
TensorBoard 0.1.8 at http://MYCOMP:6006 (Press CTRL+C to quit)
When I go to localhost:6006 it states
No dashboards are active for the current data set. Probable causes: - You haven’t written any data to your event files. - TensorBoard can’t find your event files.
I have looked at this link (Tensorboard: No dashboards are active for the current data set) but it doesn't seem to fix this issue
And I am running this on Windows 10
What do I do to fix this issue? Am I giving the right path for Tensorboard in the command prompt?
Thank you in advance
回答1:
Your issue may be related to the drive you are attempting to start tensorboard
from and the drive your logdir
is on. Tensorboard
uses a colon to separate the optional run name and the path in the logdir flag, so your path is being interpreted as \path\to\output\folder with name C.
This can be worked around by either starting tensorboard
from the same drive as your log directory or by providing an explicit run name, e.g. logdir=mylogs:C:\path\to\output\folder
See here for reference to the issue.
回答2:
In case of Windows,I got a workaround.
cd /path/to/log
tensorboard --logdir=./
Here you can use path as normal. Keep in mind not to give spaces with it as logdir = ./.
This gave me an error:
No dashboards are active for the current data set. Probable causes: - You haven’t written any data to your event files. - TensorBoard can’t find your event files.
回答3:
In Windows 10, this command works
tensorboard --logdir=training/
Here training is the directory where output files are written. Please note it does not have any quotes and has a slash (/) at the end. Both are important.
回答4:
Well, you have several issues with your code.
- You are creating a summary writer (
tf.summary.FileWriter
) but you don't actually write anything with it.print(sess.run(b))
has nothing to do with tensorboard if you expected this to has some effect on it. It just prints the value ofb
- You don't create and
summary
object to connect some value with. - You are probably entering wrong folder for tensorboard.
More analytically:
- You need a summary object to write a summary. For example a
tf.summary.scalar
to write a scalar to a summary. Something liketf.summary.scalar("b_value", b)
to write the value ofb
to a summary. - Then you actually need to run your summary operation into a session to get it working, like:
summary = sess.run(summary_scalar)
. - Write the value with the writer you defined previously:
writer.add_summary(summary)
. - Now there is something to see in tensorboard, using
tensorboard --logdir=output
in a terminal - In general use you will probably need
tf.summary.merge_all()
to pass torun
in order to gather all your summaries together.
Hope this helps.
回答5:
Find the path to main.py
inside tensorboard directory and copy it. It should be something like this:
C:/Users/<Your Username>/Anaconda3/envs/tensorflow/Lib/site-packages/tensorboard/main.py
or
C:/Users/<Your Username>/anaconda/envs/tf/lib/python3.5/site-packages/tensorboard/main.py
Once you know the correct path, Run this command in Anaconda Prompt using the path to main.py
inside tensorboard directory. This worked for me in Windows.
python C:/Users/Username/Anaconda3/envs/tensorflow/Lib/site-packages/tensorboard/main.py --logdir=foo:<path to your log directory>
Credits: KyungHoon Kim
回答6:
When I ran the TensorFlow (https://www.tensorflow.org/programmers_guide/tensorboard_histograms) tutorial, I ran across the same issue. I went ahead and tried the solution referenced by hpabst above. It worked like champ. In terminal (I am running in CentOS)- I ran: tensorboard --log =mydir: '~/mlDemo/'
回答7:
I am working with windows 10 as well. I tried your code with running tensorboard from same drive, different drive, and local path. In all three cases, I was able to see the graph.
One solution is, maybe you need to change your host (I cannot visualize with localhost:6006 as well). Try http://MYCOMP:6006 to check if you see any difference.
Note: My tensorboard version is 1.8.0 (maybe you can update your tensorboard to see it gives any difference)
回答8:
When I had this problem, it started working after I shut down my computer. However, I don't know why it worked.
回答9:
Try this instead:
tensorboard --logdir="C:\path\to\output\folder"
来源:https://stackoverflow.com/questions/47113472/tensorboard-error-no-dashboards-are-active-for-current-data-set