How to remove specific datapoints from dataset during training?

Hello, I would like to remove specific datapoints during training, I would need to keep track of the ‘global’ index of a particular image, remove and have a new loader with the new set (after removal) set. What is the best way to do this?

I think one easy approach would be to

  • store the indices of all data samples, which should be removed in a list during training
  • remove these indices from the complete list of indices to create the “valid indices”
  • wrap the dataset in a Subset with the new “valid” indices,
  • and recreate the DataLoader after the epoch.