Self-supervised diffusion pretraining for thoracic pathology detection offers insights into confounders
See requirements.txt
pip install -r requirements.txt
We provide checkpoints for DiffChest model trained on a joint collection of CXRs, namely, MIMIC-CXR (USA), CheXpert (USA), and PadChest (Spain). In addition, we also offer latent statistics and the classifier model finetuned on high-quality PadChest subset which was annotated by physicians.
Checkpoints ought to be put into a separate directory checkpoints
.
Download the checkpoints and put them into checkpoints
directory. It should look like this:
checkpoints/
- padchest_autoenc
- last.ckpt # DiffChest checkpoint
- padchest_autoenc_cls
- last.ckpt # Finetuned logistic regression classifier
Please register and download those publicly available CXR datasets:
After downloading and preprocessing those images, you need to create a LMDB dataset for model training.
We provide scripts for training & evaluate DiffChest on the following datasets: MIMIC-CXR, CheXpert, and PadChest.
Note: Most experiment requires at least 3x 3090s during training the DPM models while requiring 1x 2080Ti during training the accompanying classification head.
PadChest: 256
We only trained the DiffChest due to the high computation cost. This requires 3x 3090s.
python run_padchest.py
After the previous stage, a classifier (for manipulation) can be trained using:
python run_padchest_cls.py
We provide a testing script for evaluating the classification performance of DiffChest:
python test_padchest_cls.py
To generate visual explanations described in our paper, run:
python manipulate.py
If you use DiffChest, we would appreciate your references to our paper.
Please open new issue threads specifying the issue with the codebase or report issues directly to [email protected].
The source code for the site is licensed under the MIT license, which you can find in the LICENSE
file.
The official implementation of diffae model: https://github.com/phizaz/diffae