SF
sfu-mial/MaskTune
Code supporting our NeurIPS paper MaskTune: Mitigating Spurious Correlations by Forcing to Explore
MaskTune: Mitigating Spurious Correlations by Forcing to Explore, NeurIPS 2022
This is the official pytorch implementation of MaskTune: Mitigating Spurious Correlations by Forcing to Explore, NeurIPS 2022. MaskTune is a technique for mitigating shortcut learning in machine learning algorithms.How to use
- Clone the code (now you should have a folder named MaskTune)
- Inside
Masktune/createdatasets/folder - For
catsvsdogsandinl9 (the Background Challenge)expriments, insideMaskTune/datasets/createcatsvsdogs/raw/andin9l/raw/folders. For other datasets ignore this step. - Download the dataset you want (you don't need to download cifar10, mnist, and svhn because they will be downloaded automatically).
- For Waterbirds, please download the corrected version of the Waterbirds dataset from here (The original Waterbirds dataset has some label and image noise). Then extract it into the
Masktune/datasets/Waterbirds/(so inside this folder you should haveimagesfolder) - For CelebA, please download
img_align_celebafolder from here. After extracting it, you should see a folder namedarchive. Pass this folder's path to the--dataset_dirin the bash file. - To run an experiment, use the bash files in
MaskTune/bash_files. First, change the second line of the bash file to the path ofMaskTunefolder (e.g.,downloads/MaskTune). You have to setbase_dirto the path ofMaskTune/folder anddataset_dirto the path of corresponding dataset (e.g., for celebA set this to{base_dir}/datasets/CelebA/raw)
