Here is the code
model.compile(loss='categorical_crossentropy',
optimizer=optimizers.RMSprop(),
metrics=['accuracy'])
"""""rest of code not shown here. """""""""""""""
"""
Tensorboard log
"""
target_dir = "../models/weights-improvement-{epoch:02d}-{accuracy:.2f}.hdf5"
if not os.path.exists(target_dir):
os.mkdir(target_dir)
model.save('../models/model.h5')
model.save_weights('../models/weights.h5')
KeyError: 'accuracy'
Here is the code model.compile(loss='categorical_crossentropy', optimizer=optimizers.RMSprop(), metrics=['accuracy']) """""rest of code not shown here. """"""""""""""" """ Tensorboard log """ target_dir = "../models/weights-improvement-{epoch:02d}-{accuracy:.2f}.hdf5" if not os.path.exists(target_dir): os.mkdir(target_dir) model.save('../models/model.h5') model.save_weights('../models/weights.h5')
checkpoint = ModelCheckpoint(target_dir, monitor='accuracy', verbose=1, save_best_only=True, mode='max')
callbacks_list = [checkpoint]
model.fit_generator( train_generator, steps_per_epoch=nb_train_samples//batch_size, epochs=epochs, shuffle=True, validation_data=validation_generator, callbacks=callbacks_list, validation_steps=nb_validation_samples//batch_size)
There is an error with the checkpoint as it does not recognize the key 'accuracy'. It is the same key used in compile of the model above as well.
What could be the issue her ?