How to split image dataset into training and testing set?

(Dharmik Bhatt) #1

I have 100 images for a class and I have 10 such classes. Now the problem is I have all the 100 images(per class) in one folder and naturally I have 10 such folders. How can I split that dataset into training and testing dataset (say 80-20%) for each class ? I don’t want to manually select 80 images from each folder and then split them in testing folder.
Thanks in advance! :slight_smile:


You could use a Subset and pass the indices to create a training and test dataset. :slight_smile: