Hi team,
In C3_M1_Lab_1 the signature model was not trained. I made a fix on my end by replacing the getitem in SignatureTripletDataset(Dataset) with:
def _getitem_(self, index):
# Each block of triplets_per_user indices belongs to one person
person_index = index // self.triplets_per_user
person_id = self.user_ids[person_index]
anchor_path, positive_path = random.sample(
self.signature_map\[person_id\]\['real'\], 2
)
negative_path = random.choice(
self.signature_map\[person_id\]\['fake'\]
)
anchor_img = self.\_load_image(anchor_path)
positive_img = self.\_load_image(positive_path)
negative_img = self.\_load_image(negative_path)
return anchor_img, positive_img, negative_img
So PyTorch’s indexing, splitting, and sampling now behave consistently. Kindly review!
