Code Monkey home page Code Monkey logo

adhirajghosh / rptm_reid Goto Github PK

View Code? Open in Web Editor NEW
27.0 2.0 2.0 2.37 MB

[WACV'23] The official code for "Relation Preserving Triplet Mining for Stabilising the Triplet Loss in Re-identification Systems"

Home Page: https://openaccess.thecvf.com/content/WACV2023/papers/Ghosh_Relation_Preserving_Triplet_Mining_for_Stabilising_the_Triplet_Loss_In_WACV_2023_paper.pdf

License: MIT License

Python 100.00%
computer-vision image-retrieval triplet-loss triplet-mining pytorch reidentification wacv2023

rptm_reid's Introduction

Relation Preserving Triplet Mining for Stabilising the Triplet Loss in Re-identification Sytems

WACV 2023

Adhiraj Ghosh1,2, Kuruparan Shanmugalingam1,3, Wen-Yan Lin1

1Singapore Management University 2University of Tübingen 3University of New South Wales

PWC PWC

PyTorch

[Paper] [Video]

The official repository for Relation Preserving Triplet Mining for Stabilising the Triplet Loss in Re-identification Sytems. Our work achieves state-of-the-art results and provides a faster optimised and more generalisable model for re-identification.

Network Architecture

Architecture

Preparation

Installation

  1. Install CUDA compatible torch. Modify based on CUDA version.
conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia
  1. Install other dependencies.
pip install -r requirements.txt
  1. Install apex (optional but recommended)

Follow the installation guidelines from https://github.com/NVIDIA/apex Then set SOLVER.USE_AMP as True in the config files directly or via command line.

Prepare Datasets

mkdir data

Download the vehicle reID datasets VehicleID and VeRi-776, and the person reID datasets DukeMTMC-reID. Follow the structure and naming convention as below.

data
├── duke
│   └── images ..
├── vehicleid
│   └── images ..
└── veri
    └── images ..

Prepare GMS Feature Matches

mkdir gms

You need to download the GMS feature matches for VeRi, VehicleID and DukeMTMC: GMS.

The folder should follow the structure as shown below:

gms
├── duke
│   └── 0001.pkl ..
├── vehicleid
│   └── 00001.pkl ..
└── veri
    └── 001.pkl ..

Running RPTM

  1. Training
python main.py --config_file configs/veri_r101.yml 

The above command trains a baseline using our RPTM algorithm for VeRi. Note that after training, the model provides evaluation results, both qualitative as well as quantitative.

  1. RPTM Thresholding Strategies

In Section 4.2 of our paper, we defined a thresholding strategy for better anchor-positive selections. We define this in config files as MODEL.RPTM_SELECT. While it is set to 'mean', feel free to work with 'min' and 'max'.

Min Thresholding

python main.py --config_file configs/veri_r101.yml MODEL.RPTM_SELECT 'min'

Max Thresholding

python main.py --config_file configs/veri_r101.yml MODEL.RPTM_SELECT 'max'
  1. Testing
mkdir logs
python main.py --config_file configs/veri_r101.yml TEST.WEIGHT '<path to trained model>' TEST.EVAL True 

Mean Average Precision(mAP) Results

  1. VeRi776: 88.0%
  2. VehicleID (query size 800): 84.8%
  3. VehicleID (query size 1600): 81.2%
  4. VehicleID (query size 2400): 80.5%
  5. DukeMTMC: 89.2%

Acknowledgement

GMS Feature Matching Algorithm taken from: https://github.com/JiawangBian/GMS-Feature-Matcher

Citation

If you find this code useful for your research, please cite our paper

@InProceedings{Ghosh_2023_WACV,
    author    = {Ghosh, Adhiraj and Shanmugalingam, Kuruparan and Lin, Wen-Yan},
    title     = {Relation Preserving Triplet Mining for Stabilising the Triplet Loss In re-Identification Systems},
    booktitle = {Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV)},
    month     = {January},
    year      = {2023},
    pages     = {4840-4849}
}

Contact

If you have any questions, please feel free to contact us. E-mail: Adhiraj Ghosh , Wen-Yan Lin

rptm_reid's People

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

Watchers

 avatar  avatar

Forkers

cv-ip ghw2016z

rptm_reid's Issues

AttributeError: TEST_SIZE

Hi, thanks for your great work. I trained the model on the Veri dataset and encountered an error when executing python main.py --config_file configs/veri_r101.yml in the terminal, as shown in the following figure.
感谢您的工作,我在veri数据集上训练模型的时候,在终端中执行python main.py --config_file configs/veri_r101.yml,程序报错,如下图所示。
1690102584361

I checked veri_ r101.yml file, found no TEST.TEST_SIZE parameter, which is needed in kwargs.py, line 27.
我查看了veri_r101.yml文件,发现没有**TEST.TEST_SIZE**这个参数。
image
1690103552907

How should I solve this problem? Looking forward to your reply!
我应该怎样解决这个问题呢?期待您的回复!

About the baseline model

Hi,

Thank you for the work. May I ask what model did you use for the baseline config file?
I asked because I did not find where the SENet module is used. Any clue would be appreciated!

custom dataset

Hello, is it possible to train a custom dataset? How to do it if possible?

About mAP and weigts

Hello, thank you for your contribution.
The accuracy of rank1 in our training results is consistent with that described in the paper, but the mAP is quite different from the one described in the paper.
Can you please open source your training weights?

Only vehicle re-id

Hi. I'm only interested in vehicle re-id, not human. Can I only have that dataset and train the model?

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.