I used randome distribution to distribute data between validation and data sets. Now, for further tests, I need to save the images that are selected in validation set. Is it possible to save the images from dataset with the same name?
validation_split = 0.2
shuffle_dataset = True
random_seed= 42
batch_size=100
Creating data indices for training and validation splits:
dataset_size = len(train_dataset)
indices = list(range(dataset_size))
split = int(np.floor(validation_split * dataset_size))
if shuffle_dataset :
np.random.seed(random_seed)
np.random.shuffle(indices)
train_indices, val_indices = indices[split:], indices[:split]
Creating PT data samplers and loaders:
train_sampler = SubsetRandomSampler(train_indices)
valid_sampler = SubsetRandomSampler(val_indices)