IDM: An Intermediate Domain Module for Domain Adaptive Person Re-ID,

Related tags

Deep LearningIDM
Overview

Python >=3.7 PyTorch >=1.1

Intermediate Domain Module (IDM)

This repository is the official implementation for IDM: An Intermediate Domain Module for Domain Adaptive Person Re-ID, which is accepted by ICCV 2021 (Oral).

IDM achieves state-of-the-art performances on the unsupervised domain adaptation task for person re-ID.

Requirements

Installation

git clone https://github.com/SikaStar/IDM.git
cd IDM/idm/evaluation_metrics/rank_cylib && make all

Prepare Datasets

cd examples && mkdir data

Download the person re-ID datasets Market-1501, DukeMTMC-ReID, MSMT17, PersonX, and UnrealPerson. Then unzip them under the directory like

IDM/examples/data
├── dukemtmc
│   └── DukeMTMC-reID
├── market1501
│   └── Market-1501-v15.09.15
├── msmt17
│   └── MSMT17_V1
├── personx
│   └── PersonX
└── unreal
    ├── list_unreal_train.txt
    └── unreal_vX.Y

Prepare ImageNet Pre-trained Models for IBN-Net

When training with the backbone of IBN-ResNet, you need to download the ImageNet-pretrained model from this link and save it under the path of logs/pretrained/.

mkdir logs && cd logs
mkdir pretrained

The file tree should be

IDM/logs
└── pretrained
    └── resnet50_ibn_a.pth.tar

ImageNet-pretrained models for ResNet-50 will be automatically downloaded in the python script.

Training

We utilize 4 GTX-2080TI GPUs for training. Note that

  • The source and target domains are trained jointly.
  • For baseline methods, use -a resnet50 for the backbone of ResNet-50, and -a resnet_ibn50a for the backbone of IBN-ResNet.
  • For IDM, use -a resnet50_idm to insert IDM into the backbone of ResNet-50, and -a resnet_ibn50a_idm to insert IDM into the backbone of IBN-ResNet.
  • For strong baseline, use --use-xbm to implement XBM (a variant of Memory Bank).

Baseline Methods

To train the baseline methods in the paper, run commands like:

# Naive Baseline
CUDA_VISIBLE_DEVICES=0,1,2,3 sh scripts/run_naive_baseline.sh ${source} ${target} ${arch}

# Strong Baseline
CUDA_VISIBLE_DEVICES=0,1,2,3 sh scripts/run_strong_baseline.sh ${source} ${target} ${arch}

Some examples:

### market1501 -> dukemtmc ###

# ResNet-50
CUDA_VISIBLE_DEVICES=0,1,2,3 sh scripts/run_strong_baseline.sh market1501 dukemtmc resnet50 

# IBN-ResNet-50
CUDA_VISIBLE_DEVICES=0,1,2,3 sh scripts/run_strong_baseline.sh market1501 dukemtmc resnet_ibn50a

Training with IDM

To train the models with our IDM, run commands like:

# Naive Baseline + IDM
CUDA_VISIBLE_DEVICES=0,1,2,3 \
sh scripts/run_idm.sh ${source} ${target} ${arch} ${stage} ${mu1} ${mu2} ${mu3}

# Strong Baseline + IDM
CUDA_VISIBLE_DEVICES=0,1,2,3 \
sh scripts/run_idm_xbm.sh ${source} ${target} ${arch} ${stage} ${mu1} ${mu2} ${mu3}
  • Defaults: --stage 0 --mu1 0.7 --mu2 0.1 --mu3 1.0

Some examples:

### market1501 -> dukemtmc ###

# ResNet-50 + IDM
CUDA_VISIBLE_DEVICES=0,1,2,3 \
sh scripts/run_idm_xbm.sh market1501 dukemtmc resnet50_idm 0 0.7 0.1 1.0 

# IBN-ResNet-50 + IDM
CUDA_VISIBLE_DEVICES=0,1,2,3 \
sh scripts/run_idm_xbm.sh market1501 dukemtmc resnet_ibn50a_idm 0 0.7 0.1 1.0

Evaluation

We utilize 1 GTX-2080TI GPU for testing. Note that

  • use --dsbn for domain adaptive models, and add --test-source if you want to test on the source domain;
  • use -a resnet50 for the backbone of ResNet-50, and -a resnet_ibn50a for the backbone of IBN-ResNet.
  • use -a resnet50_idm for ResNet-50 + IDM, and -a resnet_ibn50a_idm for IBN-ResNet + IDM.

