Code Monkey home page Code Monkey logo

dreml's Introduction

New approach for better retrieval performance with single model: Improved Embeddings with Easy Positive Triplet Mining(WACV2020)

Paper link: https://arxiv.org/abs/1904.04370

Git link: https://github.com/littleredxh/EasyPositiveHardNegative

Deep Randomized Ensembles for Metric Learning

This repository contains the PyTorch(1.5.0) implementation of Deep Randomized Ensembles for Metric Learning(ECCV2018)

Paper link: https://arxiv.org/abs/1808.04469 or https://www2.seas.gwu.edu/~pless/papers/DREML_ECCV2018.pdf

Prepare the training data and testing data in python dictionary format.

For example:

data_dict = {'tra' : {'class_tra_01':[image path list],
                      'class_tra_02':[image path list],
                      'class_tra_03':[image path list],
                      ....,
                      'class_tra_XX':[image path list]}
                 
             'test': {'class_test_01':[image path list],
                      'class_test_02':[image path list],
                      'class_test_03':[image path list],
                      ....,
                      'class_test_XX':[image path list]}
            }

Replace Data and data_dict in the file main.py

We have the color nomarlization info for CUB, CAR, SOP, CIFAR100, In-shop cloth and PKU vehicleID data. If you want to use other dataset please add the color nomarlization value in _code/color_lib.py

We also provide efficient recall@K accuracy calculation functions in _code/Utils.py

Function for CAR,CUB and SOP dataset:recall(Fvec, imgLab, rank=None) 
Fvec:   Feature vectors, N by D torch.Tensor
imgLab: Image label, python list
rank:   k of recall@k, python list

Function for In-shop Cloth dataset: recall2(Fvec_val, Fvec_gal, imgLab_val, imgLab_gal, rank=None) 
Fvec_val:     Probe feature vectors, N_val by D torch.Tensor
Fvec_gal:     Gallary feature vectors, N_gal by D torch.Tensor
imgLab_val:   Probe image label, python list
imgLab_gal:   Gallary image label, python list
rank:         k of recall@k, python list

The example of calling the function is shown in Recall.ipynb

Please cite our paper, if you use these functions for recall calculation.

Requirements

Pytorch 1.5.0

Python >3.5

Updates

06/12/2020/: Upgrade to PyTorch 1.5.0 version

05/01/2019/:

Upgrade to PyTorch 1.0.0 version

Simplified the codes structure

Fix the bug in Recall.ipynb

Add recall functions for CAR, CUB, SOP and In-shop cloth dataset

Citation

@InProceedings{Xuan_2018_ECCV,
author = {Xuan, Hong and Souvenir, Richard and Pless, Robert},
title = {Deep Randomized Ensembles for Metric Learning},
booktitle = {The European Conference on Computer Vision (ECCV)},
month = {September},
year = {2018}
}

dreml's People

Contributors

littleredxh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

dreml's Issues

Recall code is broken

Currently the run and recall parts of the code are broken. I had to rewrite the whole evaluation myself. Please fix.

Issue about the pre-trained model

thanks for your contributions first!, but I think it is not fair to compare with other SOTA methods without the same CNN model, i.e. GoogleNet V1. In paper, you use Resnet-18 and V3. So could you provide the results on model Googlenet V1?

Evaluation protocol for PKU VehicleID dataset

Could you please share the routine for the evaluation on PKU VehicleId dataset?
We want to have exactly the same procedure in our paper to be fully comparable with your results.

The output dimension for the retrieval.

Really interesting work.

I am wondering the final embedding dimension in your method.

For example, the table

image

According to the discription in the paper, I guess that the final embedding dimension of DREML (R,12,48) is 48 X 512 = 24576.

(R, 12, 48) means that you employ 48 network, and each network employs 12 group labels.

Similarly, it seems that you employ much higher dimension on the Stanford-Products dataset,

image

So does DREML (R,192,48) employ 48 X 512 = 24576-D feature embeddings?

the loss about Proxy loss

The Proxyloss in the loss.py.
The ”fvec“ multiply an transpose eye martix. So the value of the fvec is not change.Why multiply this?
And the proxy loss in this code is the softmax cross entropy.
But in the paper say use the 11th reference for loss.
The 11th refernce "No Fuss Distance Metric Learning using Proxies" is the loss about triplet loss,not the softmax cross entropy.

The performance problem.

I clone the project and running the code with the same hyperparameters in the paper. The recall@1 on Cub200-2011 is 63.79%, which is far from the result in paper 80.5. P.S. the model is DREML(R,12,48). I wonder it may be caused by the different settings of hyperparameters, so would you give me a detailed parameter setting on CUB200-2011?

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.