Repository for the MICCAI 2024 FAIMI workshop paper Slicing Through Bias: Explaining Performance Gaps in Medical Image Analysis using Slice Discovery Methods
A fork of the code for the 2023 FAIMI paper Are Sex-based Physiological Differences the Cause of Gender Bias for Chest X-ray Diagnosis? is used to export the embeddings used in the paper.
This repository contains the code for
- Dimensionality reductions of the exported embeddings
- Generating figures for the paper
Follow the instructions given in the forked repository to download the data and generate the embeddings.
The labels for the datasets, see datafiles/
, have been augmented by adding a Drain
column, kindly provided by the authors of Augmenting Chest X-ray Datasets with Non-Expert Annotations and Detecting Shortcuts in Medical Images -- A Case Study in Chest X-rays.
With the forked repository as the current working directory, the embeddings can be generated by running the following commands:
python prediction/disease_prediction.py -s <dataset> -d <disease> -f 0 50 100 -n 1 -r 0-10 -p <img-dir> --run_dir <run-directory>
For the paper, embeddings where generated for the following diseases: Atelectasis
and Pneumothorax
on NIH
and chexpert
.
The artifacts generated by the command will be saved in the <run-directory>
and is used in the following steps.
The remaining steps are caried in the cxr
enviroment created using the following command:
conda env create -f environment.yml
To apply dimensionality reduction to the embeddings, run the following command:
python embeddings.py --path <run-directory> --dataset=<dataset> --dimension <embedding-dimension>
This will save the embeddings with the specified dimension in the <run-directory>
.
In the final paper, we used the embeddings with 128 dimensions.
The figures in the paper can be generated by running the following commands:
python comorbidity_plot.py --path <run-directory> --dataset=<dataset> --disease=<disease> --case=<case> --output=<output-directory>
The plots were generated with case set to positive
and negative
. Further, a --drain
flag is included for analyses including the Drain
column.