matplotlab循环画图

matplotlab循环画图,第1张

matplotlab循环画图

训练画图必须要把画板清空,否则会累加,用plt.clf()

import matplotlib.pyplot as plt


for i in range(10):
    history_train_loss = list(range(i*10,(i+1)*10))
    t = i+1
    history_train_accuracy = list(range(t*10,(t+1)*10))
    t = t+1
    history_train_iou = list(range(t*10,(t+1)*10))
    t = t+1
    history_test_loss = list(range(t*10,(t+1)*10))
    t = t+1
    history_test_accuracy = list(range(t*10,(t+1)*10))
    t = t+1
    history_test_iou = list(range(t*10,(t+1)*10))


    plt.subplot(1,1,1)      #  一行两列第一列
    plt.plot(history_train_accuracy,label="Training Accuracy")
    plt.plot(history_test_accuracy,label="Validation Accuracy")
    plt.plot(history_train_loss,label="Training Loss")
    plt.plot(history_test_loss,label="Validation Loss")
    plt.plot(history_train_iou,label="Training Iou")
    plt.plot(history_test_iou,label="Validation Iou")

    plt.title("Accuracy Loss and Iou")
    plt.legend()

    # 保存和显示
    plt.savefig('./trrr/unet_epoch%d'%i)
    plt.clf()

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5710703.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-18
下一篇2022-12-17

发表评论

登录后才能评论

评论列表(0条)

    保存