To evaluate the baseline model on the target-domain dataset, run:

CUDA_VISIBLE_DEVICES=0 \
python3 examples/test.py --dsbn -d ${dataset} -a ${arch} --resume ${resume} 

To evaluate the baseline model on the source-domain dataset, run:

CUDA_VISIBLE_DEVICES=0 \
python3 examples/test.py --dsbn --test-source -d ${dataset} -a ${arch} --resume ${resume} 

To evaluate the IDM model on the target-domain dataset, run:

CUDA_VISIBLE_DEVICES=0 \
python3 examples/test.py --dsbn-idm -d ${dataset} -a ${arch} --resume ${resume} --stage ${stage} 

To evaluate the IDM model on the source-domain dataset, run:

CUDA_VISIBLE_DEVICES=0 \
python3 examples/test.py --dsbn-idm --test-source -d ${dataset} -a ${arch} --resume ${resume} --stage ${stage} 

Some examples:

### market1501 -> dukemtmc ###

# evaluate the target domain "dukemtmc" on the strong baseline model
CUDA_VISIBLE_DEVICES=0 \
python3 examples/test.py --dsbn  -d dukemtmc -a resnet50 \
--resume logs/resnet50_strong_baseline/market1501-TO-dukemtmc/model_best.pth.tar 

# evaluate the source domain "market1501" on the strong baseline model
CUDA_VISIBLE_DEVICES=0 \
python3 examples/test.py --dsbn --test-source  -d market1501 -a resnet50 \
--resume logs/resnet50_strong_baseline/market1501-TO-dukemtmc/model_best.pth.tar 

# evaluate the target domain "dukemtmc" on the IDM model (after stage-0)
python3 examples/test.py --dsbn-idm  -d dukemtmc -a resnet50_idm \
--resume logs/resnet50_idm_xbm/market1501-TO-dukemtmc/model_best.pth.tar --stage 0

# evaluate the target domain "dukemtmc" on the IDM model (after stage-0)
python3 examples/test.py --dsbn-idm --test-source  -d market1501 -a resnet50_idm \
--resume logs/resnet50_idm_xbm/market1501-TO-dukemtmc/model_best.pth.tar --stage 0

Acknowledgement

Our code is based on MMT and SpCL. Thanks for Yixiao's wonderful works.

Citation

If you find our work is useful for your research, please kindly cite our paper

@inproceedings{dai2021idm,
  title={IDM: An Intermediate Domain Module for Domain Adaptive Person Re-ID},
  author={Dai, Yongxing and Liu, Jun and Sun, Yifan and Tong, Zekun and Zhang, Chi and Duan, Ling-Yu},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
  year={2021}
}

If you have any questions, please leave an issue or contact me: [email protected]

Owner
Yongxing Dai
I am now a fourth-year PhD student at National Engineering Lab for Video Technology in Peking University, Beijing, China
Yongxing Dai
PyTorch implementation for Stochastic Fine-grained Labeling of Multi-state Sign Glosses for Continuous Sign Language Recognition.

Stochastic CSLR This is the PyTorch implementation for the ECCV 2020 paper: Stochastic Fine-grained Labeling of Multi-state Sign Glosses for Continuou

Zhe Niu 28 Dec 19, 2022
EDCNN: Edge enhancement-based Densely Connected Network with Compound Loss for Low-Dose CT Denoising

EDCNN: Edge enhancement-based Densely Connected Network with Compound Loss for Low-Dose CT Denoising By Tengfei Liang, Yi Jin, Yidong Li, Tao Wang. Th

workingcoder 115 Jan 05, 2023
EMNLP 2021 paper The Devil is in the Detail: Simple Tricks Improve Systematic Generalization of Transformers.

Codebase for training transformers on systematic generalization datasets. The official repository for our EMNLP 2021 paper The Devil is in the Detail:

Csordás Róbert 57 Nov 21, 2022
🇰🇷 Text to Image in Korean

KoDALLE Utilizing pretrained language model’s token embedding layer and position embedding layer as DALLE’s text encoder. Background Training DALLE mo

HappyFace 74 Sep 22, 2022
MEAL V2: Boosting Vanilla ResNet-50 to 80%+ Top-1 Accuracy on ImageNet without Tricks

