Based on the error message this code is raising the issue:
        img0_info = self.relationships[index][0]#for each relationship in train_relationships.csv, the first img comes from first row, and the second is either specially choosed related person or randomly choosed non-related person
        img0_path = glob("/home/phillip/Data/test3/"+img0_info+"/*.png")
        img0_path = random.choice(img0_path)

so you could check what img0_path contains by adding a print statement to the __getitem__ method.
I guess img0_info is invalid, is thus creating an invalid path such that glob cannot find any files and, the choice operation fails in the end.