omoindrot / tensorflow-triplet-loss

Implementation of triplet loss in TensorFlow
https://omoindrot.github.io/triplet-loss
MIT License
1.12k stars 284 forks source link

Monitor training process with batch hard #28

Open FSet89 opened 5 years ago

FSet89 commented 5 years ago

When using batch hard, is it correct to say that the hardest negative distance should increase and the hardest positive distance should decrease during training? Is it a good method to monitor the training process?

paweller commented 3 years ago

Yes, it is true that the inter-class (or negative) distances should increase while the intra-class (or positive) distance should decrease during training. The triplet loss aims to do exactly that.

Regarding the monitoring process you can use the mean inter-class or intra-class distance. However, as those can differ a lot from project to project, you might want to rather use other metrics. These could be a triplet error rate (number_of(d(A,P)-d(A,N) > 0) / number_total_triplets) or the AUC-ROC metric or simply the L2 distance.