可视化工具 Tensorboard
- 导入tensorboard
from torch.utils.tensorboard import SummaryWriter
- 创建board,添加图表、图片
# 调用时在根目录创建文件夹log
board = SummaryWriter("log")
board.add_scalar("tag1", y_label, x_label)
# 注:若img_array不是CWH,则末尾追加dataformats
board.add_image("tag2", img_array, index)
board.close()
- 实例化(在终端启动Tensorboard,端口8080)
tensorboard --logdir=log --port=8080