Pytorch使用Visdom進(jìn)行數(shù)據(jù)可視化的示例代碼
更新時間:2023年12月12日 10:09:39 作者:思影影思
pytorch Visdom可視化,是一個靈活的工具,用于創(chuàng)建,組織和共享實(shí)時豐富數(shù)據(jù)的可視化,這個博客簡要介紹一下在使用Pytorch進(jìn)行數(shù)據(jù)可視化的一些內(nèi)容,感興趣的朋友可以參考下
安裝
pip install visdom
啟動服務(wù)
python -m visdom.server
使用
基本上是按照先生成對象,然后追加內(nèi)容的方式。
import visdom
vis = visdom.Visdom()
vis.line([0.], [0.], win='jax train-loss', name="train loss", opts=dict(title='jax train loss'))
vis.line([0.0], [0.], win='jax time-consumed', name="time", opts=dict(title='jax time'))
vis.text(f"jax 進(jìn)行代理模型訓(xùn)練", win="jax log", opts={"title": "jax log"})
# jit_train_step = train_step
start_time = time.time()
s1=start_time
for epoch in range(iterations):
vis.text(f"{epoch+1}, Loss: {loss}, Time: {duration}", win="jax log", append=True)
vis.line([loss.item()*1000], [epoch+1], win="jax train-loss", update='append', name="train loss", opts={"title": "jax train loss"})
vis.line([duration], [epoch+1], win='jax time-consumed', update='append', name="time", opts={"title": 'jax time'})

下圖中,則是同一個圖中同時繪制兩個曲線

下圖演示繪制曲線

呈現(xiàn)效果

以上就是Pytorch使用Visdom進(jìn)行數(shù)據(jù)可視化的示例代碼的詳細(xì)內(nèi)容,更多關(guān)于Pytorch Visdom數(shù)據(jù)可視化的資料請關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
在VS Code上搭建Python開發(fā)環(huán)境的方法
這篇文章主要介紹了在VS Code上搭建Python開發(fā)環(huán)境的方法,需要的朋友可以參考下2018-04-04
在python中,使用scatter繪制散點(diǎn)圖的實(shí)例
今天小編就為大家分享一篇在python中,使用scatter繪制散點(diǎn)圖的實(shí)例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-07-07
python實(shí)現(xiàn)DEM數(shù)據(jù)的陰影生成的方法
這篇文章主要介紹了python實(shí)現(xiàn)DEM數(shù)據(jù)的陰影生成的方法,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-07-07
Python使用numpy模塊創(chuàng)建數(shù)組操作示例
這篇文章主要介紹了Python使用numpy模塊創(chuàng)建數(shù)組操作,結(jié)合實(shí)例形式分析了Python使用numpy模塊實(shí)現(xiàn)數(shù)組的創(chuàng)建、賦值、修改、打印等相關(guān)操作技巧與注意事項(xiàng),需要的朋友可以參考下2018-06-06

