Code release for "Dynamic Domain Adaptation for Efficient Inference" (CVPR2021)
Our work proposes a Dynamic Domain Adaptation (DDA) framework to solve the problem of efficient inference in the context of domain adaptation.
The code runs with Python3 and requires Pytorch of version 1.3.1 or higher. Please pip install
the following packages:
numpy
torch
heaq
math
random
datetime
Pre-trained models for backbone MSDNet can be downloaded here and change the --pretrain_path
argument.
VisDA 2017 dataset can be found here in the classification track.
Run the following command in shell:
visda-2017 anytime
python train_dda.py --gpu_id id --dset visda --s_dset_path ../data/visda-2017/train_list.txt --t_dset_path ../data/visda-2017/validation_list.txt --test_dset_path ../data/visda-2017/validation_list.txt --pattern anytime
visda-2017 budgeted batch
python train_dda.py --gpu_id id --dset visda --s_dset_path ../data/visda-2017/train_list.txt --t_dset_path ../data/visda-2017/validation_list.txt --test_dset_path ../data/visda-2017/validation_list.txt --pattern budget
-
Change
--base 4 --step 4
to--base 7 --step 7
to run DDA(step-7), and change the pretrained model path. -
See
train_dda.py
for details.
DomainNet dataset can be found here
Run the following command in shell:
DomainNet anytime
python train_dda.py --gpu_id id --dset domainnet --s_dset_path ../data/domainnet/clipart_train.txt --t_dset_path ../data/domainnet/infograph_train.txt --test_dset_path ../data/domainnet/infograph_test.txt --pattern anytime
DomainNet budgeted batch
python train_dda.py --gpu_id id --dset domainnet --s_dset_path ../data/domainnet/clipart_train.txt --t_dset_path ../data/domainnet/infograph_train.txt --test_dset_path ../data/domainnet/infograph_test.txt --pattern budget
Same options are available as in visda-2017.
Some codes in this project are adapted from CDAN and MSDNet. We thank them for their excellent projects.
If you find this code useful for your research, please cite our paper:
@inproceedings{li2019dynamic,
author = {Shuang Li and Jinming Zhang and Wenxuan Ma and Chi Harold Liu and Wei Li},
title = {Dynamic Domain Adaptation for Efficient Inference},
year = {2021},
booktitle = {IEEE Conference on Computer Vision and Pattern Recognition},
numpages = {9}
}
If you have any problem about our code, feel free to contact
or describe your problem in Issues.