TensorBoard help on Keras Beginner Tutorial: Overfit and underfit


I copied exactly and ran the “Overfit and underfit” tutorial on PyCharm IDE, but was unable to visualize the data on TensorBoard with the following output: “No dashboards are active for the current data set.”. I suspect the program is logging the data to and loading the data from two different directories, but I don’t know how to check that or if that is the case at all. Any idea, how I can troubleshoot this?


When you work in PyCharm you create a “Project” - a folder where all your code and data files are located. To use a TensorBoard you should create a subfolder in this project folder and call it, for example, “logs”.
To define a relative path to this “logs” subfolder, which is one level below the folder with the code file, you use . as an identifier of the current working directory like this:

log_dir = "./logs/" + datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir=log_dir, histogram_freq=1)

When you run the code, you can manually check that new content is automatically loaded in the “logs” folder.
To activate TensorBoard you launch the terminal from the bottom of PyCharm window. There you should be able to see the absolute path to your “Project” folder starting from the C: drive.
You enter the command with a relative path: tensorboard --logdir ./logs/
Together with the absolute path to the “Project” folder this relative path should be a correct path to the “logs”. Errors appear if there is any inconsistency in this path. Like if your code file is located not in the main project folder but is some other place. Then you should carefully define the relative path to the logs.
You can also consult the documentation: Начать работу с TensorBoard  |  TensorFlow

1 Like

Hi Ekaterina,

Brilliant, thanks!

I also found another solution by changing this line of code:

logdir = pathlib.Path(tempfile.mkdtemp())/“tensorboard_logs”

to this:

logdir = pathlib.Path.cwd()/“tensorboard_logs”

After a long search, it appears that the first line of code creates the “tensorboard_logs” in the ‘AppData>Local>Temp’ directory. The second line of code fixed it by creating that folder in the current working directory of the project.