Skip to content

Commit 1caa15c

Browse files
committed
initial commit
0 parents  commit 1caa15c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3490
-0
lines changed

.gitignore

+230
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
*~
2+
logs/*
3+
4+
# temporary files which can be created if a process still has a handle open of a deleted file
5+
.fuse_hidden*
6+
7+
# KDE directory preferences
8+
.directory
9+
10+
# Linux trash folder which might appear on any partition or disk
11+
.Trash-*
12+
13+
# .nfs files are created when an open file is removed but is still being accessed
14+
.nfs*
15+
16+
17+
*.DS_Store
18+
.AppleDouble
19+
.LSOverride
20+
21+
# Icon must end with two \r
22+
Icon
23+
24+
25+
# Thumbnails
26+
._*
27+
28+
# Files that might appear in the root of a volume
29+
.DocumentRevisions-V100
30+
.fseventsd
31+
.Spotlight-V100
32+
.TemporaryItems
33+
.Trashes
34+
.VolumeIcon.icns
35+
.com.apple.timemachine.donotpresent
36+
37+
# Directories potentially created on remote AFP share
38+
.AppleDB
39+
.AppleDesktop
40+
Network Trash Folder
41+
Temporary Items
42+
.apdisk
43+
44+
45+
# swap
46+
[._]*.s[a-v][a-z]
47+
[._]*.sw[a-p]
48+
[._]s[a-v][a-z]
49+
[._]sw[a-p]
50+
# session
51+
Session.vim
52+
# temporary
53+
.netrwhist
54+
*~
55+
# auto-generated tag files
56+
tags
57+
58+
59+
# cache files for sublime text
60+
*.tmlanguage.cache
61+
*.tmPreferences.cache
62+
*.stTheme.cache
63+
64+
# workspace files are user-specific
65+
*.sublime-workspace
66+
67+
# project files should be checked into the repository, unless a significant
68+
# proportion of contributors will probably not be using SublimeText
69+
# *.sublime-project
70+
71+
# sftp configuration file
72+
sftp-config.json
73+
74+
# Package control specific files
75+
Package Control.last-run
76+
Package Control.ca-list
77+
Package Control.ca-bundle
78+
Package Control.system-ca-bundle
79+
Package Control.cache/
80+
Package Control.ca-certs/
81+
Package Control.merged-ca-bundle
82+
Package Control.user-ca-bundle
83+
oscrypto-ca-bundle.crt
84+
bh_unicode_properties.cache
85+
86+
# Sublime-github package stores a github token in this file
87+
# https://packagecontrol.io/packages/sublime-github
88+
GitHub.sublime-settings
89+
90+
91+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
92+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
93+
94+
# User-specific stuff:
95+
.idea
96+
.idea/**/workspace.xml
97+
.idea/**/tasks.xml
98+
99+
# Sensitive or high-churn files:
100+
.idea/**/dataSources/
101+
.idea/**/dataSources.ids
102+
.idea/**/dataSources.xml
103+
.idea/**/dataSources.local.xml
104+
.idea/**/sqlDataSources.xml
105+
.idea/**/dynamic.xml
106+
.idea/**/uiDesigner.xml
107+
108+
# Gradle:
109+
.idea/**/gradle.xml
110+
.idea/**/libraries
111+
112+
# Mongo Explorer plugin:
113+
.idea/**/mongoSettings.xml
114+
115+
## File-based project format:
116+
*.iws
117+
118+
## Plugin-specific files:
119+
120+
# IntelliJ
121+
/out/
122+
123+
# mpeltonen/sbt-idea plugin
124+
.idea_modules/
125+
126+
# JIRA plugin
127+
atlassian-ide-plugin.xml
128+
129+
# Crashlytics plugin (for Android Studio and IntelliJ)
130+
com_crashlytics_export_strings.xml
131+
crashlytics.properties
132+
crashlytics-build.properties
133+
fabric.properties
134+
135+
136+
# Byte-compiled / optimized / DLL files
137+
__pycache__/
138+
*.py[cod]
139+
*$py.class
140+
141+
# C extensions
142+
*.so
143+
144+
# Distribution / packaging
145+
.Python
146+
env/
147+
build/
148+
develop-eggs/
149+
dist/
150+
downloads/
151+
eggs/
152+
.eggs/
153+
lib/
154+
lib64/
155+
parts/
156+
sdist/
157+
var/
158+
*.egg-info/
159+
.installed.cfg
160+
*.egg
161+
162+
# PyInstaller
163+
# Usually these files are written by a python script from a template
164+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
165+
*.manifest
166+
*.spec
167+
168+
# Installer logs
169+
pip-log.txt
170+
pip-delete-this-directory.txt
171+
172+
# Unit test / coverage reports
173+
htmlcov/
174+
.tox/
175+
.coverage
176+
.coverage.*
177+
.cache
178+
nosetests.xml
179+
coverage.xml
180+
*,cover
181+
.hypothesis/
182+
183+
# Translations
184+
*.mo
185+
*.pot
186+
187+
# Django stuff:
188+
*.log
189+
local_settings.py
190+
191+
# Flask stuff:
192+
instance/
193+
.webassets-cache
194+
195+
# Scrapy stuff:
196+
.scrapy
197+
198+
# Sphinx documentation
199+
docs/_build/
200+
201+
# PyBuilder
202+
target/
203+
204+
# IPython Notebook
205+
.ipynb_checkpoints
206+
207+
# pyenv
208+
.python-version
209+
210+
# celery beat schedule file
211+
celerybeat-schedule
212+
213+
# dotenv
214+
.env
215+
216+
# virtualenv
217+
venv/
218+
ENV/
219+
220+
# Spyder project settings
221+
.spyderproject
222+
223+
# Rope project settings
224+
.ropeproject
225+
226+
227+
# Project specific
228+
examples/data
229+
examples/logs
230+

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Yixiao Ge
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)
2+
![PyTorch 1.1](https://img.shields.io/badge/pytorch-1.1-yellow.svg)
3+
4+
# Mutual Mean-Teaching (MMT)
5+
6+
The *official* implementation for the [Mutual Mean-Teaching: Pseudo Label Refinery for Unsupervised Domain Adaptation on Person Re-identification](https://openreview.net/forum?id=rJlnOhVYPS) which is accepted by [ICLR-2020](https://iclr.cc).
7+
8+
![framework](figs/framework.png)
9+
10+
## Installation
11+
12+
```shell
13+
git clone https://github.com/yxgeee/MMT.git
14+
cd MMT
15+
python setup.py install
16+
```
17+
18+
## Prepare Datasets
19+
20+
```shell
21+
cd example && mkdir data
22+
```
23+
Download the raw datasets [DukeMTMC-reID](https://arxiv.org/abs/1609.01775), [Market-1501](https://www.cv-foundation.org/openaccess/content_iccv_2015/papers/Zheng_Scalable_Person_Re-Identification_ICCV_2015_paper.pdf), [MSMT17](https://arxiv.org/abs/1711.08565),
24+
and then unzip them under the directory like
25+
```
26+
MMT/example/data
27+
├── dukemtmc
28+
│   └── DukeMTMC-reID
29+
├── market1501
30+
│   └── Market-1501-v15.09.15
31+
└── msmt17
32+
└── MSMT17_V1
33+
```
34+
35+
## Prepare Pre-trained Models
36+
When *training with the backbone of [IBN-ResNet-50](https://arxiv.org/abs/1807.09441)*, you need to download the [ImageNet](http://www.image-net.org/) pre-trained model from this [link](https://drive.google.com/drive/folders/1thS2B8UOSBi_cJX6zRy6YYRwz_nVFI_S) and save it under the path of `logs/pretrained/`.
37+
```shell
38+
mkdir logs && cd logs
39+
mkdir pretrained
40+
```
41+
The file tree should be
42+
```
43+
MMT/logs
44+
└── pretrained
45+
   └── resnet50_ibn_a.pth.tar
46+
```
47+
48+
## Example #1:
49+
Transferring from [DukeMTMC-reID](https://arxiv.org/abs/1609.01775) to [Market-1501](https://www.cv-foundation.org/openaccess/content_iccv_2015/papers/Zheng_Scalable_Person_Re-Identification_ICCV_2015_paper.pdf) on the backbone of [ResNet-50](https://arxiv.org/abs/1512.03385), *i.e. Duke-to-Market (ResNet-50)*.
50+
51+
### Train
52+
We utilize 4 GTX-1080TI GPUs for training.
53+
54+
#### Stage I: Pre-training on the source domain
55+
56+
```shell
57+
sh scripts/pretrain.sh dukemtmc market1501 resnet50 1
58+
sh scripts/pretrain.sh dukemtmc market1501 resnet50 2
59+
```
60+
61+
#### Stage II: End-to-end training with MMT-500
62+
63+
```shell
64+
sh scripts/train.sh dukemtmc market1501 resnet50 500
65+
```
66+
67+
### Test
68+
We utilize 1 GTX-1080TI GPU for testing.
69+
Test the trained model with best performance by
70+
```shell
71+
sh scripts/test.sh market1501 resnet50 logs/dukemtmcTOmarket1501/resnet50-MMT-500/model_best.pth.tar
72+
```
73+
74+
## Other Examples:
75+
**Duke-to-Market (IBN-ResNet-50)**
76+
```shell
77+
# pre-training on the source domain
78+
sh scripts/pretrain.sh dukemtmc market1501 resnet_ibn50a 1
79+
sh scripts/pretrain.sh dukemtmc market1501 resnet_ibn50a 2
80+
# end-to-end training with MMT-500
81+
sh scripts/train.sh dukemtmc market1501 resnet_ibn50a 500
82+
# or MMT-700
83+
sh scripts/train.sh dukemtmc market1501 resnet_ibn50a 700
84+
# testing the best model
85+
sh scripts/test.sh market1501 resnet_ibn50a logs/dukemtmcTOmarket1501/resnet_ibn50a-MMT-500/model_best.pth.tar
86+
sh scripts/test.sh market1501 resnet_ibn50a logs/dukemtmcTOmarket1501/resnet_ibn50a-MMT-700/model_best.pth.tar
87+
```
88+
**Duke-to-MSMT (ResNet-50)**
89+
```shell
90+
# pre-training on the source domain
91+
sh scripts/pretrain.sh dukemtmc msmt17 resnet50 1
92+
sh scripts/pretrain.sh dukemtmc msmt17 resnet50 2
93+
# end-to-end training with MMT-500
94+
sh scripts/train.sh dukemtmc msmt17 resnet50 500
95+
# or MMT-1000
96+
sh scripts/train.sh dukemtmc msmt17 resnet50 1000
97+
# testing the best model
98+
sh scripts/test.sh msmt17 resnet50 logs/dukemtmcTOmsmt17/resnet50-MMT-500/model_best.pth.tar
99+
sh scripts/test.sh msmt17 resnet50 logs/dukemtmcTOmsmt17/resnet50-MMT-1000/model_best.pth.tar
100+
```
101+
102+
103+
## Download Trained Models
104+
*Source-domain pre-trained models and our MMT models can be downloaded from the [link](https://drive.google.com/open?id=1WC4JgbkaAr40uEew_JEqjUxgKIiIQx-W).*
105+
![results](figs/results.png)
106+
107+
108+
## Citation
109+
If you find this code useful for your research, please cite our paper
110+
```
111+
@inproceedings{
112+
ge2020mutual,
113+
title={Mutual Mean-Teaching: Pseudo Label Refinery for Unsupervised Domain Adaptation on Person Re-identification},
114+
author={Yixiao Ge and Dapeng Chen and Hongsheng Li},
115+
booktitle={International Conference on Learning Representations},
116+
year={2020},
117+
url={https://openreview.net/forum?id=rJlnOhVYPS}
118+
}
119+
```

0 commit comments

Comments
 (0)