Hi, I have custom dataset that loads data from a subfolder root_x that contains 625 training images and a subfolder root_y that contains 625 matrices. My issue is that when I call the function len() after the loading, the returned value is 67 instead of 625.  Can someone explains me why and what I should change to get the correct size when I call len().
#custom class
class MappingDataset(Dataset):
def __init__(self, root_x, root_y, transform=None):
    self.root_x = root_x
    self.root_y = root_y
   
def __len__(self):
    return len(self.root_x)

def __getitem__(self, idx):
    img_name = self.root_x + str(idx) + '.png'
    image = io.imread(img_name)
    wpmap_name = self.root_y + str(idx) + '.txt'
    wpmap = np.loadtxt(wpmap_name, np.int)
    sample = {'image': image, 'wpmap': wpmap} 
    return sample

#main
training_set = MappingDataset(root_x, root_y)
print(len(training_set) = 67 #instead of 625
I note that I can iterate over the training_set when I explicitly give the range of the for loop.
for i in range(1, 626):
sample = training_set[i]
print(i, sample[‘image’].shape, sample[‘wpmap’].shape)