I would like to use only 100 images from each class from cifar10 to train my model. i.e. 100 images for every class in cifar10 which is (100 images)*(10 classes) = 1000 images.
How to select x number of images and it's labels from each class from an image dataset like cifar10?
You can access the underlying target tensors directly in the CIFAR10
dataset via:
dataset.targets
Using these targets you could compute the indices for 100 samples for each class.
Once you have these indices, you could use a Subset
with these indices to only draw these specified samples.