Awesome
Bias Mimicking: A simple sampling approach for Bias Mitigation
Official Pytorch implementation of Bias Mimicking: A simple sampling approach for Bias Mitigation.
Setup
Set up conda environment
conda create -n bias_mimicking python=3.8
conda activate bias_mimicking
Install packages
- pytorch=1.10.1
- scipy
- tqdm
- scikit-learn
Prepare dataset.
-
CelebA
Download CelebA dataset underdata/celeba
-
UTKFace
Download UTKFace dataset underdata/utk_face
-
CIFAR10
Download CIFAR10 dataset underdata/cifar10
As discussed in the paper, we train on subsampled versions of CelebA and UTKFace. The information required to reproduce the the splits are in data/[DATASET]/pickles. The code will automatically load the right splits.
Train.
From the main directory, run:
python train_[DATASET]/train_[DATASET]_[METHOD].py --seed [SEED]
To train our method on celeba, run:
python train_celeba/train_celeba_bm.py --mode [none/us/uw/os] --seed [SEED]
where mode refers to whether the distribution is left as is/undersampled/upweighted/oversampled when training the predictive linear layer.
Acknowledgements
The code for non sampling methods builds on this work. Furthermore, the code for GroupDRO is obtained from this work
Citation
If you find this repository useful please give it a star and cite as follows! :) :
@inproceedings{qraitem2023bias,
title={Bias Mimicking: A Simple Sampling Approach for Bias Mitigation},
author={Qraitem, Maan and Saenko, Kate and Plummer, Bryan A},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
pages={20311--20320},
year={2023}
}