Hi
I have a rather small image dataset and want want to augment my training images.
However I want the training-dataloader to use unaugmented images as well as augmented images.
For that I am using the ConcatDataset-class. I also want to use WeightedRandomSampler, because some classes have more images than others, the amounts of images per class being: [602,536,1088,751].
datasetBasic = datasets.ImageFolder('path', transform=transformsBasic)
datasetAugmented = datasets.ImageFolder('path', transform=transformsAugment)
concatDataset=torch.utils.data.ConcatDataset((datasetBasic,datasetAugmented))
dataloaders_dict = {"train": torch.utils.data.DataLoader(concatDataset, batch_size=batch_size, sampler=sampler, num_workers=0, pin_memory=True),
"val": torch.utils.data.DataLoader(datasetBasic, batch_size=batch_size, shuffle=True, num_workers=0,pin_memory=True)}
However I do not know how I should use WeightedRandomSampler together with ConcatDataset.
Is there any suggestion to how I can solve this issue?
This post ist very similar to: Sampling from a concatenated dataset , but there were no more replies on that one so I am asking again ^^β.
PS: Great forums, the people seem to be really active here ^^