Custome dataset : multiple input in pytorch

I have a csv file having two columns image name(around 300) and ID(say 1,2). Different images may have same ID so there can be more than one image against one ID.I want to assign 0 label for images sharing same ID and 1 for different. My model should read two images in testing phase and reply 1 if images have different IDS(1 and 2) and 0 if same images. There are two folders ID1 and ID2 and it has all images against each ID.
Problem:
what is best piece of code to override getitem,either converting images to numerical and concatenate or what?