Reputation: 57
I am trying to create a Tensorboard for a dogs and cats classification but it fails to create a directory.
For some reason if I remove the .format(NAME) it runs for a second but then still throws and error. It manages to create this path: logs -> train -> events.out.tfevents.1571558167.DESKTOP-TI1MJRC.2216.327.v2
import pickle
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.callbacks import TensorBoard
import time
NAME = 'Cats-vs-dog-cnn-64x2{}'.format(int(time.time()))
tensorboard = TensorBoard(log_dir='logs/{}'.format(NAME))
...
model.fit(X, y, batch_size=32, epochs=3, validation_split=0.2, callbacks=[tensorboard])
if I leave the .format(NAME):
2019-10-20 10:04:05.020004: W tensorflow/core/framework/op_kernel.cc:1622] OP_REQUIRES failed at summary_kernels.cc:57 : Not found: Failed to create a directory: logs/Cats-vs-dog-cnn-64x21571558643\train; No such file or directory
Traceback (most recent call last):
File "D:/Python/tensorflow/tutorial/cats_and_dogs.py", line 95, in <module>
model.fit(X, y, batch_size=32, epochs=3, validation_split=0.2, callbacks=[tensorboard])
...
tensorflow.python.framework.errors_impl.NotFoundError: Failed to create a directory: logs/Cats-vs-dog-cnn-64x21571558643\train; No such file or directory [Op:CreateSummaryFileWriter]
if I remove the .format(NAME):
Traceback (most recent call last):
File "C:\...\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py", line 668, in on_start
yield
...
tensorflow.python.framework.errors_impl.NotFoundError: Failed to create a directory: logs/train\plugins\profile\2019-10-20_09-56-10; No such file or directory
Upvotes: 0
Views: 483
Reputation: 57
I solved this by using:
import os
PATH = os.path.join('logs', NAME)
tensorboard = TensorBoard(log_dir=PATH)
Upvotes: 1