![](/img/trans.png)
[英]Why doesn't Keras' ModelCheckPoint save my best model with the highest validation accuracy during training?
[英]Keras: I use ModelCheckpoint to save my model,but I can't find my model file in the directory
我使用 ModelCheckpoint 保存 model,但在我的目錄中找不到任何 model 文件。
我搜索了很多博客,但它們不起作用
filepath = "saved-model-{epoch:02d}-{val_acc:.2f}.hdf5"
checkpoint = ModelCheckpoint(filepath, monitor='val_acc', verbose=0,
save_best_only=False, mode='max', period=1)
callbacks_list = [checkpoint]
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
model.fit(train_images, train_labels, epochs=3)
我想找到 model 文件。
您忘記向 model 添加回調:
model.fit(train_images, train_labels, epochs=3, callbacks=callbacks_list)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.