Search code examples
pythontensorflowtensorboard

Unable to write data to TensorBoard


I have used TensorBoard successfully once before, but since then I have been unable to record anything.

I have the following code

def compile_and_train(model): 

model.compile(loss='categorical_crossentropy', optimizer=Adam(), metrics=['acc']) 
filepath = 'weights/' + model.name + '.{epoch:02d}-{loss:.2f}.hdf5'
checkpoint = ModelCheckpoint(filepath, monitor='loss', verbose=0, save_weights_only=True, save_best_only=True, mode='auto', period=1)
current_directory = 'C:/Users/Jack/Documents/GaTech/Research/Code/TensorFlow/logs'
tensor_board = TensorBoard(log_dir = current_directory, histogram_freq=1, batch_size=32)
history = model.fit(x=data.train.images, y=data.train.labels, 
                    batch_size=128, epochs = 1, verbose=1, 
                    callbacks=[checkpoint, tensor_board], validation_split=0.2)
return history

After I run:

Model_1 = create_model()
history = compile_and_train(Model_1)

and

tensorboard --logdir =  C:\Users\Jack\Documents\GaTech\Research\Code\TensorFlow\logs

(without any errors) - I then went to TensorBoard and was met with a 'No dashboards are active for the current data set' message. I am fairly certain the error is in my code but I have been able to run this code in the past and am not sure where the error could be.


Solution

  • You have a malformated --logdir argument, don't use the equals:

    tensorboard --logdir C:\Users\Jack\Documents\GaTech\Research\Code\TensorFlow\logs