Hello everyone,
I am interested in creating a custom multilabel dataset class. I am reading the data from a csv file.

57119647_294611341436714_6647078226956910592_n (1).png1052×476 19.7 KB

class MyDataset(Dataset):

    def __init__(self, df_data, data_dir = './', img_ext='.png', transform=None):
        super().__init__()
        self.df = df_data.values
        self.data_dir = data_dir
        self.img_ext = img_ext
        self.transform = transform

    def __len__(self):
        return len(self.df)
    
    def __getitem__(self, index):
        img_name,label = self.df[index]
        img_path = os.path.join(self.data_dir, img_name+self.img_ext)
        image = cv2.imread(img_path)
        if self.transform is not None:
            image = self.transform(image)
        return image, label

How can this be implemented?