Error with Dataloader with multiple classes

Hi everyone,
My data is composed of 3 classes:
‘x_ray’: [NumpyToTorch(image) for image in x_ray],
‘bone1’: [NumpyToTorch(image) for image in bone1],
‘bone2’: [NumpyToTorch(image) for image in bone2]
I create a data loader and want to loop on this data for my network.
dataloader = DataLoader(data, batch_size=batch_size,

I get the error:
data = [self.dataset[idx] for idx in possibly_batched_index]
KeyError: 0

Someone can explain to me how to work with a data loader with multiple classes.


Could you try to index the Dataset directly with index0 and see, if it would raise an error?

out = data[0]

should probably yield a better error message.

Yes, thank you.
I figure it out, the error was related to the dataloader.