Reputation: 21
# train the model
start = dt.now()
show = my_model.fit_generator(
# training data
train_generator,
# epochs
steps_per_epoch = train_generator.n // 32, #floor per batch size
epochs = 15,
# validation data
validation_data = test_images_iter,
validation_steps = test_images_iter.n // 32,
# print progress
verbose = 1,
callbacks = [
#early stopping in case the loss stops decreasing
k.callbacks.EarlyStopping(monitor='val_loss', patience=3),
# only save the model if the monitored quantity (val_loss or val_acc) has improved
k.callbacks.ModelCheckpoint("fruits_checkpoints.h5", monitor='val_loss', save_best_only = True),
# only needed for visualising with TensorBoard
k.callbacks.TensorBoard(log_dir = "logs/{:%d_%b_%Y_%H:%M:%S}".format(dt.now()) )
] ) I am gettin this error idk how to fix it i a newbe to ML Error when checking target: expected activation_final to have shape (60,) but got array with shape (4,)
Upvotes: 1
Views: 30
Reputation: 21
replace test_images_iter with test generator validation data validation_data = test_generator, validation_steps = test_generator.n // 32,
Upvotes: 1