在运行窗口中训练精度,训练损失以及验证精度,验证损失均正常输出,无报错。但是在绘制曲线图时,并没有弹出曲线图的窗口。
以下代码是用于输出曲线图,各位,这里的代码存在什么问题吗
import matplotlib.pyplot as plt
from train_CNN import model
# figsize=(a, b)----figsize 设置图形的大小,a 为图形的宽, b 为图形的高,单位为英寸
fig, ax = plt.subplots(1, 2, figsize=(20, 3))
ax = ax.ravel()
for i, metric in enumerate(["acc", "loss"]):
ax[i].plot(model.history.history[metric])
ax[i].plot(model.history.history["val_" + metric])
ax[i].set_title("Model {}".format(metric))
ax[i].set_xlabel("epochs")
ax[i].set_ylabel(metric)
ax[i].legend(["train", "val"])