tensorboardX

1、安装tensorboardX

2、安装tensorflow

3、在Xshell中增加隧道监听,tensorboard是6006端口

tensorboardX_第1张图片

4、程序将需要做图的数据写入log文件,注意在写完后要增加writer.close(),否则回报错:Unable to get first event timestamp for run .: No event timestamp could be found

from tensorboardX import SummaryWriter
writer = SummaryWriter('runs/scalar_example')
for i in range(10):
    writer.add_scalar('quadratic', i**2, global_step=i)
    writer.add_scalar('exponential', 2**i, global_step=i)
writer.close()

5、运行程序后,在命令行输入:tensorboard --logdir "your path"

6、在本地,打开服务器,输入:localhost:6006,成功出现

参考:https://blog.csdn.net/u014767662/article/details/82911359

https://blog.csdn.net/bigbennyguo/article/details/87956434

 

7、如果在本地无法打开localhost:6006,可能是本地端口6006被占用了,在隧道中更改本地端口为12345或者其他端口号,重新在浏览器中输入localhost:12345,即可。

8、tensorboardX的add_graph(),会有pytorch和tensorboardX的版本兼容问题。在torch0.4.0+torchvision0.2.0+tensorboardX1.4 可以得到正常可视化结果,在torch1.5.0+torchvision0.6.0+tensorboardX2.0不行,可视化结果就是两个空框子

你可能感兴趣的:(深度学习)