upon create the dataloader, i try to iterate it ( image, labels = next(iter(dataloader)) ) to check the content and got the following error:
TypeError: pic should be PIL Image or ndarray. Got <class ‘torch.Tensor’>
For train data transform as followings:
train_transform = transforms.Compose(
i have created the image dataset as img_dataset with images and csv (image file name and label) using above train_transform
i then create split data by calling train_sampler = SubsetRandomSampler(…)
and dataloader = DataLoader(img_dataset, batch_size=64, sampler = train_sampler)
I understand that upon using train_transform, the images loaded will be convert to tensor. which is what i need before fitting to model. However, when I do the iteration, it states that it should be PIL Image or ndarray. i have checked on line for a while but all the sample codes from the web are similar to my code. why in my case, there is a strange error like this. and how can i solve it?