This is the official PyTorch implementation of CLMS (Continual Learning Multi-Scale) .
CLMS: Bridging Domain Gaps in Medical Imaging with Continual Learning for Source-Free Adaptation.
- Python=3.7.7
- torch=1.7.0
- torchvision=0.8.1
- SimpleITK=2.2.0
- Pillow=8.2.0
- opencv-python=4.5.5.64
- scikit-image=0.17.2
- scikit-learn=0.23.2
- scipy=1.2.0
-
It is necessary to set the paths for the training data required for training the model in the options/base_options.py file. Set the path for the target domain training dataset in the
targetLibPath
field ofoptions/base_options
, and specify the path for the augmented domain dataset in theaugLibPath
field. -
Format of Target Domain Training Set Files:
- Files in
targetLibPath
are of type.pt
. - They can be accessed using
torch.load()
. - The file format is a dictionary with a key 'slide', and the corresponding value is a list containing paths to target domain images. Example of Target Domain Training Set File (
targetDomain_train.pt
): - {'slide': ['/target/image1.jpg', '/target/image2.jpg', ...] }
- Files in
-
Format of Augmented Domain Training Set Files:
- Files in
augLibPath
are also of type.pt
. - Accessible using
torch.load()
. - The file format is a dictionary with a key 'slide', and the corresponding value is a list containing paths to target domain images. Example of Augmented Domain Training Set File (
augmentation_train.pt
): - {'slide': ['/aug/image1.jpg', '/aug/image2.jpg', ...] }
- Files in
- After completing data preparation, it is necessary to load the source domain model weight. In the
options/base_options.py
file, thecheckpoints_dir
field represents the path to the source domain model weights.
-
Before training, you need to configure the weight saving path in the
checkpoints_dir
field inoptions/base_options.py
. Set the desired batch size in thebatch_size
field, and specify the GPUs for training in thegpu_ids
field. -
In
options/train_options.py
, adjust then_epochs
field to set the number of training epochs, and configure the learning rate with thelr
parameter. -
For other training-related settings, please carefully review the comments in
options/base_options.py
andtrain_options.py
. -
After completing the aforementioned setup, execute the command
python train.py
to commence the training process. -
Please note that this framework supports multi-GPU parallel training.
- After completing the training, you can set the paths for the target domain test set and source domain test set, as well as the loaded model weights in the
test/test.py
file. Execute the commandpython test.py
to start the testing process.