代码拉取完成,页面将自动刷新
# save the training record
import json
import numpy as np
from config import json_name
def save_record(train_loss_results, train_accuracy_results, val_accuracy_results):
train_record = dict()
train_record["train_loss"] = list(np.float64(train_loss_results))
train_record["train_accuracy"] = list(np.float64(train_accuracy_results))
train_record["val_accuracy"] = list(np.float64(val_accuracy_results))
with open(json_name, 'w') as f:
json.dump(train_record, f)
return 0
def load_record():
with open(json_name, 'r') as f:
train_record = json.load(f)
# convert list to numpy
train_loss_results = np.float64(train_record["train_loss"])
train_accuracy_results = np.float64(train_record["train_accuracy"])
val_accuracy_results = np.float64(train_record["val_accuracy"])
return train_loss_results, train_accuracy_results, val_accuracy_results
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。