Official Pytorch implementation of Bias Mimicking: A simple sampling approach for Bias Mitigation.
conda create -n bias_mimicking python=3.8
conda activate bias_mimicking
- pytorch=1.10.1
- scipy
- tqdm
- scikit-learn
-
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.
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.
The code for non sampling methods builds on this work. Furthermore, the code for GroupDRO is obtained from this work
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}
}