liorshk / facenet_pytorch

PyTorch implementation of the paper "FaceNet: A Unified Embedding for Face Recognition and Clustering"
MIT License
322 stars 90 forks source link

Bug: triplet loss #6

Closed gsygsy96 closed 6 years ago

gsygsy96 commented 6 years ago

when I train triplet loss, I find bug in here: out_selected_a = Variable(torch.from_numpy(out_a.cpu().data.numpy()[hard_triplets]).cuda()) out_selected_p = Variable(torch.from_numpy(out_p.cpu().data.numpy()[hard_triplets]).cuda()) out_selected_n = Variable(torch.from_numpy(out_n.cpu().data.numpy()[hard_triplets]).cuda())

it should be out_a[hard_triplets]. Otherwise, grad won't be caculated.