How to load data from list

Hi, all,

I am totally new here. I have a basic question, if I have a image list and label list, how to fit to data utils?

Just create a Dataset for that. Something like

class MyDataset(
    def __init__(self, list_of_images, list_of_labels):
        self.list_of_images = list_of_images
        self.list_of_labels = list_of_labels
        assert len(list_of_images) == len(list_of_labels)

    def __getitem__(self, idx):
        return self.list_of_images[idx], self.list_of_labels[idx]

    def __len__(self):
        return len(self.list_of_labels)