GithubHelp home page GithubHelp logo

priyankclarifai / -online-soft-mining-and-class-aware-attention-pytorch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ppriyank/-online-soft-mining-and-class-aware-attention-pytorch

0.0 0.0 0.0 362 KB

Implementation of Weighted Contrastive Loss (Deep Metric Learning by Online Soft Mining and Class-Aware Attention)

Home Page: https://arxiv.org/pdf/1811.01459v2.pdf

Python 100.00%

-online-soft-mining-and-class-aware-attention-pytorch's Introduction

Online-Soft-Mining-and-Class-Aware-Attention-Pytorch

Implementation of Weighted Contrastive Loss from

Deep Metric Learning by Online Soft Mining and Class-Aware Attention (https://arxiv.org/pdf/1811.01459v2.pdf)
Xinshao Wang, Yang Hua1, Elyor Kodirov, Guosheng Hu, Neil M. Robertson

I will release the tensorflow implementation of the same soon :)

For an input vector x : n x d

dist refers to the pairwise distance between normalized feature vectors, of the shape n x n, dij = dist[i][j]

A refers to the pairwise attention score Aij = min(ai , aj)

Use (person re-id):


criterion_osm_caa = OSM_CAA_Loss()
if use_gpu:
   imgs, pids = imgs.cuda(), pids.cuda()
imgs, pids = Variable(imgs), Variable(pids)
outputs, features = model(imgs)
if use_gpu:
  loss = criterion_osm_caa(features, pids , model.module.classifier.weight.t())         
else:
  loss = criterion_osm_caa(features, pids , model.classifier.weight.t())         

-online-soft-mining-and-class-aware-attention-pytorch's People

Contributors

ppriyank avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.