其他分享
首页 > 其他分享> > tensorflow2.0——history保存loss和acc

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)

 

标签:acc,loss,val,categorical,tensorflow2.0,accuracy,history
来源: https://www.cnblogs.com/cxhzy/p/15010266.html