facenet triplet loss with keras

后端 未结 4 1845
野趣味
野趣味 2021-01-31 09:50

I am trying to implement facenet in Keras with Thensorflow backend and I have some problem with the triplet loss.

I call the fit function with 3*n number of images and t

4条回答
  •  青春惊慌失措
    2021-01-31 10:28

    What could have happened, other than the learning rate was simply too high, was that an unstable triplet selection strategy had been used, effectively. If, for example, you only use 'hard triplets' (triplets where the a-n distance is smaller than the a-p distance), your network weights might collapse all embeddings to a single point (making the loss always equal to margin (your _alpha), because all embedding distances are zero).

    This can be fixed by using other kinds of triplets as well (like 'semi-hard triplets' where a-p is smaller than a-n, but the distance between a-p and a-n is still smaller than margin). So maybe if you always checked for this... It is explained in more detail in this blog post: https://omoindrot.github.io/triplet-loss

提交回复
热议问题