lambda
lambda

Reputation: 1018

How to retrain/update keras model?

How to update/append new data to my model without starting to retrain from scratch? My dataset are images and the output is to predict emotion.

model.fit(x=train_image, y=train_label, epochs=1, batch_size=1)

Model.fit seems not appending my new data but overwriting the model. My output is only one (the last one that I updated).

Loading a trained Keras model and continue training

I've already search for this but doesn't work as well.

Edit 1: What can we do when we lose our previously trained data. In simple words we lose our training data just after the training is completed and we can not get the data back again, just the thing we have to retain is the learning done from it and also retrain the model when we receive new data.

Upvotes: 5

Views: 5576

Answers (1)

prosti
prosti

Reputation: 46341

It is really easy. For instance model.save() in Keras can save the model weights, which is what you actually need to keep.

After that you can add new images to your training set, but just use the weights you saved.

Every new epoch will pass trough all the images (new and old).

Upvotes: 3

Related Questions