adambielski / siamese-triplet

Siamese and triplet networks with online pair/triplet mining in PyTorch
BSD 3-Clause "New" or "Revised" License
3.1k stars 633 forks source link

alternative triplet loss #1

Closed eladhoffer closed 6 years ago

eladhoffer commented 6 years ago

might be interesting to compare with the alternative triplet loss described in: https://arxiv.org/abs/1412.6622

adambielski commented 6 years ago

Thanks! I've heard about this definition too - it might be interesting to compare. Might add it to the repo at some point.

preesee commented 6 years ago

Quite a nice framework! I am considering to apply the code onto NLP for the text similarity detection! However if so ,the network layer has to be changed to a LSTM. Any idea about the expendibility for the framework?

adambielski commented 6 years ago

@preesee You can use whatever network definition in PyTorch you want. Just use it with appropriate loss functions.

preesee commented 6 years ago

I am trying to leverage triplet loss ,as some papers proves that triplet loss improve the accuracy.But triplet returns only (0,1) ,which means only negative or positive returns for the prediction values, correct? text similarity is a scale with values in range [0,5],do you think it is possible to measure similarity of two pics into value in range , eg: [0,5] with triplet loss base on your framework ?

adambielski commented 6 years ago

I don't really know what problem exactly you're referring to. To apply it to a different problem than same/different within a class label, the triplet loss probably should be modified.

preesee commented 6 years ago

Hi adambielski, I still have a question about Triplet network here: after the Triplet network model trained , how we can use the model in product environment then ?We still need to feed 3pics as a tuple to the network ? eg: let's suppose I have 3 pic[face1]:A, [face2]:P,[face3]N but I don't know if they are same person or not each other, how to feed this 3pics? If I already know face1 and face2 are in the same class/person and face3 is from a different person , what is the meaning for this model? A little confused about the usage of this model. The siamese network is quite clear about its usage, we can set a threshold for the similarity value, but as for the triplet network where should we extract the similarity value from ?[AP] or [AN] or [PN]?