参考:[Pytorch系列-70]:开发环境 - 可视化工具visdom安装与使用方法_文火冰糖的硅基工坊的技术博客_51CTO博客

from visdom import Visdom
# 将窗口类实例化
viz = Visdom()
# 创建窗口并初始化
viz.line([0.], [0], win='train_loss', opts=dict(title='train_loss'))
viz.line([0.], [0], win='val_loss', opts=dict(title='val_loss'))
viz.line([0.], [0], win='val_mae', opts=dict(title='val_mae'))


for epoch in range(args.start_epoch, args.epochs):
    
    adjust_learning_rate(optimizer, epoch)
    
    train_loss = train(train_list, model, criterion, optimizer, epoch)
    val_loss,prec1 = validate(val_list, model, criterion)

    viz.line([float(train_loss)], [epoch], win='train_loss', update='append')
    viz.line([float(val_loss)], [epoch], win='val_loss', update='append')
    viz.line([float(prec1)], [epoch], win='val_mae', update='append')

vidsom启动命令: 
python -m visdom.server

复制网址或打开网址

11-07 09:45