简体   繁体   English

Keras:我使用 ModelCheckpoint 来保存我的 model,但在目录中找不到我的 model 文件

[英]Keras: I use ModelCheckpoint to save my model,but I can't find my model file in the directory

I use ModelCheckpoint to save model,but I can't find anything model file in my directory.我使用 ModelCheckpoint 保存 model,但在我的目录中找不到任何 model 文件。

I search many blog but they dosen't work我搜索了很多博客,但它们不起作用

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)

I want to find model file.我想找到 model 文件。

You forgot add callback to your model:您忘记向 model 添加回调:

model.fit(train_images, train_labels, epochs=3, callbacks=callbacks_list)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么 Keras 的 ModelCheckPoint 在训练期间没有保存我最好的 model 具有最高的验证准确率? - Why doesn't Keras' ModelCheckPoint save my best model with the highest validation accuracy during training? 为什么我不能在 Keras 中加载我保存的 siamese 模型? - Why can't I load my saved siamese model in Keras? 为什么在流程图中无法使用类似tf op的Keras模型 - Why can't I use a Keras model like an tf op in my flow graph 为什么我不能保存训练有素的RandomForestRegressor模型? - Why can't I save my trained RandomForestRegressor model? 为什么我不能将表单数据保存到模型数据库中? - Why can't I save my form data into a model db? 如何将我的 keras 模型保存到谷歌驱动器或计算机中? - How do I save my keras model into google drive or the computer? 仅当验证准确性提高时,我如何才能保存/覆盖我的 TensorFlow/Keras 模型? - How can I save/overwrite my TensorFlow/Keras model ONLY when validation accuracy improves? 我怎么可能使用从我的网络摄像头生成的帧作为我的 Keras model 的输入? - How possibly can I use the frames generated from my webcam to be the input of my Keras model? 为什么我无法用我的 Keras LSTM model 进行预测? - Why I can't predict with my Keras LSTM model as I want? 如何使用我的keras TensorFlow模型减少损失? - How can I reduce loss with my keras TensorFlow model?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM