一、
from PIL import Image from torch.utils.tensorboard import SummaryWriter from torchvision import transforms # python的用法-》tensor数据类型 # 通过transforms.ToTensor去解决两个问题 # 2、为什么我们需要Tensor数据类型 img_path = "C://Users//admin/Pictures/Camera Roll/jiaxiao.webp" img = Image.open(img_path) # writer用于tensorboard显示图片 writer = SummaryWriter('logs') # 1、transsforms该如何使用 tensor_trans = transforms.ToTensor() tensor_img = tensor_trans(img) writer.add_image("Tensor_img", tensor_img) writer.close()
View Code
二、在Terminal界面输入 tensorboard –logdir=logs
三、点击界面出现的地址
原创文章,作者:bd101bd101,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/245436.html