This repository provides code for the paper, S-CUDA: Self-Cleansing Unsupervised Domain Adaptation for Medical Image Segmentation. Please read our paper to understand our proposed method.
- python 3.5
- tensorflow 1.4.0
- keras 2.2.0
- pytorch 0.4.0
- CUDA 9.2
- tqdm
- skimage
- opencv
- scipy
- matplotlib
Download from Refuge, prepare dataset in data directory as follows.
S-cuda
│ Network-1
| Network-2
│ scripts
└───dataset
│ │ source
│ │ │ images
│ │ │ labels
│ │
│ └───target
│ │ │ images
│ │ │ labels
│ │ │ pseudo_label
│ │
│ └───test
│ │ │ images
│ │ │ labels
│ │
│ └───source.txt
│ │ target.txt
│ │ test.txt
│
└───README.md
Initial weights and pre-trained model download link:
- Initial weights, code:4y69
- Pre-trained model, code:9koj
unzip Initial_weights.zip
unzip Pre-trained model.zip
0.Clone this repo:
git clone https://github.com/zzdxjtu/S-cuda.git
cd S-cuda
1.Train:
All training script is stored in scripts directory.
sh scripts/run1.sh
sh scripts/run2.sh
sh scripts/run3.sh
sh scripts/run4.sh
Before training, please check whether all the model weight and dataset path is correct.
2.Test:
cd S-cuda
python Network-1/evaluation.py
boudary.ipynb ##Calculate the weight map of the optic cup, optic disc, and background
calculate_dice.py ##Calculate dice coefficient
get_contour.ipynb ##Obtain the edge contour of the target object
hausdorff_dis.py ##Calculate hausdorff distance
noise_label.ipynb ##Generate labels with different levels of noise and different proportions, including corrosion, expansion, deformation operations
Some codes are revised according to liyunsheng13/BDL and EmmaW8/pOSAL. Thank them very much.