HEAL: Learning-Free Source-Free Unsupervised Domain Adaptation for Cross-Modality Medical Image Segmentation
This repository contains the official PyTorch implementation for HEAL, Our paper has been accepted in The 36th British Machine Vision Conference.
Before you begin, ensure you have the following prerequisites met:
- Python 3.10+
- PyTorch 2.12+
- CUDA-enabled GPU
-
nnU-Net Pre-training: For training your nnU-Net model on the source domain, please refer to the official nnU-Net repository and documentation: (3d_fullres for BraTS and 2d for polyp)
-
DDPM Pre-training: For pre-training the DDPM, please follow the guidelines and use the code provided by mobaidoctor/med-ddpm:
-
python med-ddpm/train_brats.py --XX --XX --XX
Note: The pretrained diffusion model can be accessed form https://drive.google.com/drive/folders/1gr8x1cVIKV_l8jJdgIor9-gqPndfmqbl?usp=drive_link
-
How to Run: (Remember to save the soft predictions from nnunet)
python /media/XX/nnUNet/nnunetv2/inference/predict_from_raw_data.py -i /media/XX/nnUNetFrame/nnUNet_raw/Dataset147_BraTS00/imagesTr -o /media/XX//T1ce2T1 -d 148 -c 3d_fullres -p nnUNetResEncUNetPlans --save_probabilityHow to Run:
- Input: Initial soft pseudo-labels from Step 2.
- Execute the denoising script:
python GenerateUncertaintyMap_Entropy.py python BatchesMultiply_Um.py python GenerateUncertaintyMap_Entropy-NIG.py
How to Run:
- Inputs: Denoised pseudo-labels (from Step 3) and organize it.
- Execute the DDPM inference script.
python preprocess_brats_data.py python med-ddpm/sample_brats.py -XX -XX -XX
How to Run:
- Inputs: DDPM-Generated images.
- Execute the edge extraction and sample selection script:
python Extract_edge_canny.py python Sample_selection.py
How to Run:
- Inputs: Selected image inference and HD refined pseudo-label.
- Execute the fusion script.
python dynamic_fusion.py --XX --XX --XX
- Upload source code for HEAL framework
- Release pretrained source models (nnUNet and Diffusion)
- Upload inference and training scripts
- Write a detailed usage guide
We sincerely thank the developers of the following open-source tools and datasets, which have made our research possible:
- nnUNet for the baseline segmentation framework.
- mobaidoctor/med-ddpm for diffusion inference.
