Customize data loader using .npy files

Hello, I am new to PyTorch.
I’m struggling data loader part in PyTorch.

Objective
I want to bring a pair of images and a binary value written on test.npy file. It will look like this.

To do that, I prepared the location of the image pair and a binary value written on loc.npy file.
It will look like this.
image

(My account allowed to upload only one image. sorry)

I saw a similar question in PyTorch forum. [1]

Based on that I wrote a code like this.

class MyDataset(Dataset):
    def __init__(self, data_paths_1,data_paths_2, label_list, transform=None, target_transform=None):
        # length of data_paths_1 and data_paths_2 is equal 
        self.data_paths_1 = data_paths_1 # source1 image dataset links ex) ["./AA/a.jpg","./BB/b.jpg","./CC/c.jpg",...]
        self.data_paths_2 = data_paths_2  # source2 image dataset links ex) ["./BB/b.jpg","./CC/c.jpg","./DD/d.jpg",...]
        self.label_lists = label_list  # label_list ex) [0,1,1,...]
        self.transform = transforms
        
    def __getitem__(self, index):
        x1 = Image.open(self.data_paths_1[index])
        x2 = Image.open(self.data_paths_2[index])
        if self.transform:
            x1 = self.transform(x1)
            x2 = self.transform(x2)
        y = self.label_lists[index]
        return x1,x2, ys

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

My hardware environment is not really good so I can’t run it right now.
Can you check if I missed something on that code line?
What I want is that check the overall architecture of the code. you can ignore minor problems.
I have no one to check my code so I uploaded my code in here. Sorry for just uploading code line in here.

Hi Yupjun,
I understand that you don’t have the computing resource right now to test your code.
Fortunately, there are online services that seek to help people with out access.
One such website is Google Colab. This should enable you to carry out tests on you code in a gpu environment. There is also support for pytorch. An tutorial for the same can be found here.

Hope this helps!