- 🔔This is the official (Pytorch) implementation for the paper "Parameter Exchange for Robust Dynamic Domain Generalization", ACM MM 2023.
- 🛖This repository is built on the Dassl which is designed for the research of Domain adaptation, Domain generalization, and Domain generalization. You can also view the Dassl project for details: https://github.com/KaiyangZhou/Dassl.pytorch
The main python libraries we use:
- Python 3.8
- torch 1.8.1
- numpy 1.19.2
Please create a directory named datasets
in current directory, then install these following datasets into datasets
:
- For PACS, VLCS, Office-Home, and DomainNet datasets, please view this site.
- For the Terria Incognita dataset, please view this site to manually download and install it.
You can also change the root directory of datasets by modifying the default value of the argument --root
in tools/train.py[L96]:
def train():
parser = argparse.ArgumentParser()
parser.add_argument('--root', type=str, default='./datasets', help='path to datasets')
Please create a directory named checkpoints
in current directory, then download following pretrained weights into checkpoints
:
- DDG: GoogleDrive, OneDrive, or Quark
- DRT: GoogleDrive, OneDrive, or Quark
- ODConv: GoogleDrive, OneDrive, or Quark
After finishing above steps, your directory structure of code may like this:
DDG_PE/
|–– checkpoints/
odconv4x_resnet50.pth.tar
resnet50_draac_v3_pretrained.pth
resnet50_draac_v4_pretrained.pth
|–– configs/
|–– dataset/
|–– domainnet/
|–– clipart/
|–– infograph/
|–– painting/
|–– quickdraw/
|–– real/
|–– sketch/
|–– splits/
|–– office_home_dg/
|–– art/
|–– clipart/
|–– product/
|–– real_world/
|–– terra_incognita/
|–– location_38/
|–– location_43/
|–– location_46/
|–– location_100/
|–– VLCS/
|–– CALTECH/
|–– LABELME/
|–– PASCAL/
|–– SUN/
|–– paccs/
|–– images/
|–– splits/
|–– dassl/
|–– tools/
main.py
parse_test_res.py
README.md
share.py
train.sh
To run the experiment of DDG w/ CI-PE
, just enter the following cmd on root directory:
bash train.sh DDG CI PACS
Usage of train.sh
:
bash train.sh {arg1=dymodel} {arg2=pe_type} {arg3=dataset}
dymodel
is the backbone of the dynamic network, available ones are:DRT
,DDG
,ODCONV
pe_type
determines which PE method to use, available ones are:CI
,CK
dataset
specifies which dataset to train and test on, available ones are:PACS
,OfficeHome
,PACS
,VLCS
,TerriaIncognita
,DomainNet
If you would like to cite our works, the following bibtex code may be helpful:
@inproceedings{lin2023pe,
title={Parameter Exchange for Robust Dynamic Domain Generalization},
author={Lin, Luojun and Shen, Zhifeng and Sun, Zhishu and Yu, Yuanlong and Zhang, Lei and Chen, Weijie},
booktitle={Proceedings of the 31st ACM International Conference on Multimedia},
year={2023},
}
@inproceedings{sun2022ddg,
title={Dynamic Domain Generalization},
author={Sun, Zhishu and Shen, Zhifeng and Lin, Luojun and Yu, Yuanlong and Yang, Zhifeng and Yang, Shicai and Chen, Weijie},
booktitle={IJCAI},
year={2022}
}
- Our code is built on Dassl.pytorch - https://github.com/KaiyangZhou/Dassl.pytorch
- The Terria Incognita dataset is installed from DomainBed - https://github.com/facebookresearch/DomainBed
This source code is released under the MIT license. View it here