Pytorch Implementation of the Paper A UNIFIED VIEW OF DEEP METRIC LEARNING VIA GRADIENT ANALYSIS
A UNIFIED VIEW OF DEEP METRIC LEARNING VIA GRADIENT ANALYSIS
Anonymous authors
Paper under double-blind review
https://openreview.net/pdf?id=Skf5qiC5KQ
from raw import RAW_LOSS
raw = RAW_LOSS(alpha=0.1, beta=0.1, gamma = 0.1, use_gpu=use_gpu)
if use_gpu:
imgs, pids = imgs.cuda(), pids.cuda()
imgs, pids = Variable(imgs), Variable(pids)
outputs, features = model(imgs)
loss = raw(features, pids)
-
Hardest positive: The postive label example which has the max cosine similarity
-
Hardest negative: The negative example which has the min cosine similarity
-
Valid Positive Examples : The postive label examples which have smaller cosine distance compared to Hardest negative : P
-
Valid Negative Examples : The negative label examples which have smaller cosine distance compared to Hardest positive : N