oarriaga / face_classification

Real-time face detection and emotion/gender classification using fer2013/imdb datasets with a keras CNN model and openCV.
MIT License
5.61k stars 1.59k forks source link

How to retrain the model using saved weights? #58

Closed mayankjha0220 closed 6 years ago

mayankjha0220 commented 6 years ago

I have been facing trouble when I try using the saved weights to retrain the train_emotion_classifier model.The model starts from the beginning,no matter what.I tried using the : model.load_model('fer2013_mini_XCEPTION.100-0.65.hdf5') for my 100th epoch.I added this line of code before the model.compile( ) line.

Can you please tell me what changes need to be made if I want to use a weight file from emotion_models folder to retrain the existing model.

oarriaga commented 6 years ago

Please refer to the keras website about how to load the models e.g :

from keras.models import load_model

model.save('my_model.h5')  # creates a HDF5 file 'my_model.h5'
del model  # deletes the existing model

# returns a compiled model
# identical to the previous one
model = load_model('my_model.h5')