Data loader for two datasets (same number and same resolution of images)

i have a single model (Net) that contains two separate ResNet (cnn) models.
i want to pass two datasets(same number and same resolution of input images) into the same model using one dataloader.
can you help me?

From your other post - does this thread help you? The idea would be to:

  • Create two data sets
  • Create a final data set that joins the two datasets
  • Create a dataloader for the final concatenated datasets to pass into your model.

We need more information to come to a solution. However, it is possible to return different images with labels in the same dataloader.

class SampleDataloader(Dataset):
	def __init__(self, required_arguments...):
    #Modify as per your use
    self.length_samples = #length of samples
    def __len__(self):
         return self.length_samples
    def __getitem__(self, index):
        # returns a single sample at a time
         return image1, image2, label1, label2

As i’ve mentioned if you are looking for more accurate code, try to mention what you are trying to do.