Skip to content

About

No description, website, or topics provided.

Resources

Stars

7 stars

Watchers

1 watching

Forks

Latest commit

 

History

14 Commits

Folders and files

Repository files navigation

Mitigating Biases in Blackbox Feature Extractors for Image Classification Tasks

This repository contains the implementation of our margin-loss based model.

Almost all flags can be set at utils/config.py. The dataset paths, the hyperparams can be set accordingly in this file.

Recommended hardware configuration:

  • GPU: One NVIDIA GeForce RTX 2080 Ti
  • RAM: 4GB (approx) if the features are explicitly extracted inside the model, 1.5GB otherwise
  • CPU: AMD Ryzen Threadripper 3960X 24-Core Processor
  • OS: Ubuntu 18.04.6 LTS

We used 3 random seeds to run the final models: 2411, 5193, 4594

Dataset

  • Download the CelebA, and Waterbirds datasets. Extract their features from a pretrained feature extractor and store them. Note the folder path and update it in utils/config.py. Recall that the validation set has to be group-balanced. For CelebA, store the folder in the celeba_path attribute of utils/config.py (similarly for Waterbirds). The embeddings should be stored in {split}_feats.npy, whereas the bias and target labels should be stored in {split}_bias.npy and {split}_target.npy respectively, inside the folder.

Usage instructions:

Baseline

To run the baseline (ERM model), run the following command. Dataset can either be waterbirds or celeba:

python margin_loss.py --dataset waterbirds --train --type baseline --bias 

Margin loss (CAML) training

python margin_loss.py --dataset waterbirds --train --type margin

Model evaluation instruction

python margin_loss.py --dataset waterbirds --val-only [or test-only]

Calculate NMI

python margin_loss.py --dataset waterbirds --clustering

Eval only

Checkpoints of ERM and our model are provided in erm_path and margin_path. These can be used to validate the scores reported in our paper.


Results on our method evaluated on Waterbirds and CelebA on the ResNet-18 backbone

Model Waterbirds CelebA
Worst Average Worst Average
ERM 38.90 76.22 27.20 75.43
DebiAN 58.94 80.47 26.10 75.41
BPA 58.70 80.83 66.71 84.14
LfF 66.09 81.39 13.26 69.42
JTT 49.84 77.03 56.25 73.58
GEORGE 59.35 80.34 42.22 79.76
Ours 80.29 84.56 81.61 86.04

About

No description, website, or topics provided.

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages