I want to remove some particular train images from the CIFAR10 train_set. I have the indices of all the train_images I want get rid of. How can I do that?
You could remove
these indices from all indices and create a Subset
with these:
indices = list(range(0, 60000))
indices_to_remove = [0, 4, 10, 5000]
[indices.remove(x) for x in indices_to_remove]
print(indices[0:10])
# [1, 2, 3, 5, 6, 7, 8, 9, 11, 12]
print(indices[4990:5000])
# [4993, 4994, 4995, 4996, 4997, 4998, 4999, 5001, 5002, 5003]