Is there any way to use augmentations on images when number of channels is not 1, 3 or 4?

I have a dataset that has 16 channels. I want to use augmentations like crop and resize. Only problem is that torch expects images in PIL format that only supports upto 4 channels.

torchvision.transform accepts tensors, too, and should work on image tensors with 16 channels:

x = torch.randn(16, 224, 224)
transform = transforms.Resize((200, 200))
out = transform(x)
# torch.Size([16, 200, 200])
1 Like