This repository contains the implementation of meta-Domain Specific-Domain Invariant (mDSDI), a theoretical sound framework based on the Information-Bottleneck principle to investigate foundational questions in Domain Generalization (DG). Following the theoretical analysis of the limitation when only learning domain-invariant and the essential of domain-specific representation, mDSDI extends beyond the invariance view by adversarial training to further capture the usefulness of domain-specific information by meta-training. Its results show competitive performance with state-of-the-art techniques in DG and confirm the hypothesis that domain-specific is essential in ablation studies.
Details of the model and experimental results can be found in our following NeurIPS 2021 paper:
@inproceedings{NEURIPS2021_b0f2ad44,
author = {Bui, Manh-Ha and Tran, Toan and Tran, Anh and Phung, Dinh},
booktitle = {Advances in Neural Information Processing Systems},
editor = {M. Ranzato and A. Beygelzimer and Y. Dauphin and P.S. Liang and J. Wortman Vaughan},
pages = {21189--21201},
publisher = {Curran Associates, Inc.},
title = {Exploiting Domain-Specific Features to Enhance Domain Generalization},
url = {https://proceedings.neurips.cc/paper/2021/file/b0f2ad44d26e1a6f244201fe0fd864d1-Paper.pdf},
volume = {34},
year = {2021}
}
Please CITE our paper if you find it useful in your research.
Install prerequisite packages:
python -m pip install -r requirements.txt
Download and unzip the datasets:
bash setup.sh
Run with five different seeds:
for i in {1..3}; do
taskset -c <cpu_index> python main.py --config <config_path> --exp_idx $i --gpu_idx <gpu_index>
done
where the parameters are the following:
<cpu_index>
: CPU index. E.g.,<cpu_index> = "1"
<config_path>
: path stored configuration hyper-parameters. E.g.,<config_path> = "algorithms/mDSDI/configs/PACS_photo.json"
<gpu_index>
: GPU index. E.g.,<gpu_index> = "0"
Note: Select different settings by editing in /configs/..json
, logging results are stored in /results/logs/
tensorboard --logdir <logdir>
where <logdir>
: absolute path stored TensorBoard results. E.g., <logdir> = "/home/ubuntu/mDSDI/algorithms/mDSDI/results/tensorboards/PACS_photo_1"
python utils/tSNE_plot.py --plotdir <plotdir>
where <plotdir>
: path stored results to plot. E.g., <plotdir> = "algorithms/mDSDI/results/plots/PACS_photo_1/"
Note: Results are stored in /results/plots/
To run on "DomainBed, Ishaan and David, 2021" library:
cd DomainBed/
python -m domainbed.scripts.train --data_dir=../data/ --algorithm MDSDI --dataset <dataset_name> --test_env <env_idx>
where the parameters are the following:
<dataset_name>
: name of 5 benchmark datasets, including: RotatedMNIST | VLCS | OfficeHome | PACS | DomainNet. E.g.,<dataset_name> = PACS
<test_env>
: index of the target domain. E.g.,<dataset_name> = 0
Note: Results are stored in DomainBed/results/train_output/out.txt
This source code is released under the Apache-2.0 license, included here.