Home

Awesome

Bayesian Invariant Risk Minmization (BIRM)

The repo for Bayesian Invariant Risk Minimization, CVPR2022 (oral).

Our implementation is based on the source code of IRM, ColoredObject, and CifarMnist.

Requirements

Our code works with the following environment.

To install the necessary packages for the project, please run: pip install -r requirements.txt.

Quick Start (For Reproducing Results)

  1. To perform BIRM on CMNIST (with 20K training data). Run the command sh auto_CMNIST.sh. The expected test accuracy is 67.0±1.8.
  2. To perform BIRM on ColoredObject. First run sh prepare_coco_dataset.sh to download MSCOCO dataset and preprocess the images (it may take several hours, please be patient). Second run the command sh auto_CifarMnist.sh to train BRIM. The expected test accuracy is 78.1±0.6.
  3. To perform BIRM on CifarMnist. Run the command sh auto_ColoredObject.sh. The expected test accuracy is 59.3±2.3.

Important arguments:

Datasets

Implemented Datasets

Refer to Section 5 of our paper for detailed discription of the datasets.

Use BIRM on Your Own Data

We provider interface for you to include your own data. You need to inherit the class IRMDataProvider, and re-implement the function fetch_train and fetch_test. The main function will call fetch_train to get training data for each step. fetch_train should return the following values:

The structure of the return value of fetch_test are similar with fetch_train.

Contact Information

For help or issues using Bayesian Invariant Risk Minimization, please submit a GitHub issue.

For personal communication related to BayesianIRM, please contact Yong Lin (ylindf@connect.ust.hk).

Reference

If you use or extend our work, please cite the following paper:

@inproceedings{lin2022bayesian,
  title={Bayesian Invariant Risk Minimization},
  author={Lin, Yong and Dong, Hanze and Wang, Hao and Zhang, Tong},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={16021--16030},
  year={2022}
}