Training model with Keras starting with pretrained weights

53 views Asked by At

I would like to train a model with Keras starting from pretrained weights (for example if already 50 epochs are done and I would like to train another 50 epochs, that the second training can start from the weights of the first training). How do I have to include the previous .h5 file with the weights in the fit generator?

callbacks_list = [
ModelCheckpoint(top_weights_path, monitor='val_loss', verbose=1, save_best_only=True),
TensorBoard(log_dir=logs, batch_size=batch_size, histogram_freq=0, write_graph=True, write_grads=True, write_images=True),
ReduceLROnPlateau(monitor='val_loss', factor=0.1, patience=500, verbose=1)]


model.fit_generator(train_gen,
                steps_per_epoch=len(listREFPaths[:-val_split]),
                epochs=nb_epoch,
                callbacks=callbacks_list,
                validation_data=val_gen if use_val_gen else (X_val_data, y_val_data),
                validation_steps=len(listREFPaths[-val_split:]),
                shuffle=rnd_shuffle,
                verbose=1)

In this discussion (https://github.com/keras-team/keras/issues/2378), I don't find an answer.

0

There are 0 answers