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.
--iters
from 800
to 400
in the training scripts, achieving similar performance with less time cost.--dropout
from 0
to 0.5
will achieve supervising improvements in MMT. Intuitively, the dual models are more de-coupled with independent dropout functions.--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.git clone https://github.com/yxgeee/MMT.git
cd MMT
python setup.py install
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
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
Transferring from DukeMTMC-reID to Market-1501 on the backbone of ResNet-50, i.e. Duke-to-Market (ResNet-50).
We utilize 4 GTX-1080TI GPUs for training.
An explanation about the number of GPUs and the size of mini-batches:
sh scripts/pretrain.sh dukemtmc market1501 resnet50 1
sh scripts/pretrain.sh dukemtmc market1501 resnet50 2
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
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
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
Note that the baseline mentioned in our paper is slightly different from the general clustering-based baseline:
--soft-ce-weight 0 --soft-tri-weight 0 --alpha 0
in the training scripts.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
Source-domain pre-trained models and all our MMT models in the paper can be downloaded from the link.
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}
}