使用visdom 製作隨時間動態增長的圖
阿新 • • 發佈:2019-01-09
安裝visdom
pip install visdom
啟動visdom
python -m visdom.server
隨時間動態增長的visdom圖
典型的例子如:建立追蹤loss變化的圖。
用法:update選項設定為“append”
舉例
track_loss = 0 #for draw graph global_step = 0 vis = visdom.Visdom(env=u"train_loss") win = vis.line(X = np.array([global_step]), Y = np.array([track_loss])) for epoch in range(cfg.epoch_num): # 此處省略程式碼 for iter_num, dial_batch in enumerate(data_iterator): # 此處省略程式碼 loss = some_function() vis.line(X = np.array([global_step]), Y = np.array([loss.data[0]]), win = win, update = 'append') # for draw graph global_step += 1
生成的visdom影象如下所示: