I want to convert images to tensor using torchvision.transforms.ToTensor(), after processing I printed the image but the image became so weird. Here is my code:
trans = transforms.Compose([
transforms.ToTensor()])
demo = Image.open(img)
demo_img = trans(demo)
demo_array = demo_img.numpy()*255
print(Image.fromarray(demo_array.astype(np.uint8)))
The original image is this
But after processing it is showed like this
Did I write something wrong or miss something?