When enumerating over my dataset I get this error:
mask_path = self.mask_files[idx]
IndexError: list index out of range
from this line:
for index, (tiles, labels) in enumerate(loader):
I tried with other datasets it is working well. The problem seem to come from a subsetting I am doing when loading the dataset to gain time. When I use this dataset I get this issue. Maybe it comes from that but I do not know in what way.
class GreenhouseDataset(Dataset):
def init(self, folder_data):
    # lists to store the data
    self.mask_files = []
    self.img_files = []
    
    # getitng the list of files
    list_files = fun.get_files(folder_data)
    list_files = random.sample(list_files, len(list_files)//10) 
    
    # extracting the data
    for filename in list_files:
           self.mask_files.append(filename)
            self.img_files.append(filename)

PS: its my first post on this forum