Visdom

安装visdom

pip install visdom

启动visdom服务

python -m visdom.server

visdom绘制各种图形:

visdom属性介绍:

 实例:

from visdom import Visdom
import numpy as np
import math
import matplotlib.pyplot as plt

viz = Visdom()

# viz.matplot()
try:
    plt.plot([1, 2, 23, 12])
    plt.ylabel('some numbers')
    plt.xlabel('iterations')
    viz.matplot(plt)
except BaseException as err:
    print('error massege: ', err)

#显示图片 image
viz.image(
    np.random.rand(3, 256, 256),
    opts=dict(title='Random', caption='How random')
)
viz.images(
    np.random.rand(4, 3, 64, 64),
    opts=dict(title='Random images', caption='How random the images')
)
#绘画折线图演示
import time
x=0
name=['acc','loss','loss2']
for i in range(50):
    y = np.random.randint(5, size=(1, 3))
    viz.line(Y=y,X=np.ones(y.shape)*x,
                    win='line',
                    opts=dict(legend=name,
                        title='line test',
                        width=800,
                        height=800,
                        xlabel='Time',
                        ylabel='Volume'),
                    update=None if x == 0 else 'append'
                    )
    time.sleep(0.1)
    x+=1

 

 

点击Edit:编辑图片

 

posted @ 2020-07-23 10:40  kkzhang  阅读(380)  评论(0编辑  收藏  举报