Load Data and Train simultaneously on two datasets

Hi ptrblck, I am quite confused about how can we simultaneously load the datasets if both datasets are different?

I’m not sure what “different” would mean in this context. In the previously described use case I’ve suggested to load the image pairs in a single custom Dataset instead of creating multiple Datasets and loaders, which seems to have worked fine. Are you seeing any issues using this approach?

Even if you create your own indices, doesn’t SubsetRandomSampler still randomly permute the indices, leading to mismatch? (See below)

def __iter__(self) -> Iterator[int]:
    for i in torch.randperm(len(self.indices), generator=self.generator):
        yield self.indices[i]

No, since yield self.indices[i] is used, so you are randomly indexing the passed self.indices, which contain your designed subset.