I am using torchvision.Transforms to prepare images for a network but when I perform the operation I get strange scaling of the image.
Here is an image before transforming which is just a numpy array:

and now performing the transform…
transform = transforms.Compose([transforms.ToTensor()])
tensor = transform(image.reshape(*image.shape,1)).float().numpy()

plt.figure()
plt.imshow(tensor[0,:,:],cmap='jet')
plt.colorbar()


Is this because the ToTensor class expects an image of a certain type or am I missing something in the data maybe?
Thanks in advance!