Remove indices from Dataset

Thank you for your response

This is the code for the dataset

class SLD_Labeled(Dataset):

    def __init__(self):
        self.root = "/home/ubuntu/workdir/data/real_stuff/"
        self.image_dir = os.listdir(self.root+'images/')
        self.bands = ['B02', 'B03', 'B04']
        
        
    def __len__(self):
        return len(self.image_dir)

    def __getitem__(self, index):
        
        subf = os.path.join(self.root, f'images/'+self.image_dir[index])
        multiband = []

        b = Image.open(subf).convert('RGB')
        label_file = os.path.join(self.root, f'labels/{self.image_dir[index]}').replace('.jpg', '.tif')
        
        label = np.array(Image.open(label_file).convert('P'))
        if ':' in label_file:
            #print('original image')
            pass
        else:
            #print('In generated image')
            label= np.where(label<128, 0, label)
            label= np.where(label>127, 1, label)
        bgr_images = np.array(b)

        
        data_tensor = torch.from_numpy(np.transpose(bgr_images,(2, 1, 0))).float()
        label_tensor = torch.from_numpy(label).long()
       

        return data_tensor, label_tensor,str(self.image_dir[index])

The same dataset was used for Both the validation_data and supervised_data
I am trying to remove the validation_data indices that exist in the supervised data so I can have a subset that doesn’t contain the validation_data