- fit 时显示的loss
训练时显示的loss和acc,是已经运行过的batch的平均loss。
https://github.com/keras-team/keras/issues/10426
- 保存每个epoch的model
filepath = 'saved-model-{epoch:02d}.h5'
checkpointer = ModelCheckpoint(filepath=filepath, verbose=1, save_best_only=False, save_weights_only=False)
如果filepath是一个固定的字符串,那只会保存最新的model文件。
- 显存自适应,而不是一下占满
import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
config = tf.ConfigProto()
config.gpu_options.allow_growth = True # dynamically grow the memory used on the GPU
config.log_device_placement = False # to log device placement (on which device the operation ran)
# (nothing gets printed in Jupyter, only if you run it standalone)
sess = tf.Session(config=config)
set_session(sess)