Home

Awesome

IP-IRM

This repository contains the official PyTorch implementation of paper "Self-Supervised Learning Disentangled Group Representation as Feature".

Self-Supervised Learning Disentangled Group Representation as Feature <br /> Tan Wang, Zhongqi Yue, Jianqiang Huang, Qianru Sun, Hanwang Zhang <br /> Conference and Workshop on Neural Information Processing Systems (NeurIPS), 2021 (Spotlight) <br /> [Paper] [Poster] [Slides] [Zhihu]<br />

<br />

IP-IRM Algorithm

<div align="center"> <img src="figs/ipirm.png" width="900px" /> </div>

1. Minimization Step

<div align="center"> <img src="figs/step1.png" width="650px" /> </div>

2. Maximization Step

<div align="center"> <img src="figs/step2.png" width="680px" /> </div> <br />

Prerequisites

<br />

Training

1. IP-IRM Main Parameters

2. Key Codes & Design

3. Running

  1. Training IP-IRM on STL dataset for 400 epochs with updating partition every 50 epochs
CUDA_VISIBLE_DEVICES=0,1 python main.py --penalty_weight 0.2 --irm_weight_maxim 0.5 --maximize_iter 50 --random_init --constrain --constrain_relax --dataset STL --epochs 400 --offline --keep_cont --retain_group --name IPIRM_STL_epoch400
  1. Linear Evaluations
CUDA_VISIBLE_DEVICES=0,1 python linear.py --model_path results/STL/IPIRM_STL_epoch400/model_400.pth --dataset STL --txt --name IPIRM_STL_epoch400
  1. You can also directly follow the .sh file in the runsh directory

4. Pretrained Model

Epoch$\lambda_1$$\lambda_2$TemperatureArchLatent DimBatch SizeAccuracy(%)Download
IP-IRM4000.20.50.5ResNet5012825684.44model
IP-IRM+MixUp4000.20.50.2ResNet5012825688.26model
IP-IRM+MixUp (1000epochs)10000.20.50.2ResNet5012825690.59model
<br />

Tips for adopting IP-IRM

Here we provide some of our experience when improving IP-IRM which may provide some insights (future direction) for you.

<br />

BibTex

If you find our codes helpful, please cite our paper:

@inproceedings{wang2021self,
  title={Self-Supervised Learning Disentangled Group Representation as Feature},
  author={Wang, Tan and Yue, Zhongqi and Huang, Jianqiang and Sun, Qianru and Zhang, Hanwang},
  booktitle={Conference and Workshop on Neural Information Processing Systems (NeurIPS)},
  year={2021}
}

@inproceedings{wang2021causal,
  title={Causal attention for unbiased visual recognition},
  author={Wang, Tan and Zhou, Chang and Sun, Qianru and Zhang, Hanwang},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
  pages={3091--3100},
  year={2021}
}
<br />

Acknowledgement

Part of this code is inspired by DCL.

If you have any questions, please feel free to email me (TAN317@ntu.edu.sg).