• Home
  • About
    • Miles' Blog photo

      Miles' Blog

      Miles 用來記錄學習心得及筆記的地方。

    • Learn More
    • Email
    • Github
  • Posts
    • All Posts
    • All Tags
  • Projects

keras筆記-ModelCheckpoint

13 Apr 2017

Reading time ~1 minute

若有進步就儲存,且保留上次最好的。

filepath="weights-improvement-{epoch:02d}-{val_acc:.2f}.hdf5"
checkpoint = ModelCheckpoint(filepath, monitor='val_acc', verbose=1, save_best_only=True, mode='max')

若有進步就儲存,但只保留最好的。

filepath="weights.best.hdf5"
checkpoint = ModelCheckpoint(filepath, monitor='val_acc', verbose=1, save_best_only=True, mode='max')

讀取尚未訓練完成的Model,但需要Initialize一開始模型的樣子。

model.load_weights("weights.best.hdf5")

參考: 1.How to Check-Point Deep Learning Models in Keras 2.Usage of callbacks



PythonDeep LearningA.I.Data ScienceKeras Share Tweet +1