refer to code
key is "transforms.PILToTensor"
..
import torch
from PIL import Image
import torchvision.transforms as transforms
pil_image = Image.open('input.jpg')
transform = transforms.Compose([
transforms.PILToTensor()
])
tensor_img = transform(pil_image)
print(tensor_img)
..
Thx. ππ»♂️
No comments:
Post a Comment