I am using torchvision ImageFolder
to load my training data where each directory contain samples for a particular class instance.
I want to split the data into training and validation set. How can I do it so that the split is done per class i.e. if the split is 90-10 for 90% training data and 10% validation, it should randomly choose 90% of the data for training from each of the folders.
Is there an easy way to do this from within pytorch with the ImageFolder
dataset?