Please follow the instruction and prepare source and target datasets (in NIfTI).
Next link the datasets under the data folder.
ln -s SOURCE_DATASET data/source
ln -s TARGET_DATASET data/target
The file hierarchy of data should look like below.
data
├── source
│ ├── images
│ │ ├── SAMPLE_1.nii.gz
│ │ ├── SAMPLE_2.nii.gz
│ │ ├── ...
│ └── labels
│ ├── SAMPLE_1.nii.gz
│ ├── SAMPLE_2.nii.gz
│ ├── ...
│
└── target
├── images
│ ├── SAMPLE_1.nii.gz
│ ├── SAMPLE_2.nii.gz
│ ├── ...
└── labels
├── SAMPLE_1.nii.gz
├── SAMPLE_2.nii.gz
├── ...
Specify the partition of data for the domain adaptation. We need to setup three data lists
./data_lists/source_train.json5, which is used for supervised training on segmentation, domain adaptation as source
{
"amount": AMOUNT, // optional
"list": [ // fill in the list of source samples for training
SAMPLE_1,
SAMPLE_2,
...
],
"loader": { ... }
}
./data_lists/valid_train.json5, which is used to determine a best model for segmentation and domain adaptation
{
"amount": AMOUNT, // optional
"list": [ // fill in the list of source samples for validation
SAMPLE_1,
SAMPLE_2,
...
],
"loader": { ... }
}
./data_lists/target.json5, which is used for domain adaptation as target
{
"amount": AMOUNT, // optional
"list": [ // fill in the list of target samples for domain adaptation
SAMPLE_1,
SAMPLE_2,
...
],
"loader": { ... }
}
cd exps/without_DA
make test // check the program runs normally first
make train
cd exps/with_DA
make test // check the program runs normally first
make train
The model will automatically save the best checkpoint of model based on the performance of source validation set. We can run the following commands in each experiment directory to produce the segmentation.
cd exps/with_DA # or cd exps/without_DA
make infer
Please refer to here.