I created a custom ImageFolder with torch.utils.data.Dataset class and then converted it to a dataloader, but when I want to see one of the elements of data loader with img_custom, label_custom = next(iter(train_dataloader_custom)) it gives this error:
"stack expects each tensor to be equal size, but got [3, 128, 128] at entry 0 and [4, 128, 128] at entry 10"
I resized the images in the custom ImageFolder class to (128,128).
Important note: It works sometimes! like I run the cell 6 times and 4 times it works (gives the batch of images and corresponding labels) and 2 times gives error!
how can an image have 4 channels! (in the error it says entry 18 is [4,128,128])