We have added the configs of 2D pretraining and fine-tuning with EyePACS and DRIVE dataset. Please refer to "configs_2d"
Chuyan Zhang, Hao Zheng, Yun Gu, "Dive into Self-Supervised Learning for Medical Image Analysis"
To run the benchmark, please refer to the config files in "configs/"
- Python 3.7
- PyTorch 1.7.1
Step1. Prepare the pretraining dataset
Download the LUNA2016 from https://luna16.grand-challenge.org/download/
Store the LUNA2016 dataset in the path "../../Data/LUNA2016"
Step2. Pre-process the pretraining data for different pretext tasks.
Pre-Process the LUNA2016 dataset by the code in "pre_processing/":
-
Predictive SSL: RPL/ROT/Jigsaw/RKB/ RKB+ pretext tasks
python preprocess_luna_ssm.py
-
Generative SSL: MG/AE pretext tasks
python -W ignore luna_infinite_generator_3D.py --fold $subset --scale 32 --data ../../Data/LUNA2016 --save generated_cubes
-
Contrastive SSL: PCRL/SimCLR/BYOL pretext tasks
python luna_pcrl_generator.py --input_rows 64 --input_cols 64 --input_deps 32 --data ../../Data/LUNA2016 --save processedLUNA_save_path
Step3. List the paths to the pre-processed datasets in "datasets_3D/paths.py"
Step4. Pretrain the pretxt tasks.
Find the corresponding config files to different SSL pretext tasks in "configs/", make sure the configs match your training setting:
python configs/luna_xxx_3d_config.py
Step1. Prepare the target dataset
Step2. Pre-process the target dataset
Example: For data processing in NCC task:
python luna_node_extraction.py
Step3. List the paths to the pre-processed datasets in "datasets_3D/paths.py"
Step4. Fine-tune a pretrained model on the target dataset.
Find the corresponding config files to target tasks in "configs/", make sure the configs match your training setting and change the default pretrained_path to your own path:
Example: To fine-tune NCC task:
python luna_ncc_3d_config.py
We are still working on more implementations of self-supervised methods for medical image. Feel free to contribute!
The full paper can be found here. More details can be found in the supplementary material.