12.21pytorch study notes
Enterprise
2023-08-12 02:14:21
views: null
1. When reading and displaying images in Python:
from PIL import Image
img_path = ’ image_path ’
img = Image.open(img_path)
img.size # display image size
img.show()
2. Learn to use tensorboard to visualize graphics in pytorch:
from torch.utils.tensorboard import Summarywriter
writer = Summarywriter(‘logs’)
for i in range(100):
writer.add_scalar(‘y=2x’, 2*i, i)
writer.close()
On the terminal:
tensorboard --logdir=logs Generate a graphic URL that displays the above tensorboard generated
3. Learn to use tensorboard to visualize images in pytorch:
from torch.utils.tensorboard import Summarywriter
writer = Summarywriter(‘logs’)
writer.add_image('image name', visualized image)
writer.close()
On the terminal:
tensorboard --logdir=logs Generate image URLs that display the above tensorboard generated images
4.opencv
import cv2
img = cv2.imread(img_path)
cv2.imshow(img)
Added python function usage method:
· Focus on input and output types
·See more official documents
· What parameters are required by the attention method
When the return value is unknown: print();print(type());debug
Origin blog.csdn.net/weixin_41807182/article/details/111469661