绘制损失图:导入loss的npz文件
import numpy as np
import os
import matplotlib.pyplot as plt# 读取npz文件
folder_path = r"C:\Users\Administrator\Desktop\Breast\MR_loss"
data = np.load(os.path.join(folder_path, 'loss.npz'))# 获取my_train_loss的值
my_train_loss = data['my_train_loss']
#print("my_train_loss:", my_train_loss)# 获取my_eval_loss的值
my_eval_loss = data['my_eval_loss']
#print("my_eval_loss:", my_eval_loss)# 绘制my_train_loss和my_eval_loss的图形
plt.plot(my_train_loss, label='my_train_loss')
plt.plot(my_eval_loss, label='my_eval_loss')
plt.xlabel('Iterations')
plt.ylabel('Loss')
plt.title('Training and Evaluation Loss')
plt.legend()
plt.show()
绘制准确率图
import numpy as np
import os
import matplotlib.pyplot as plt# 读取npz文件
folder_path = r"C:\Users\Administrator\Desktop\Breast\MR_loss"
data = np.load(os.path.join(folder_path, 'loss.npz'))# 获取my_train_loss的值
my_train_loss = data['my_train_loss']
#print("my_train_loss:", my_train_loss)# 获取my_eval_loss的值
my_eval_loss = data['my_eval_loss']
#print("my_eval_loss:", my_eval_loss)# 绘制my_train_loss和my_eval_loss的图形
plt.plot(my_train_loss, label='my_train_loss')
plt.plot(my_eval_loss, label='my_eval_loss')
plt.xlabel('Iterations')
plt.ylabel('Loss')
plt.title('Training and Evaluation Loss')
plt.legend()
plt.show()