简体   繁体   中英

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.

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.

You forgot add callback to your model:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM