All Projects → yxgeee → Mmt

yxgeee / Mmt

Licence: mit
[ICLR-2020] Mutual Mean-Teaching: Pseudo Label Refinery for Unsupervised Domain Adaptation on Person Re-identification.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Mmt

KD3A
Here is the official implementation of the model KD3A in paper "KD3A: Unsupervised Multi-Source Decentralized Domain Adaptation via Knowledge Distillation".
Stars: ✭ 63 (-81.74%)
Mutual labels:  unsupervised-learning, domain-adaptation
Image similarity
PyTorch Blog Post On Image Similarity Search
Stars: ✭ 80 (-76.81%)
Mutual labels:  unsupervised-learning, image-retrieval
Transferlearning
Transfer learning / domain adaptation / domain generalization / multi-task learning etc. Papers, codes, datasets, applications, tutorials.-迁移学习
Stars: ✭ 8,481 (+2358.26%)
Mutual labels:  domain-adaptation, unsupervised-learning
Openunreid
PyTorch open-source toolbox for unsupervised or domain adaptive object re-ID.
Stars: ✭ 250 (-27.54%)
Mutual labels:  unsupervised-learning, image-retrieval
Deep-Unsupervised-Domain-Adaptation
Pytorch implementation of four neural network based domain adaptation techniques: DeepCORAL, DDC, CDAN and CDAN+E. Evaluated on benchmark dataset Office31.
Stars: ✭ 50 (-85.51%)
Mutual labels:  unsupervised-learning, domain-adaptation
TA3N
[ICCV 2019 Oral] TA3N: https://github.com/cmhungsteve/TA3N (Most updated repo)
Stars: ✭ 45 (-86.96%)
Mutual labels:  unsupervised-learning, domain-adaptation
Awesome Transfer Learning
Best transfer learning and domain adaptation resources (papers, tutorials, datasets, etc.)
Stars: ✭ 1,349 (+291.01%)
Mutual labels:  unsupervised-learning, domain-adaptation
BIFI
[ICML 2021] Break-It-Fix-It: Unsupervised Learning for Program Repair
Stars: ✭ 74 (-78.55%)
Mutual labels:  unsupervised-learning, domain-adaptation
Similarity-Adaptive-Deep-Hashing
Unsupervised Deep Hashing with Similarity-Adaptive and Discrete Optimization (TPAMI2018)
Stars: ✭ 18 (-94.78%)
Mutual labels:  unsupervised-learning, image-retrieval
100 Days Of Ml Code
100-Days-Of-ML-Code中文版
Stars: ✭ 16,797 (+4768.7%)
Mutual labels:  unsupervised-learning
Selflow
SelFlow: Self-Supervised Learning of Optical Flow
Stars: ✭ 319 (-7.54%)
Mutual labels:  unsupervised-learning
Trace.moe Telegram Bot
This Telegram Bot can tell the anime when you send an screenshot to it
Stars: ✭ 284 (-17.68%)
Mutual labels:  image-retrieval
Simclr
PyTorch implementation of SimCLR: A Simple Framework for Contrastive Learning of Visual Representations by T. Chen et al.
Stars: ✭ 293 (-15.07%)
Mutual labels:  unsupervised-learning
Cross Domain Detection
Cross-Domain Weakly-Supervised Object Detection through Progressive Domain Adaptation [Inoue+, CVPR2018].
Stars: ✭ 320 (-7.25%)
Mutual labels:  domain-adaptation
Deepvideoanalytics
A distributed visual search and visual data analytics platform.
Stars: ✭ 2,973 (+761.74%)
Mutual labels:  image-retrieval
Pytorch Adda
A PyTorch implementation for Adversarial Discriminative Domain Adaptation
Stars: ✭ 329 (-4.64%)
Mutual labels:  domain-adaptation
He4o
和(he for objective-c) —— “信息熵减机系统”
Stars: ✭ 284 (-17.68%)
Mutual labels:  unsupervised-learning
Pytorch Vsumm Reinforce
AAAI 2018 - Unsupervised video summarization with deep reinforcement learning (PyTorch)
Stars: ✭ 283 (-17.97%)
Mutual labels:  unsupervised-learning
Mlxtend
A library of extension and helper modules for Python's data analysis and machine learning libraries.
Stars: ✭ 3,729 (+980.87%)
Mutual labels:  unsupervised-learning
Artificio
Deep Learning Computer Vision Algorithms for Real-World Use
Stars: ✭ 326 (-5.51%)
Mutual labels:  image-retrieval

Python 3.6 PyTorch 1.1

Mutual Mean-Teaching (MMT)

The official implementation for the Mutual Mean-Teaching: Pseudo Label Refinery for Unsupervised Domain Adaptation on Person Re-identification which is accepted by ICLR-2020.

framework

What's New

[Jul 1st, 2020]

  • We did the code refactoring to support distributed training and more features. Please see OpenUnReID.

[Mar 27th, 2020]

  • We wrote a Chinese blog about this paper at [Zhihu].

[Mar 20th, 2020]

  • We supported DBSCAN-based MMT which could achieve better performance. Note that we effectively accelerated the Jaccard distance computing process for DBSCAN (around 200s for CPU and 60s for GPU, compared to around 10min in other repos).
  • We added the general clustering-based baseline training for UDA re-ID, i.e. single model training with only hard pseudo labels.
  • We slightly modified the setting of training iterations --iters from 800 to 400 in the training scripts, achieving similar performance with less time cost.
  • We discovered a minor hint, changing the setting of --dropout from 0 to 0.5 will achieve supervising improvements in MMT. Intuitively, the dual models are more de-coupled with independent dropout functions.
  • A reminder here, changing the hyper-parameter --soft-tri-weight 0.8 to --soft-tri-weight 1.0 may achieve better performance in some cases. Please refer to ablation study results in Table 2 in our paper.

Installation

git clone https://github.com/yxgeee/MMT.git
cd MMT
python setup.py install

Prepare Datasets

cd examples && mkdir data

Download the raw datasets DukeMTMC-reID, Market-1501, MSMT17, and then unzip them under the directory like

MMT/examples/data
├── dukemtmc
│   └── DukeMTMC-reID
├── market1501
│   └── Market-1501-v15.09.15
└── msmt17
    └── MSMT17_V1

Prepare Pre-trained Models

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

mkdir logs && cd logs
mkdir pretrained

The file tree should be

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

Example #1:

Transferring from DukeMTMC-reID to Market-1501 on the backbone of ResNet-50, i.e. Duke-to-Market (ResNet-50).

Train

We utilize 4 GTX-1080TI GPUs for training.

An explanation about the number of GPUs and the size of mini-batches:

  • We adopted 4 GPUs with a batch size of 64, since we found 16 images out of 4 identities in a mini-batch benefits the learning of BN layers, achieving optimal performance. This setting may affect IBN-ResNet-50 in a larger extent.
  • It is fine to try other hyper-parameters, i.e. GPUs and batch sizes. I recommend to remain a mini-batch of 16 images for the BN layers, e.g. use a batch size of 32 for 2 GPUs training, etc.

Stage I: Pre-training on the source domain

sh scripts/pretrain.sh dukemtmc market1501 resnet50 1
sh scripts/pretrain.sh dukemtmc market1501 resnet50 2

Stage II: End-to-end training with MMT-500

We utilized K-Means clustering algorithm in the paper.

sh scripts/train_mmt_kmeans.sh dukemtmc market1501 resnet50 500

We supported DBSCAN clustering algorithm currently. Note that you could add --rr-gpu in the training scripts for faster clustering but requiring more GPU memory.

sh scripts/train_mmt_dbscan.sh dukemtmc market1501 resnet50

Test

We utilize 1 GTX-1080TI GPU for testing. Test the trained model with best performance by

sh scripts/test.sh market1501 resnet50 logs/dukemtmcTOmarket1501/resnet50-MMT-500/model_best.pth.tar

Other Examples:

Duke-to-Market (IBN-ResNet-50)

# pre-training on the source domain
sh scripts/pretrain.sh dukemtmc market1501 resnet_ibn50a 1
sh scripts/pretrain.sh dukemtmc market1501 resnet_ibn50a 2
# end-to-end training with MMT-500
sh scripts/train_mmt_kmeans.sh dukemtmc market1501 resnet_ibn50a 500
# or MMT-700
sh scripts/train_mmt_kmeans.sh dukemtmc market1501 resnet_ibn50a 700
# or MMT-DBSCAN
sh scripts/train_mmt_dbscan.sh dukemtmc market1501 resnet_ibn50a 
# testing the best model
sh scripts/test.sh market1501 resnet_ibn50a logs/dukemtmcTOmarket1501/resnet_ibn50a-MMT-500/model_best.pth.tar
sh scripts/test.sh market1501 resnet_ibn50a logs/dukemtmcTOmarket1501/resnet_ibn50a-MMT-700/model_best.pth.tar
sh scripts/test.sh market1501 resnet_ibn50a logs/dukemtmcTOmarket1501/resnet_ibn50a-MMT-DBSCAN/model_best.pth.tar

Duke-to-MSMT (ResNet-50)

# pre-training on the source domain
sh scripts/pretrain.sh dukemtmc msmt17 resnet50 1
sh scripts/pretrain.sh dukemtmc msmt17 resnet50 2
# end-to-end training with MMT-500
sh scripts/train_mmt_kmeans.sh dukemtmc msmt17 resnet50 500
# or MMT-1000
sh scripts/train_mmt_kmeans.sh dukemtmc msmt17 resnet50 1000
# or MMT-DBSCAN
sh scripts/train_mmt_dbscan.sh dukemtmc market1501 resnet50 
# testing the best model
sh scripts/test.sh msmt17 resnet50 logs/dukemtmcTOmsmt17/resnet50-MMT-500/model_best.pth.tar
sh scripts/test.sh msmt17 resnet50 logs/dukemtmcTOmsmt17/resnet50-MMT-1000/model_best.pth.tar
sh scripts/test.sh msmt17 resnet50 logs/dukemtmcTOmsmt17/resnet50-MMT-DBSCAN/model_best.pth.tar

General Clustering-based Baseline Training

Note that the baseline mentioned in our paper is slightly different from the general clustering-based baseline:

  • For fair comparison in the ablation study, the baseline in our paper utilized the same dual-model framework as our MMT but using only hard pseudo labels (no soft labels and no mean-teachers), i.e. setting --soft-ce-weight 0 --soft-tri-weight 0 --alpha 0 in the training scripts.
  • The general clustering-based baseline is illustrated as above, which contains only one model. The model is training with a cross-entropy loss and a triplet loss, supervised by hard pseudo labels.
  • Although the baseline in our paper adopted dual models that are independently trained with hard losses, the features extracted for clustering are averaged from dual models. It is the only difference from the general clustering-based baseline.

Here, we supported training with the general clustering-based baseline for further academic usage. For example, Duke-to-Market with ResNet-50

# for K-Means
sh scripts/train_baseline_kmeans.sh dukemtmc market1501 resnet50 500
sh scripts/train_baseline_kmeans.sh dukemtmc market1501 resnet50 700
sh scripts/train_baseline_kmeans.sh dukemtmc market1501 resnet50 900
# for DBSCAN
sh scripts/train_baseline_dbscan.sh dukemtmc market1501 resnet50 

Download Trained Models

Source-domain pre-trained models and all our MMT models in the paper can be downloaded from the link. results

Citation

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

@inproceedings{
  ge2020mutual,
  title={Mutual Mean-Teaching: Pseudo Label Refinery for Unsupervised Domain Adaptation on Person Re-identification},
  author={Yixiao Ge and Dapeng Chen and Hongsheng Li},
  booktitle={International Conference on Learning Representations},
  year={2020},
  url={https://openreview.net/forum?id=rJlnOhVYPS}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].