Example scripts can deal with WILDS datasets.
You should first install wilds
before using these scripts.
pip install wilds
Example scripts also support all models in PyTorch-Image-Models. You also need to install timm to use PyTorch-Image-Models.
pip install timm
Following datasets can be downloaded automatically:
- Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net (IBN-Net, 2018 ECCV)
- Domain Generalization with MixStyle (MixStyle, 2021 ICLR)
- Learning to Generalize: Meta-Learning for Domain Generalization (MLDG, 2018 AAAI)
- Invariant Risk Minimization (IRM)
- Out-of-Distribution Generalization via Risk Extrapolation (VREx, 2021 ICML)
- Distributionally Robust Neural Networks for Group Shifts: On the Importance of Regularization for Worst-Case Generalization (GroupDRO)
- Deep CORAL: Correlation Alignment for Deep Domain Adaptation (Deep Coral, 2016 ECCV)
The shell files give the script to reproduce the benchmarks with specified hyper-parameters. For example, if you want to reproduce IRM on Office-Home, use the following script
# Train with IRM on Office-Home Ar Cl Rw -> Pr task using ResNet 50.
# Assume you have put the datasets under the path `data/office-home`,
# or you are glad to download the datasets automatically from the Internet to this path
CUDA_VISIBLE_DEVICES=0 python irm.py data/office-home -d OfficeHome -s Ar Cl Rw -t Pr -a resnet50 --seed 0 --log logs/irm/OfficeHome_Pr
For more information please refer to Get Started for help.
If you use these methods in your research, please consider citing.
@inproceedings{IBN-Net,
author = {Xingang Pan, Ping Luo, Jianping Shi, and Xiaoou Tang},
title = {Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net},
booktitle = {ECCV},
year = {2018}
}
@inproceedings{mixstyle,
title={Domain Generalization with MixStyle},
author={Zhou, Kaiyang and Yang, Yongxin and Qiao, Yu and Xiang, Tao},
booktitle={ICLR},
year={2021}
}
@inproceedings{MLDG,
title={Learning to Generalize: Meta-Learning for Domain Generalization},
author={Li, Da and Yang, Yongxin and Song, Yi-Zhe and Hospedales, Timothy},
booktitle={AAAI},
year={2018}
}
@misc{IRM,
title={Invariant Risk Minimization},
author={Martin Arjovsky and Léon Bottou and Ishaan Gulrajani and David Lopez-Paz},
year={2020},
eprint={1907.02893},
archivePrefix={arXiv},
primaryClass={stat.ML}
}
@inproceedings{VREx,
title={Out-of-Distribution Generalization via Risk Extrapolation (REx)},
author={David Krueger and Ethan Caballero and Joern-Henrik Jacobsen and Amy Zhang and Jonathan Binas and Dinghuai Zhang and Remi Le Priol and Aaron Courville},
year={2021},
booktitle={ICML},
}
@inproceedings{GroupDRO,
title={Distributionally Robust Neural Networks for Group Shifts: On the Importance of Regularization for Worst-Case Generalization},
author={Shiori Sagawa and Pang Wei Koh and Tatsunori B. Hashimoto and Percy Liang},
year={2020},
booktitle={ICLR}
}
@inproceedings{deep_coral,
title={Deep coral: Correlation alignment for deep domain adaptation},
author={Sun, Baochen and Saenko, Kate},
booktitle={ECCV},
year={2016},
}