Giter Club home page Giter Club logo

irmcon's Introduction

IRMCon-IPW

This repository is the PyTorch implementation for ECCV 2022 Paper "Class Is Invariant to Context and Vice Versa: On Learning Invariance for Out-Of-Distribution Generalization", For the detailed theories, please refer to our paper. If you have any questions or suggestions, please email me, (I do not usually browse my Github, so the reply to issues may be not on time).

Note that this repository is based on the LfF and DomainBed. (Note, the data processing in Lff should be checked when you use their code, the input range seems abnormal.)

If you find this work is useful in your research, please kindly consider citing:

@inproceedings{qi2022class,
  title={Class Is Invariant to Context and Vice Versa: On Learning Invariance for Out-Of-Distribution Generalization},
  author={Qi, Jiaxin and Tang, Kaihua and Sun, Qianru and Hua, Xian-Sheng and Zhang, Hanwang},
  booktitle={ECCV},
  year={2022}
}
Dependencies

python 3.9.4, pytorch 1.7.1, torchvision 0.8.2

Preparing

Download biased data from here and unzip it under the path ./Biased_dataset/data (Note the result should be ""./Biased_dataset/data/cmnist/...")

Training (examples)

1.Biased dataset, Check your download data path and the set data path in the code.

1.1.Training for Colored MNIST

ERM baseline: python train_cmnist_erm.py --dir_name bias0.05

Ours: python train_cmnist_ours.py --dir_name bias0.05

1.2.Training for Corrupted Cifar-10

ERM baseline: python train_ccifar10_erm.py --dir_name bias0.05

Ours: python train_ccifar10_ours.py --dir_name bias0.05

1.3.Training for BAR

ERM baseline: python train_bar_erm.py --ratio 0.05

Ours: python train_bar_ours.py --ratio 0.05

2.Training for PACS (codebase is from DomainBed, find the full version from here) (The differences are in dataset (we need augmented images), dataloader, and settings (like no pretraining), we need 16G card)

2.1.download data(PACS) from DomainBed and put into ./data

2.2.run baseline: python train_origin.py --test_envs 0

2.3.run ours: python train_ours.py --test_envs 0

Acknowledgements

Thanks for the source code from LfF and DomainBed.

irmcon's People

Contributors

simpleshinobu avatar

Stargazers

 avatar Zuoou Li avatar  avatar rain avatar Boshen Xu avatar Avani Gupta avatar Han Wang avatar wangcl avatar Terry Zhang avatar Juntong Ni avatar Jiequan avatar PatatiPatata  avatar Yucheng Han avatar 爱可可-爱生活 avatar Xin Zhao avatar Kaihua Tang avatar Yulei Niu avatar Daqing Liu avatar

Forkers

huimi001

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.