Thank you, I understand. I forgot to apply the transformations in my custom Dataset class…
But now I have another problem. My images have more than 4 channels, and when I apply ToPILImage, the output has only 3 channels. Is it possible to have a PIL image with the original number of channels?
For more details.
Here’s how I create a tensor with 6 channels in my custom Dataset class:
# Iterate over the files corresponding to each channel of 1 image
for path in paths:
path = self.path_imgs+path
with pil.Image.open(path) as img:
# Append channel
channels.append(tv.transforms.ToTensor()(img))
if self.transform:
to_append = self.transform(t.cat(channels, dim = 0))