ConcatDataset
will not create a mapping, but just index the passed Datasets
.
Each Dataset
should make sure to yield the “right” labels.
E.g. in your second use case, you should make sure that dataset1
only yields samples with the class labels 0 and 1 (dog and cat), while dataset2
should only yield 0 and 2 (dog and pig).
The mapping is defined by your Dataset
implementation.
Note that if you are using e.g. ImageFolder
, the mapping will be created based on the folders, so I would not recommend using this approach, if your dataset folders do not contains the same classes.