Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keras Tensorboard callback not writing images

I am trying to visualize weights of my Keras model with Tensorboard. Here is the model I am using:

model = Sequential([
    Conv2D(filters=32, kernel_size=(3,3), padding="same", activation='relu', input_shape=(40,40,3)),
    MaxPooling2D(pool_size=(2, 2)),
    Conv2D(filters=64, kernel_size=(5,5), padding="same", activation='relu'),
    MaxPooling2D(pool_size=(2, 2)),
    Flatten(),
    Dense(1024, activation='relu'),
    Dropout(0.5),
    Dense(43, activation='softmax'),
])
model.compile(optimizer='sgd',
              loss='categorical_crossentropy',
              metrics=['accuracy'])

and I am training with this call:

model.fit_generator(
    ...
    callbacks = [
        ModelCheckpoint('models/gtsrb1-{epoch}.hdf5', verbose=1, save_best_only = True),
        TensorBoard(log_dir='tblogs/', write_graph=True, write_grads=True, write_images=True),
        EarlyStopping(patience=5, verbose=1),
    ],)

However, when I start up TensorBoard, this is what I get:

Tensorboard Images

Scalars and Graphs looks okay so it is not a problem of wrong logdir. What am I doing wrong here?

like image 634
TwiNight Avatar asked Jul 28 '17 03:07

TwiNight


1 Answers

You need to add histogram_freq=x, where x should be different than zero, so that the writing of images is enabled.

But if you do this, it might still fail, depending on the version of Keras (see https://github.com/fchollet/keras/issues/6096)

like image 192
tnarik Avatar answered Sep 20 '22 13:09

tnarik