Hi,
I need to split my images to validation and train set in cross validation, in a way that images of each patient be either in train or validation. each patient has about 8-11 images.
root
|___patien_1 im1
| | __ im2 …
|
|___patient_2 im1
| | __ im2 …
|
.
.
.
Each patient would get an index (similar to a target) and you could pass it to the GroupShuffleSplit to get the indices for the train and validation split based on the patients.
E.g. if patient_1 has 1 image and patient_2 2 images, you could pass the groups as: [0, 1, 1].