Assume I am using the following calls:
trainset = torchvision.datasets.ImageFolder(root="imgs/", transform=transform)
trainloader = torch.utils.data.DataLoader(trainset,batch_size=4,shuffle=True,num_workers=1)
As far as I can tell, this defines the trainset
as consisting of all the images in the folder "images", with labels as defined by the specific folder location.
My question is -
Is there any direct/easy way to define the trainset
to be a sub-sample of the images in this folder? For example, define trainset
to be a random sample of 10 images from every sub-folder?