SummaryWriter和tensorboard使用示例

from torch.utils.tensorboard import SummaryWriter
import numpy as np
from PIL import Image

writer = SummaryWriter("logs")
image_path = "dataSet/train/ants/0013035.jpg"
img_PIL = Image.open(image_path)
img_array = np.array(img_PIL)
writer.add_image("test", img_array, 1, dataformats="HWC")

for i in range(100):
    writer.add_scalar("y=x", i, i)

writer.close()

运行后产生logs文件

然后命令行输入 tensorboard --logdir 'NeuralNetwork/test/logs'

上一篇:如何查看k8s相关日志


下一篇:ansble通过脚本定时清理k8s日志