728x90 Negative pair loss1 [Pytorch] Negative Pair Loss 코드 두 feature가 멀어지도록 학습하는 loss Negative Pair Loss = max(margin - distance_metric(feature_1, feature_2), 0) -------- (1) where, max(f(x),0)은 f(x) > 0 이면 backpropagation 수행, margin은 feature_1과 feature_2를 얼마나 멀게 할 것인지, distance_metric은 두 feature의 거리를 구하는 function. 즉, 두 feature의 거리를 구하고 margin을 더했을 시, 0보다 크면 역전파하여 멀어지게 한다. 이 term은 triplet loss에서 positive pair과 같이 사용되기도 한다. 그렇다면 어떻게 두 feature를 멀어지게 한다는 것.. 2023. 7. 21. 이전 1 다음 728x90