jubair
jubair

Reputation: 597

How to increasing Number of epoch in keras Conv Net

Suppose, I have a model that is already trained with 100 epoch. I tested the model with test data and the performance is not satisfactory. So I decide to train for another 100 epoch. How can I do that?

I trained with model.fit(data, target, epochs=100, batch_size=batch_size)

Now I want to train the same model without adding new data for another 100 epoch. How can I do that?

Upvotes: 1

Views: 1991

Answers (2)

twolffpiggott
twolffpiggott

Reputation: 1103

Simply call model.fit(data, target, epochs=100, batch_size=batch_size) again to carry on training the same model. model needs to be the same model object as in the initial training, not re-compiled.

Upvotes: 3

pcko1
pcko1

Reputation: 981

From Keras webpage:

Use model.save() to export your model in HDF5 format.

Later, import the model using keras.models.load_model().

Then you can always model.fit() any saved / imported model to continue the training with either new samples when they become available or extra epochs on the previous training dataset.

Upvotes: 0

Related Questions