tensorflow2.0——history保存loss和acc

history包含以下几个属性:
训练集loss: loss
测试集loss: val_loss
训练集准确率: sparse_categorical_accuracy
测试集准确率: val_sparse_categorical_accuracy

my_model.compile(optimizer=opt,loss=tf.keras.losses.MSE)
history=my_model.fit(train_high0_img,train_rain,validation_data=(test_high0_img,test_rain),epochs=epochs, validation_freq=1,batch_size=bat)
#   history包含以下几个属性:
# 训练集loss: loss
# 测试集loss: val_loss
# 训练集准确率: sparse_categorical_accuracy
# 测试集准确率: val_sparse_categorical_accuracy
# acc = history.history['sparse_categorical_accuracy']
# val_acc = history.history['val_sparse_categorical_accuracy']
loss = history.history['loss']
val_loss = history.history['val_loss']
# print('acc:',acc)
# print('val_acc:',val_acc)
print('loss:',loss)
print('val_loss:',val_loss)

 

上一篇:手写数字识别-小数据集


下一篇:pandas 数据类型研究(三)数据类型object与category