Good evening everyone,
I got a problem with loading multiple datasets and did not find a solution so far.
For loading multiple datasets into one dataloader I can use the ConcatDataset class, but how do I concatenate e.g. CIFAR10 and MNIST. For this I would have CIFAR10 to resize and convert to grayscale without applying the transformations to MNIST.
Any ideas on how to do that?
You could specify the transformations for each dataset.
This code should work:
mnist = datasets.MNIST(
cifar = datasets.CIFAR10(
dataset = ConcatDataset((mnist, cifar))
As you can see
transforms.Grayscale was only applied for the CIFAR10 dataset.
Oh yes of course, I am really a blockhead.
Can you concatenate the targets using this approach? If not, how do we go about it?
ConcatDataset will concatenate all passed
Datasets keeping their samples and targets.