Skip to content

Pytorch Implementation of the Paper A UNIFIED VIEW OF DEEP METRIC LEARNING VIA GRADIENT ANALYSIS

Notifications You must be signed in to change notification settings

ppriyank/Pytorch-Relative-and-Absolute-similarity-based-Weight-assignment-RAW

Repository files navigation

Pytorch-Relative-and-Absolute-similarity-based-Weight-assignment-RAW

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

Use :

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)

Intution

  • 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

Weight :

Weights

where :

* Relative similarity between the positive pair:

* Absolute similarity

Gradient Equivalent Loss function

loss

About

Pytorch Implementation of the Paper A UNIFIED VIEW OF DEEP METRIC LEARNING VIA GRADIENT ANALYSIS

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages