Hello everyone, I have just started learning Pytorch and i got a problem while trying to create dataloader from my customized datasets which is contains 20 files “data_x.mat” stored in specific folder, I need to use them with data-loader, can anyone help me how to create this class to get iterable batches :
Mydata is
- 10 files each is dict {“Training_Patches”: shape(760,120,21,21) / “Label”: shape(1,760)} stored in .mat file
- 10 files each is dict {“Testing_Patches”: shape(420,120,21,21) / “Label”: shape(1,420)} stored in .mat file
Here is what i thing it should looks like, Any suggestion,ideas, help would be Appreciated
class Datasets(Dataset):
def __init__(self):
self.tensors = []
self.labels = []
for i in range(len(data_i["Training_patches"])):
self.tensors.append(data_i["Training_patches"])
self.labels.append(data_i["labels"])
def __getitem__(self, index):
# return one item on the index
return
def __len__(self):
# return the data length
return