Hello, i have dataloader and permute function given below. I need to get rid of this error :
Given groups=1, weight of size [64, 1, 3, 3], expected input[1, 18, 368, 368] to have 1 channels, but got 18 channels instead
For this reason i need to place permute function into the getitem but when i try to place to into the getitem it didn’t work so can you help me ? What can I do ?
class CustomDataset(Dataset):
def __init__(self, image_paths, target_paths, transform, train=True): # initial logic happens like transform
#self.image_paths = image_paths
self.target_paths = target_paths
self.transforms = transforms.ToTensor()
def __getitem__(self, index):
#image = Image.open(self.image_paths[index])
mask = np.load(self.target_paths[index])
t_image = self.transforms(mask)
return t_image
def __len__(self): # return count of sample we have
return len(self.target_paths)
a=torch.randn(18, 1, 368, 368)
b=a.permute(1, 0, 2, 3)
print(a.shape)
print(b.shape)