MEAL-V2 This is the official pytorch implementation of our paper: "MEAL V2: Boosting Vanilla ResNet-50 to 80%+ Top-1 Accuracy on ImageNet without Tric

Zhiqiang Shen 653 Dec 19, 2022
Omniverse sample scripts - A guide for developing with Python scripts on NVIDIA Ominverse

Omniverse sample scripts ここでは、NVIDIA Omniverse ( https://www.nvidia.com/ja-jp/om

ft-lab (Yutaka Yoshisaka) 37 Nov 17, 2022
Code for "Training Neural Networks with Fixed Sparse Masks" (NeurIPS 2021).

Code for "Training Neural Networks with Fixed Sparse Masks" (NeurIPS 2021).

Varun Nair 37 Dec 30, 2022
Official PyTorch implementation of "Contrastive Learning from Extremely Augmented Skeleton Sequences for Self-supervised Action Recognition" in AAAI2022.

AimCLR This is an official PyTorch implementation of "Contrastive Learning from Extremely Augmented Skeleton Sequences for Self-supervised Action Reco

Gty 44 Dec 17, 2022
PixelPick This is an official implementation of the paper "All you need are a few pixels: semantic segmentation with PixelPick."

PixelPick This is an official implementation of the paper "All you need are a few pixels: semantic segmentation with PixelPick." [Project page] [Paper

Gyungin Shin 59 Sep 25, 2022
This framework implements the data poisoning method found in the paper Adversarial Examples Make Strong Poisons

Adversarial poison generation and evaluation. This framework implements the data poisoning method found in the paper Adversarial Examples Make Strong

31 Nov 01, 2022
CvT2DistilGPT2 is an encoder-to-decoder model that was developed for chest X-ray report generation.

CvT2DistilGPT2 Improving Chest X-Ray Report Generation by Leveraging Warm-Starting This repository houses the implementation of CvT2DistilGPT2 from [1

The Australian e-Health Research Centre 21 Dec 28, 2022
code for paper "Does Unsupervised Architecture Representation Learning Help Neural Architecture Search?"

Does Unsupervised Architecture Representation Learning Help Neural Architecture Search? Code for paper: Does Unsupervised Architecture Representation

39 Dec 17, 2022
Fully Automatic Page Turning on Real Scores

Fully Automatic Page Turning on Real Scores This repository contains the corresponding code for our extended abstract Henkel F., Schwaiger S. and Widm

Florian Henkel 7 Jan 02, 2022
Preprocessed Datasets for our Multimodal NER paper

Unified Multimodal Transformer (UMT) for Multimodal Named Entity Recognition (MNER) Two MNER Datasets and Codes for our ACL'2020 paper: Improving Mult

76 Dec 21, 2022
Spontaneous Facial Micro Expression Recognition using 3D Spatio-Temporal Convolutional Neural Networks

Spontaneous Facial Micro Expression Recognition using 3D Spatio-Temporal Convolutional Neural Networks Abstract Facial expression recognition in video

Bogireddy Sai Prasanna Teja Reddy 103 Dec 29, 2022
RefineGNN - Iterative refinement graph neural network for antibody sequence-structure co-design (RefineGNN)

Iterative refinement graph neural network for antibody sequence-structure co-des

Wengong Jin 83 Dec 31, 2022
Detectorch - detectron for PyTorch

Detectorch - detectron for PyTorch (Disclaimer: this is work in progress and does not feature all the functionalities of detectron. Currently only inf

Ignacio Rocco 558 Dec 23, 2022
PyTorch(Geometric) implementation of G^2GNN in "Imbalanced Graph Classification via Graph-of-Graph Neural Networks"

This repository is an official PyTorch(Geometric) implementation of G^2GNN in "Imbalanced Graph Classification via Graph-of-Graph Neural Networks". Th

Yu Wang (Jack) 13 Nov 18, 2022
Experiments on continual learning from a stream of pretrained models.

Ex-model CL Ex-model continual learning is a setting where a stream of experts (i.e. model's parameters) is available and a CL model learns from them

Antonio Carta 6 Dec 04, 2022
ALIbaba's Collection of Encoder-decoders from MinD (Machine IntelligeNce of Damo) Lab

AliceMind AliceMind: ALIbaba's Collection of Encoder-decoders from MinD (Machine IntelligeNce of Damo) Lab This repository provides pre-trained encode

Alibaba 1.4k Jan 01, 2023