網(wǎng)絡(luò)上查找到兩種可視化方式:
其一:Visdom包(https://zhuanlan.zhihu.com/p/32025746)
其二:tensorboardx調(diào)用tensorboard(參考 http://www.itdecent.cn/p/46eb3004beca)
本文采用第二種方式,安裝文件
pip install tensorboardX
pip install tensorflow
測(cè)試代碼
'''
參考 http://www.itdecent.cn/p/46eb3004beca
'''
import numpy as np
from tensorboardX import SummaryWriter
writer = SummaryWriter()
for epoch in range(100):
#print(epoch,epoch*np.sin(epoch),epoch*np.cos(epoch))
writer.add_scalar('scalar/test',np.random.rand())
writer.add_scalars('scalar/scalars_test',{'xsinx':epoch*np.sin(epoch),'xcosx':epoch*np.cos(epoch)},epoch)
writer.close()
目錄下生成文件位于runs文件夾下,調(diào)用
tensorboard --logdir runs
提示 TensorBoard 1.13.1 at http://DESKTOP-SM5RK2N:6006 (Press CTRL+C to quit)
但是本機(jī)輸入http://DESKTOP-SM5RK2N:6006 在瀏覽器中無法打開,參考https://blog.csdn.net/zhangkaixu321/article/details/79166089,訪問地址修改為
http://localhost:6006
成功訪問

tensorboardx訪問成功