From 1976cec36162f8dd1ce200cee13a3bf5493cbd9c Mon Sep 17 00:00:00 2001 From: Adrian El Baz Date: Thu, 15 Dec 2022 13:58:36 -0500 Subject: [PATCH 01/11] Init training experiments with all contrasts --- MTS_batch_runs/acq-MTon_MTS/training_run.sh | 22 +++ MTS_batch_runs/acq-T1w_MTS/training_run.sh | 22 +++ MTS_batch_runs/all/training_run.sh | 22 +++ batch_run.sh | 50 ++++++ change_mts_filenames.py | 57 +++++++ config_generator.py | 169 ++++++++++++++++++++ config_templates/hard_hard.json | 162 +++++++++++++++++++ config_templates/hard_soft.json | 166 +++++++++++++++++++ config_templates/meanGT_hard.json | 162 +++++++++++++++++++ config_templates/meanGT_soft.json | 166 +++++++++++++++++++ inference.sh | 17 ++ 11 files changed, 1015 insertions(+) create mode 100644 MTS_batch_runs/acq-MTon_MTS/training_run.sh create mode 100644 MTS_batch_runs/acq-T1w_MTS/training_run.sh create mode 100644 MTS_batch_runs/all/training_run.sh create mode 100644 batch_run.sh create mode 100644 change_mts_filenames.py create mode 100644 config_generator.py create mode 100644 config_templates/hard_hard.json create mode 100644 config_templates/hard_soft.json create mode 100644 config_templates/meanGT_hard.json create mode 100644 config_templates/meanGT_soft.json create mode 100644 inference.sh diff --git a/MTS_batch_runs/acq-MTon_MTS/training_run.sh b/MTS_batch_runs/acq-MTon_MTS/training_run.sh new file mode 100644 index 00000000..7dc3197e --- /dev/null +++ b/MTS_batch_runs/acq-MTon_MTS/training_run.sh @@ -0,0 +1,22 @@ +####### Training Run ####### +seeds=(15) # seeds=(42 15 34 98 62) +config_types=("hard_hard" "hard_soft" "meanGT_soft" "meanGT_hard") +#contrasts=("T1w" "T2w" "T2star" "rec-average_dwi" "all") +contrasts=("flip-1_mt-on_MTS") # We can't differentiate between variants of MTS + +for seed in ${seeds[@]} +do + for config in ${config_types[@]} + do + for contrast in ${contrasts[@]} + do + sleep 5 + #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json + output_dir=./batch_results/group-9/"$config"_"$contrast"_seed="$seed" + echo $output_dir + mkdir $output_dir + #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json + CUDA_VISIBLE=0 ivadomed --train -c ./batch_configs/group-9/"$config"_"$contrast"_seed="$seed".json --path-output $output_dir + done + done +done \ No newline at end of file diff --git a/MTS_batch_runs/acq-T1w_MTS/training_run.sh b/MTS_batch_runs/acq-T1w_MTS/training_run.sh new file mode 100644 index 00000000..d6545d62 --- /dev/null +++ b/MTS_batch_runs/acq-T1w_MTS/training_run.sh @@ -0,0 +1,22 @@ +####### Training Run ####### +seeds=(15) # seeds=(42 15 34 98 62) +config_types=("hard_hard" "hard_soft" "meanGT_soft" "meanGT_hard") +#contrasts=("T1w" "T2w" "T2star" "rec-average_dwi" "all") +contrasts=("flip-2_mt-off_MTS") # We can't differentiate between variants of MTS + +for seed in ${seeds[@]} +do + for config in ${config_types[@]} + do + for contrast in ${contrasts[@]} + do + sleep 5 + #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json + output_dir=./batch_results/group-9/"$config"_"$contrast"_seed="$seed" + echo $output_dir + mkdir $output_dir + #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json + CUDA_VISIBLE=1 ivadomed --train -c ./batch_configs/group-9/"$config"_"$contrast"_seed="$seed".json --path-output $output_dir + done + done +done \ No newline at end of file diff --git a/MTS_batch_runs/all/training_run.sh b/MTS_batch_runs/all/training_run.sh new file mode 100644 index 00000000..e97e37c4 --- /dev/null +++ b/MTS_batch_runs/all/training_run.sh @@ -0,0 +1,22 @@ +####### Training Run ####### +seeds=(15) # seeds=(42 15 34 98 62) +config_types=("hard_hard" "hard_soft" "meanGT_soft" "meanGT_hard") +#contrasts=("T1w" "T2w" "T2star" "rec-average_dwi" "all") +contrasts=("all") # We can't differentiate between variants of MTS + +for seed in ${seeds[@]} +do + for config in ${config_types[@]} + do + for contrast in ${contrasts[@]} + do + sleep 5 + #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json + output_dir=./batch_results/group-9/"$config"_"$contrast"_seed="$seed" + echo $output_dir + mkdir $output_dir + #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json + CUDA_VISIBLE=2 ivadomed --train -c ./batch_configs/group-9/"$config"_"$contrast"_seed="$seed".json --path-output $output_dir + done + done +done \ No newline at end of file diff --git a/batch_run.sh b/batch_run.sh new file mode 100644 index 00000000..ece1faad --- /dev/null +++ b/batch_run.sh @@ -0,0 +1,50 @@ +####### Config creation ####### + +#python config_generator.py --config config_templates/hard_hard.json \ +# --datasets /home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean \ +# --ofolder joblibs/group-8 \ +# --contrasts T1w T2w T2star rec-average_dwi \ +# --seeds 15 +# +# +#python config_generator.py --config config_templates/hard_soft.json \ +# --datasets /home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean \ +# --ofolder joblibs/group-8 \ +# --contrasts T1w T2w T2star rec-average_dwi \ +# --seeds 15 + +python config_generator.py --config config_templates/meanGT_soft.json \ + --datasets /home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean \ + --ofolder joblibs/group-8 \ + --contrasts T1w T2w T2star rec-average_dwi \ + --seeds 15 + +#python config_generator.py --config config_templates/meanGT_hard.json \ +# --datasets /home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean \ +# --ofolder joblibs/group-8 \ +# --contrasts T1w T2w T2star rec-average_dwi \ +# --seeds 15 + +####### Training Run ####### +seeds=(15) # seeds=(42 15 34 98 62) +config_types=("meanGT_soft") # ("hard_hard" "hard_soft" "meanGT_soft" "meanGT_hard") +contrasts=("T1w" "T2w" "T2star" "rec-average_dwi" "all") + +for seed in ${seeds[@]} +do + for config in ${config_types[@]} + do + for contrast in ${contrasts[@]} + do + sleep 5 + #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json + output_dir=./batch_results/group-9/"$config"_"$contrast"_seed="$seed" + echo $output_dir + mkdir $output_dir + #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json + CUDA_VISIBLE=0 ivadomed --train -c ./batch_configs/group-9/"$config"_"$contrast"_seed="$seed".json --path-output $output_dir + done + done +done + + \ No newline at end of file diff --git a/change_mts_filenames.py b/change_mts_filenames.py new file mode 100644 index 00000000..396fe733 --- /dev/null +++ b/change_mts_filenames.py @@ -0,0 +1,57 @@ +""" +python config_generator.py --config config_templates/hard_hard.json \ + --datasets /home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean \ + --ofolder joblibs/MTS/T1w \ + --contrasts T1w T2w T2star rec-average_dwi flip-2_mt-off_MTS flip-1_mt-on_MTS \ + --seeds 15 + +python config_generator.py --config config_templates/hard_soft.json \ + --datasets /home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean \ + --ofolder joblibs/MTS/T1w \ + --contrasts T1w T2w T2star rec-average_dwi flip-2_mt-off_MTS flip-1_mt-on_MTS \ + --seeds 15 + +python config_generator.py --config config_templates/meanGT_soft.json \ + --datasets /home/GRAMES.POLYMTL.CA/adelba/duke/temp/adrian/contrast-agnostic-seg-models/data_processed_clean \ + --ofolder joblibs/MTS/all \ + --contrasts T1w T2w T2star rec-average_dwi flip-1_mt-on_MTS flip-2_mt-off_MTS \ + --seeds 15 + +python config_generator.py --config config_templates/meanGT_hard.json \ + --datasets /home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean \ + --ofolder joblibs/MTS/T1w \ + --contrasts T1w T2w T2star rec-average_dwi flip-2_mt-off_MTS flip-1_mt-on_MTS \ + --seeds 15 +""" +import os +from glob import glob + +if __name__ == "__main__": + #dataset_type = "data_processed_clean_MTon_MTS" + #dataset_type = "data_processed_clean_T1w_MTS" + user = "adelba" # POLYGRAMS + user_temp_folder = "adrian" # DUKE TEMP FOLDER NAME + dataset_type = "data_processed_clean" + + dir_base = f"/home/GRAMES.POLYMTL.CA/{user}/duke/temp/{user_temp_folder}/contrast-agnostic-seg-models/{dataset_type}/**/**/*" + dir_labels = f"/home/GRAMES.POLYMTL.CA/{user}/duke/temp/{user_temp_folder}/contrast-agnostic-seg-models/{dataset_type}/derivatives/labels/**/**/*" + dir_soft_labels = f"/home/GRAMES.POLYMTL.CA/{user}/duke/temp/{user_temp_folder}/contrast-agnostic-seg-models/{dataset_type}/derivatives/labels_softseg/**/**/*" + + files_base = [fn for fn in glob(dir_base) if os.path.isfile(fn)] + files_labels = [fn for fn in glob(dir_labels) if os.path.isfile(fn)] + files_soft_labels = [fn for fn in glob(dir_soft_labels) if os.path.isfile(fn)] + + for dr in [files_base, files_labels, files_soft_labels]: + for f in dr: + base_path = os.path.basename(f) + if "acq-MTon_MTS" in base_path: + new_filename = f.replace("acq-MTon_MTS", "flip-1_mt-on_MTS") + assert dataset_type != "data_processed_clean_T1w_MTS" + os.rename(f, new_filename) + elif "acq-T1w_MTS" in base_path: + new_filename = f.replace("acq-T1w_MTS", "flip-2_mt-off_MTS") + assert dataset_type != "data_processed_clean_MTon_MTS" + os.rename(f, new_filename) + else: + continue + print(f"Replaced : {base_path} --> {os.path.basename(new_filename)}") diff --git a/config_generator.py b/config_generator.py new file mode 100644 index 00000000..7effc2d9 --- /dev/null +++ b/config_generator.py @@ -0,0 +1,169 @@ +""" +Script that takes as input an ivadomed config (JSON) & replaces the following dynamic string params: + - : The contrast name, you can name it however you like, e.g., T1w, T2w, T1wANDT2w + - : The contrast param name, has to match file suffix unlike + - : The .joblib file to use to split the dataset into train-val-test + - : The seed to use +This script creates several config files for different contrast and seed scenarios +Inputs: + --config: Path to the base ivadomed config (JSON) with dynamic string params + --datasets: List of BIDS dataset folders + --ofolder: Output folder for .joblib files + --contrasts: Replaces + --seeds: Replaces +Example usage: +python config_generator.py --config config/meanGT_soft.json \ + --datasets /home/GRAMES.POLYMTL.CA/uzmac/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-preprocess-all-2022-08-21-final/data_processed_clean \ + --ofolder joblibs \ + --contrasts T1w T2w T2star rec-average_dwi \ + --seeds 42 15 34 98 62 +""" + +import glob +import os +import json +import pandas as pd +import joblib +import random +import numpy as np +import argparse +from collections import defaultdict + +parser = argparse.ArgumentParser() +parser.add_argument("--config", type=str, required=True, help="Path to the ivadomed config (JSON)") +parser.add_argument("--datasets", required=True, nargs="*", help="List of BIDS dataset folders") +parser.add_argument("--ofolder", type=str, default="joblibs", help="Output folder for .joblib files") +parser.add_argument("--contrasts", required=True, nargs="*", help="Contrasts to generate .joblib files for and replace ") +parser.add_argument("--seeds", type=int, default=42, nargs="*", help="Seed for randomly distributing subjects into train, validation, and testing and replaces ") +args = parser.parse_args() + +# Check validity of user inputs +assert args.config.endswith('.json') +assert all([os.path.exists(dataset) for dataset in args.datasets]) + +# Create output directory if it doesn't exists +if not os.path.exists(args.ofolder): + os.makedirs(args.ofolder) + +for seed in args.seeds: + # Set random seeds for reproducibility + random.seed(seed) + np.random.seed(seed) + + # Merge multiple TSV files from multiple BIDS datasets (if applicable) into single data frame + df_merged = pd.read_table(os.path.join(args.datasets[0], 'participants.tsv'), encoding="ISO-8859-1") + # Convert to string to get rid of potential TypeError during merging within the same column + df_merged = df_merged.astype(str) + # Add the BIDS path to the data frame + df_merged['bids_path'] = [args.datasets[0]] * len(df_merged) + + for i in range(1, len(args.datasets)): + df_next = pd.read_table(os.path.join(args.datasets[i], 'participants.tsv'), encoding="ISO-8859-1") + df_next = df_next.astype(str) + df_next['bids_path'] = [args.datasets[i]] * len(df_next) + # Merge the .tsv files (This keeps also non-overlapping fields) + df_merged = pd.merge(left=df_merged, right=df_next, how='outer') + + print('Got following BIDS datasets: ', set(df_merged['bids_path'].values.tolist())) + print('Generating joblibs for following contrasts: ', args.contrasts) + + # Set train, validation, and test split percentages + pct_train, pct_validation, pct_test = 0.6, 0.2, 0.2 + assert pct_train + pct_validation + pct_test == 1.0 + + # Split subjects into train, validation, and test groups + subs = df_merged['participant_id'].values.tolist() + np.random.shuffle(subs) + train_subs = subs[:int(len(subs) * pct_train)] + validation_subs = subs[int(len(subs) * pct_train): int(len(subs) * (pct_train + pct_validation))] + test_subs = subs[int(len(subs) * (pct_train + pct_validation)):] + print('Got %d train, %d validation, and %d test subjects!' % (len(train_subs), len(validation_subs), len(test_subs))) + + jobdicts = [] + for contrast in args.contrasts: + train_subs_cur, validation_subs_cur, test_subs_cur = [], [], [] + for sub in train_subs: + bids_path = df_merged[df_merged['participant_id'] == sub]['bids_path'].values.tolist()[0] + files = glob.glob(os.path.join(bids_path, sub) + '/**/*%s.nii.gz' % contrast, recursive=True) + if len(files) != 0: + train_subs_cur.append('%s_%s.nii.gz' % (sub, contrast)) + for sub in validation_subs: + bids_path = df_merged[df_merged['participant_id'] == sub]['bids_path'].values.tolist()[0] + files = glob.glob(os.path.join(bids_path, sub) + '/**/*%s.nii.gz' % contrast, recursive=True) + if len(files) != 0: + validation_subs_cur.append('%s_%s.nii.gz' % (sub, contrast)) + for sub in test_subs: + bids_path = df_merged[df_merged['participant_id'] == sub]['bids_path'].values.tolist()[0] + files = glob.glob(os.path.join(bids_path, sub) + '/**/*%s.nii.gz' % contrast, recursive=True) + if len(files) != 0: + test_subs_cur.append('%s_%s.nii.gz' % (sub, contrast)) + + jobdict = {"train": train_subs_cur, "valid": validation_subs_cur, "test": test_subs_cur} + jobdicts.append(jobdict) + joblib.dump(jobdict, os.path.join(args.ofolder, "split_datasets_%s_seed=%s.joblib" % (contrast, seed))) + + # Generate one final joblib for all contrast training + jobdict_all = {"train": [], "valid": [], "test": []} + for i in range(len(jobdicts)): + jobdict = jobdicts[i] + for key, values in jobdict.items(): + for value in values: + jobdict_all[key].append(value) + joblib.dump(jobdict_all, os.path.join(args.ofolder, "split_datasets_all_seed=%s.joblib" % seed)) + +# Read config +config_dir, config_fname = os.path.dirname(args.config), os.path.basename(args.config) +config = json.load(open(args.config)) + +for seed in args.seeds: + seed = str(seed) + contrast_params = [] + for contrast in args.contrasts: + # Adjust contrast param for specific use cases + contrast_param = contrast + if contrast == 'rec-average_dwi': + contrast_param = 'dwi' + contrast_params.append(contrast_param) + + # Convert config to string and replace the supplied parameters + config_str = json.dumps(config).\ + replace('', contrast).\ + replace('', contrast_param).\ + replace('', os.path.join(args.ofolder, 'split_datasets_%s_seed=%s.joblib' % (contrast, seed))).\ + replace('', seed) + + # Get config back with replacements + config_filled = json.loads(config_str) + config_filled_path = os.path.join( + config_dir, + '%s_%s_seed=%s.json' % (os.path.splitext(config_fname)[0], contrast, seed) + ) + + # Write back the config + with open(config_filled_path, 'w', encoding='utf-8') as f: + json.dump(config_filled, f, ensure_ascii=False, indent=4) + print('Created config: %s' % config_filled_path) + + # Convert config to string and replace the supplied parameters + config_str = json.dumps(config). \ + replace('', 'all'). \ + replace('', ','.join(contrast_params)). \ + replace('', os.path.join(args.ofolder, 'split_datasets_all_seed=%s.joblib' % seed)). \ + replace('', seed) + + # Get config back with replacements + config_filled = json.loads(config_str) + + # Write combined contrasts in a list format + for key in ["training_validation", "testing"]: + config_filled["loader_parameters"]["contrast_params"][key] = config_filled["loader_parameters"]["contrast_params"][key][0].split(',') + + config_filled_path = os.path.join( + config_dir, + '%s_%s_seed=%s.json' % (os.path.splitext(config_fname)[0], 'all', seed) + ) + + # Write back the config + with open(config_filled_path, 'w', encoding='utf-8') as f: + json.dump(config_filled, f, ensure_ascii=False, indent=4) + print('Created config: %s' % config_filled_path) \ No newline at end of file diff --git a/config_templates/hard_hard.json b/config_templates/hard_hard.json new file mode 100644 index 00000000..1388a4aa --- /dev/null +++ b/config_templates/hard_hard.json @@ -0,0 +1,162 @@ +{ + "command": "train", + "gpu_ids": [0], + "path_output": "hard_hard__seed=", + "model_name": "hard_hard__seed=", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [1.0, 1.0, 1.0] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "hard_hard__seed=", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": ["/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean"], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": ["_seg-manual"], + "extensions": [".nii.gz"], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [""], + "testing": [""], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": false + }, + "split_dataset": { + "fname_split": "", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "DiceLoss" + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 1e-3, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 1e-4, + "max_lr": 1e-3 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "sigmoid" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [48, 176, 288], + "stride_3D": [48, 176, 288], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": {"thr": 0.5}, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": + { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [48, 176, 288] + }, + "RandomAffine": { + "degrees": 20, + "scale": [0.2, 0.2, 0.2], + "translate": [0.1, 0.1, 0.1], + "applied_to": ["im", "gt"], + "dataset_type": ["training"] + }, + "ElasticTransform": { + "alpha_range": [25.0, 35.0], + "sigma_range": [3.5, 5.5], + "p": 0.5, + "applied_to": ["im", "gt"], + "dataset_type": ["training"] + }, + "RandomGamma": { + "log_gamma_range": [-1.0, 1.0], + "p": 0.5, + "applied_to": ["im"], + "dataset_type": ["training"] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": ["im"], + "dataset_type": ["training"] + }, + "RandomBlur": { + "sigma_range": [0.0, 2.0], + "p": 0.3, + "applied_to": ["im"], + "dataset_type": ["training"] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": ["im"] + } + } +} \ No newline at end of file diff --git a/config_templates/hard_soft.json b/config_templates/hard_soft.json new file mode 100644 index 00000000..95e38679 --- /dev/null +++ b/config_templates/hard_soft.json @@ -0,0 +1,166 @@ +{ + "command": "train", + "gpu_ids": [0], + "path_output": "hard_soft__seed=", + "model_name": "hard_soft__seed=", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [1.0, 1.0, 1.0] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "hard_soft__seed=", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": ["/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean"], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": ["_seg-manual"], + "extensions": [".nii.gz"], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [""], + "testing": [""], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "AdapWingLoss", + "epsilon": 1, + "theta": 0.5, + "omega": 8, + "alpha": 2.1 + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 1e-3, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 1e-4, + "max_lr": 1e-3 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "relu" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [48, 176, 288], + "stride_3D": [48, 176, 288], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": {"thr": -1}, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": + { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [48, 176, 288] + }, + "RandomAffine": { + "degrees": 20, + "scale": [0.2, 0.2, 0.2], + "translate": [0.1, 0.1, 0.1], + "applied_to": ["im", "gt"], + "dataset_type": ["training"] + }, + "ElasticTransform": { + "alpha_range": [25.0, 35.0], + "sigma_range": [3.5, 5.5], + "p": 0.5, + "applied_to": ["im", "gt"], + "dataset_type": ["training"] + }, + "RandomGamma": { + "log_gamma_range": [-1.0, 1.0], + "p": 0.5, + "applied_to": ["im"], + "dataset_type": ["training"] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": ["im"], + "dataset_type": ["training"] + }, + "RandomBlur": { + "sigma_range": [0.0, 2.0], + "p": 0.3, + "applied_to": ["im"], + "dataset_type": ["training"] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": ["im"] + } + } +} \ No newline at end of file diff --git a/config_templates/meanGT_hard.json b/config_templates/meanGT_hard.json new file mode 100644 index 00000000..7ac47d35 --- /dev/null +++ b/config_templates/meanGT_hard.json @@ -0,0 +1,162 @@ +{ + "command": "train", + "gpu_ids": [0], + "path_output": "meanGT_hard__seed=", + "model_name": "meanGT_hard__seed=", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [1.0, 1.0, 1.0] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "meanGT_hard__seed=", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": ["/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean"], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": ["_softseg"], + "extensions": [".nii.gz"], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [""], + "testing": [""], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "DiceLoss" + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 1e-3, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 1e-4, + "max_lr": 1e-3 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "sigmoid" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [48, 176, 288], + "stride_3D": [48, 176, 288], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": {"thr": 0.5}, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": + { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [48, 176, 288] + }, + "RandomAffine": { + "degrees": 20, + "scale": [0.2, 0.2, 0.2], + "translate": [0.1, 0.1, 0.1], + "applied_to": ["im", "gt"], + "dataset_type": ["training"] + }, + "ElasticTransform": { + "alpha_range": [25.0, 35.0], + "sigma_range": [3.5, 5.5], + "p": 0.5, + "applied_to": ["im", "gt"], + "dataset_type": ["training"] + }, + "RandomGamma": { + "log_gamma_range": [-1.0, 1.0], + "p": 0.5, + "applied_to": ["im"], + "dataset_type": ["training"] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": ["im"], + "dataset_type": ["training"] + }, + "RandomBlur": { + "sigma_range": [0.0, 2.0], + "p": 0.3, + "applied_to": ["im"], + "dataset_type": ["training"] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": ["im"] + } + } +} \ No newline at end of file diff --git a/config_templates/meanGT_soft.json b/config_templates/meanGT_soft.json new file mode 100644 index 00000000..e7b09013 --- /dev/null +++ b/config_templates/meanGT_soft.json @@ -0,0 +1,166 @@ +{ + "command": "train", + "gpu_ids": [0], + "path_output": "meanGT_soft__seed=", + "model_name": "meanGT_soft__seed=", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [1.0, 1.0, 1.0] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-9", + "run_name": "meanGT_soft__seed=", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": ["/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean"], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": ["_softseg"], + "extensions": [".nii.gz"], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [""], + "testing": [""], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "AdapWingLoss", + "epsilon": 1, + "theta": 0.5, + "omega": 8, + "alpha": 2.1 + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 1e-3, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 1e-4, + "max_lr": 1e-3 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "relu" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [48, 176, 288], + "stride_3D": [48, 176, 288], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": {"thr": -1}, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": + { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [48, 176, 288] + }, + "RandomAffine": { + "degrees": 20, + "scale": [0.2, 0.2, 0.2], + "translate": [0.1, 0.1, 0.1], + "applied_to": ["im", "gt"], + "dataset_type": ["training"] + }, + "ElasticTransform": { + "alpha_range": [25.0, 35.0], + "sigma_range": [3.5, 5.5], + "p": 0.5, + "applied_to": ["im", "gt"], + "dataset_type": ["training"] + }, + "RandomGamma": { + "log_gamma_range": [-1.0, 1.0], + "p": 0.5, + "applied_to": ["im"], + "dataset_type": ["training"] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": ["im"], + "dataset_type": ["training"] + }, + "RandomBlur": { + "sigma_range": [0.0, 2.0], + "p": 0.3, + "applied_to": ["im"], + "dataset_type": ["training"] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": ["im"] + } + } +} \ No newline at end of file diff --git a/inference.sh b/inference.sh new file mode 100644 index 00000000..d832bb7e --- /dev/null +++ b/inference.sh @@ -0,0 +1,17 @@ +seeds=(15) # seeds=(42 15 34 98 62) +config_types=("hard_hard" "hard_soft" "meanGT_soft" "meanGT_hard") +contrasts=("T1w" "T2star" "T2w" "rec-average_dwi" "all") + +for seed in ${seeds[@]} +do + for config in ${config_types[@]} + do + for contrast in ${contrasts[@]} + do + sleep 5 + output_dir=../duke/temp/adrian/contrast-agnostic-seg-models/Group8_01-12-2022/"$config"_"$contrast"_seed="$seed"/ + echo $output_dir + CUDA_VISIBLE=0 ivadomed --test -c ../duke/temp/adrian/contrast-agnostic-seg-models/Group8_01-12-2022/"$config"_"$contrast"_seed="$seed"/config_file.json --path-output $output_dir + done + done +done From 86c6cf85e4775ed85a3aee362daa485b17f3fe54 Mon Sep 17 00:00:00 2001 From: Adrian El Baz Date: Mon, 23 Jan 2023 10:12:18 -0500 Subject: [PATCH 02/11] Inference bash script to segment test participants MRIs --- inference.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inference.sh b/inference.sh index d832bb7e..7ae10490 100644 --- a/inference.sh +++ b/inference.sh @@ -1,6 +1,6 @@ seeds=(15) # seeds=(42 15 34 98 62) config_types=("hard_hard" "hard_soft" "meanGT_soft" "meanGT_hard") -contrasts=("T1w" "T2star" "T2w" "rec-average_dwi" "all") +contrasts=("flip-1_mt-on_MTS" "flip-2_mt-off_MTS" "all") for seed in ${seeds[@]} do @@ -9,9 +9,9 @@ do for contrast in ${contrasts[@]} do sleep 5 - output_dir=../duke/temp/adrian/contrast-agnostic-seg-models/Group8_01-12-2022/"$config"_"$contrast"_seed="$seed"/ + output_dir=../duke/temp/adrian/contrast-agnostic-seg-models/Group9_20-12-2022/"$config"_"$contrast"_seed="$seed"/ echo $output_dir - CUDA_VISIBLE=0 ivadomed --test -c ../duke/temp/adrian/contrast-agnostic-seg-models/Group8_01-12-2022/"$config"_"$contrast"_seed="$seed"/config_file.json --path-output $output_dir + CUDA_VISIBLE=0 ivadomed --test -c ../duke/temp/adrian/contrast-agnostic-seg-models/Group9_20-12-2022/"$config"_"$contrast"_seed="$seed"/config_file.json --path-output $output_dir done done done From 6f2de0f0c0f42040199f9f949524d4db94234042 Mon Sep 17 00:00:00 2001 From: Adrian El Baz Date: Mon, 23 Jan 2023 10:14:24 -0500 Subject: [PATCH 03/11] Renaming training scripts --- training_scripts/acq-MTon_MTS/training_run.sh | 22 +++++++++++++++++++ training_scripts/acq-T1w_MTS/training_run.sh | 22 +++++++++++++++++++ training_scripts/all/training_run.sh | 22 +++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 training_scripts/acq-MTon_MTS/training_run.sh create mode 100644 training_scripts/acq-T1w_MTS/training_run.sh create mode 100644 training_scripts/all/training_run.sh diff --git a/training_scripts/acq-MTon_MTS/training_run.sh b/training_scripts/acq-MTon_MTS/training_run.sh new file mode 100644 index 00000000..7dc3197e --- /dev/null +++ b/training_scripts/acq-MTon_MTS/training_run.sh @@ -0,0 +1,22 @@ +####### Training Run ####### +seeds=(15) # seeds=(42 15 34 98 62) +config_types=("hard_hard" "hard_soft" "meanGT_soft" "meanGT_hard") +#contrasts=("T1w" "T2w" "T2star" "rec-average_dwi" "all") +contrasts=("flip-1_mt-on_MTS") # We can't differentiate between variants of MTS + +for seed in ${seeds[@]} +do + for config in ${config_types[@]} + do + for contrast in ${contrasts[@]} + do + sleep 5 + #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json + output_dir=./batch_results/group-9/"$config"_"$contrast"_seed="$seed" + echo $output_dir + mkdir $output_dir + #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json + CUDA_VISIBLE=0 ivadomed --train -c ./batch_configs/group-9/"$config"_"$contrast"_seed="$seed".json --path-output $output_dir + done + done +done \ No newline at end of file diff --git a/training_scripts/acq-T1w_MTS/training_run.sh b/training_scripts/acq-T1w_MTS/training_run.sh new file mode 100644 index 00000000..d6545d62 --- /dev/null +++ b/training_scripts/acq-T1w_MTS/training_run.sh @@ -0,0 +1,22 @@ +####### Training Run ####### +seeds=(15) # seeds=(42 15 34 98 62) +config_types=("hard_hard" "hard_soft" "meanGT_soft" "meanGT_hard") +#contrasts=("T1w" "T2w" "T2star" "rec-average_dwi" "all") +contrasts=("flip-2_mt-off_MTS") # We can't differentiate between variants of MTS + +for seed in ${seeds[@]} +do + for config in ${config_types[@]} + do + for contrast in ${contrasts[@]} + do + sleep 5 + #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json + output_dir=./batch_results/group-9/"$config"_"$contrast"_seed="$seed" + echo $output_dir + mkdir $output_dir + #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json + CUDA_VISIBLE=1 ivadomed --train -c ./batch_configs/group-9/"$config"_"$contrast"_seed="$seed".json --path-output $output_dir + done + done +done \ No newline at end of file diff --git a/training_scripts/all/training_run.sh b/training_scripts/all/training_run.sh new file mode 100644 index 00000000..e97e37c4 --- /dev/null +++ b/training_scripts/all/training_run.sh @@ -0,0 +1,22 @@ +####### Training Run ####### +seeds=(15) # seeds=(42 15 34 98 62) +config_types=("hard_hard" "hard_soft" "meanGT_soft" "meanGT_hard") +#contrasts=("T1w" "T2w" "T2star" "rec-average_dwi" "all") +contrasts=("all") # We can't differentiate between variants of MTS + +for seed in ${seeds[@]} +do + for config in ${config_types[@]} + do + for contrast in ${contrasts[@]} + do + sleep 5 + #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json + output_dir=./batch_results/group-9/"$config"_"$contrast"_seed="$seed" + echo $output_dir + mkdir $output_dir + #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json + CUDA_VISIBLE=2 ivadomed --train -c ./batch_configs/group-9/"$config"_"$contrast"_seed="$seed".json --path-output $output_dir + done + done +done \ No newline at end of file From 0233326c3a2237cf43d871411ece8c5a3ad636e7 Mon Sep 17 00:00:00 2001 From: Adrian El Baz Date: Mon, 23 Jan 2023 10:15:12 -0500 Subject: [PATCH 04/11] Removing old training scripts --- MTS_batch_runs/acq-MTon_MTS/training_run.sh | 22 --------------------- MTS_batch_runs/acq-T1w_MTS/training_run.sh | 22 --------------------- MTS_batch_runs/all/training_run.sh | 22 --------------------- 3 files changed, 66 deletions(-) delete mode 100644 MTS_batch_runs/acq-MTon_MTS/training_run.sh delete mode 100644 MTS_batch_runs/acq-T1w_MTS/training_run.sh delete mode 100644 MTS_batch_runs/all/training_run.sh diff --git a/MTS_batch_runs/acq-MTon_MTS/training_run.sh b/MTS_batch_runs/acq-MTon_MTS/training_run.sh deleted file mode 100644 index 7dc3197e..00000000 --- a/MTS_batch_runs/acq-MTon_MTS/training_run.sh +++ /dev/null @@ -1,22 +0,0 @@ -####### Training Run ####### -seeds=(15) # seeds=(42 15 34 98 62) -config_types=("hard_hard" "hard_soft" "meanGT_soft" "meanGT_hard") -#contrasts=("T1w" "T2w" "T2star" "rec-average_dwi" "all") -contrasts=("flip-1_mt-on_MTS") # We can't differentiate between variants of MTS - -for seed in ${seeds[@]} -do - for config in ${config_types[@]} - do - for contrast in ${contrasts[@]} - do - sleep 5 - #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json - output_dir=./batch_results/group-9/"$config"_"$contrast"_seed="$seed" - echo $output_dir - mkdir $output_dir - #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json - CUDA_VISIBLE=0 ivadomed --train -c ./batch_configs/group-9/"$config"_"$contrast"_seed="$seed".json --path-output $output_dir - done - done -done \ No newline at end of file diff --git a/MTS_batch_runs/acq-T1w_MTS/training_run.sh b/MTS_batch_runs/acq-T1w_MTS/training_run.sh deleted file mode 100644 index d6545d62..00000000 --- a/MTS_batch_runs/acq-T1w_MTS/training_run.sh +++ /dev/null @@ -1,22 +0,0 @@ -####### Training Run ####### -seeds=(15) # seeds=(42 15 34 98 62) -config_types=("hard_hard" "hard_soft" "meanGT_soft" "meanGT_hard") -#contrasts=("T1w" "T2w" "T2star" "rec-average_dwi" "all") -contrasts=("flip-2_mt-off_MTS") # We can't differentiate between variants of MTS - -for seed in ${seeds[@]} -do - for config in ${config_types[@]} - do - for contrast in ${contrasts[@]} - do - sleep 5 - #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json - output_dir=./batch_results/group-9/"$config"_"$contrast"_seed="$seed" - echo $output_dir - mkdir $output_dir - #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json - CUDA_VISIBLE=1 ivadomed --train -c ./batch_configs/group-9/"$config"_"$contrast"_seed="$seed".json --path-output $output_dir - done - done -done \ No newline at end of file diff --git a/MTS_batch_runs/all/training_run.sh b/MTS_batch_runs/all/training_run.sh deleted file mode 100644 index e97e37c4..00000000 --- a/MTS_batch_runs/all/training_run.sh +++ /dev/null @@ -1,22 +0,0 @@ -####### Training Run ####### -seeds=(15) # seeds=(42 15 34 98 62) -config_types=("hard_hard" "hard_soft" "meanGT_soft" "meanGT_hard") -#contrasts=("T1w" "T2w" "T2star" "rec-average_dwi" "all") -contrasts=("all") # We can't differentiate between variants of MTS - -for seed in ${seeds[@]} -do - for config in ${config_types[@]} - do - for contrast in ${contrasts[@]} - do - sleep 5 - #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json - output_dir=./batch_results/group-9/"$config"_"$contrast"_seed="$seed" - echo $output_dir - mkdir $output_dir - #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json - CUDA_VISIBLE=2 ivadomed --train -c ./batch_configs/group-9/"$config"_"$contrast"_seed="$seed".json --path-output $output_dir - done - done -done \ No newline at end of file From 8dd311b338803f9c731364270c5d89f880ae3f88 Mon Sep 17 00:00:00 2001 From: Adrian El Baz Date: Mon, 23 Jan 2023 10:38:35 -0500 Subject: [PATCH 05/11] Adding a few details about Training --- README.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dc344b44..04b27a81 100644 --- a/README.md +++ b/README.md @@ -80,9 +80,27 @@ Re-run the analysis: [Launch processing](#launch-processing) ## Training -### create_training_joblib.py -The function creates a joblib that allocates data from the testing set of the SCT model to the testing set of the ivadomed model. The output (new_splits.joblib) needs to be assigned on the config.json in the field "split_dataset": {"fname_split": new_splits.joblib"}. -Multiple datasets (BIDS folders) can be used as input for the creation of the joblib. The same list should be assigned on the config.json file in the path_data field. +### config_generator.py +The script helps create joblibs that are going to represent splits of our dataset. It will create a joblibs folder containing the data split for each sub-experiment (i.e. hard_hard, soft_soft ...). The way we leverage the aforementioned python script is by running the bash script generate_config.sh that will execute the following command for each sub-experiment: +``` +python config_generator.py --config config_templates/hard_hard.json \ + --datasets path/to/data + --ofolder path/to/joblib \ + --contrasts T1w T2w T2star rec-average_dwi \ + --seeds 15 +``` +in which one has to specify the config template for the sub-experiment, the dataset path, the joblibs output folder, the contrasts used for the experiment and the random generation seed(s) respectively. + +### training_scripts +Once the joblibs describing how the data is split are generated, one can start training the different models within a sub-experiment. Notice that there are 3 folders in training_scripts, 2 of them are related to a specific MTS contrast and the last one is used to train models with the other contrasts. This flaw is due to the incompatibility of ivadomed's dataloader dealing with MTS contrasts properly, at the time of writing. We expect to address this problem in the next months so we can have a single bash script executing all the training experiments smoothly. +For clarity, we go over a few examples about how to use the current training scripts. +1. One wants to train MTS contrast-specific models. Then choose the right MTS contrast acq-MTon_MTS or acq-T1w_MTS and run the associated bash script. +2. One wants to train contrast-specific (without MTS) models AND generalist models (including MTS) then run the bash script in training_scripts/all/training_run.sh. + +All training runs are using the ivadomed's framework and logging training metrics in a results folder (optionally with wandb). + +### inference.sh +Once the models are trained, one can use the inference.sh bash script to segment SC for tests participants and qualitatively analyze the results. Again like in all bash scripts mentioned in this project, one has to change a few parameters to adapt to one's environment (e.g. dataset path ...). ### compare_with_sct_model.py From b19867d34ffc86fe5af6b872967e001eadc802df Mon Sep 17 00:00:00 2001 From: Adrian EL BAZ Date: Thu, 9 Mar 2023 14:48:20 -0500 Subject: [PATCH 06/11] Removing old config files and adding Miccai2023 experiment config files --- config/contrast-specific/seg_sc_all.json | 146 ----------- config/contrast-specific/seg_sc_t1w.json | 147 ----------- config/contrast-specific/seg_sc_t2star.json | 147 ----------- config/contrast-specific/seg_sc_t2w.json | 147 ----------- config/miccai2023/hard_hard_T1w_seed=15.json | 235 +++++++++++++++++ .../miccai2023/hard_hard_T2star_seed=15.json | 235 +++++++++++++++++ config/miccai2023/hard_hard_T2w_seed=15.json | 235 +++++++++++++++++ config/miccai2023/hard_hard_all_seed=15.json | 243 +++++++++++++++++ .../hard_hard_flip-1_mt-on_MTS_seed=15.json | 235 +++++++++++++++++ .../hard_hard_flip-2_mt-off_MTS_seed=15.json | 235 +++++++++++++++++ .../hard_hard_rec-average_dwi_seed=15.json | 235 +++++++++++++++++ config/miccai2023/hard_soft_T1w_seed=15.json | 239 +++++++++++++++++ .../miccai2023/hard_soft_T2star_seed=15.json | 239 +++++++++++++++++ config/miccai2023/hard_soft_T2w_seed=15.json | 239 +++++++++++++++++ config/miccai2023/hard_soft_all_seed=15.json | 247 ++++++++++++++++++ .../hard_soft_flip-1_mt-on_MTS_seed=15.json | 239 +++++++++++++++++ .../hard_soft_flip-2_mt-off_MTS_seed=15.json | 239 +++++++++++++++++ .../hard_soft_rec-average_dwi_seed=15.json | 239 +++++++++++++++++ .../miccai2023/meanGT_hard_T1w_seed=15.json | 235 +++++++++++++++++ .../meanGT_hard_T2star_seed=15.json | 235 +++++++++++++++++ .../miccai2023/meanGT_hard_T2w_seed=15.json | 235 +++++++++++++++++ .../miccai2023/meanGT_hard_all_seed=15.json | 243 +++++++++++++++++ .../meanGT_hard_flip-1_mt-on_MTS_seed=15.json | 235 +++++++++++++++++ ...meanGT_hard_flip-2_mt-off_MTS_seed=15.json | 235 +++++++++++++++++ .../meanGT_hard_rec-average_dwi_seed=15.json | 235 +++++++++++++++++ .../miccai2023/meanGT_soft_T1w_seed=15.json | 239 +++++++++++++++++ .../meanGT_soft_T2star_seed=15.json | 239 +++++++++++++++++ .../miccai2023/meanGT_soft_T2w_seed=15.json | 239 +++++++++++++++++ .../miccai2023/meanGT_soft_all_seed=15.json | 247 ++++++++++++++++++ .../meanGT_soft_flip-1_mt-on_MTS_seed=15.json | 239 +++++++++++++++++ ...meanGT_soft_flip-2_mt-off_MTS_seed=15.json | 239 +++++++++++++++++ .../meanGT_soft_rec-average_dwi_seed=15.json | 239 +++++++++++++++++ config/super-duper/seg_sc_all.json | 146 ----------- config/super-duper/seg_sc_t1w.json | 147 ----------- config/super-duper/seg_sc_t2star.json | 147 ----------- config/super-duper/seg_sc_t2w.json | 147 ----------- 36 files changed, 6668 insertions(+), 1174 deletions(-) delete mode 100644 config/contrast-specific/seg_sc_all.json delete mode 100644 config/contrast-specific/seg_sc_t1w.json delete mode 100644 config/contrast-specific/seg_sc_t2star.json delete mode 100644 config/contrast-specific/seg_sc_t2w.json create mode 100644 config/miccai2023/hard_hard_T1w_seed=15.json create mode 100644 config/miccai2023/hard_hard_T2star_seed=15.json create mode 100644 config/miccai2023/hard_hard_T2w_seed=15.json create mode 100644 config/miccai2023/hard_hard_all_seed=15.json create mode 100644 config/miccai2023/hard_hard_flip-1_mt-on_MTS_seed=15.json create mode 100644 config/miccai2023/hard_hard_flip-2_mt-off_MTS_seed=15.json create mode 100644 config/miccai2023/hard_hard_rec-average_dwi_seed=15.json create mode 100644 config/miccai2023/hard_soft_T1w_seed=15.json create mode 100644 config/miccai2023/hard_soft_T2star_seed=15.json create mode 100644 config/miccai2023/hard_soft_T2w_seed=15.json create mode 100644 config/miccai2023/hard_soft_all_seed=15.json create mode 100644 config/miccai2023/hard_soft_flip-1_mt-on_MTS_seed=15.json create mode 100644 config/miccai2023/hard_soft_flip-2_mt-off_MTS_seed=15.json create mode 100644 config/miccai2023/hard_soft_rec-average_dwi_seed=15.json create mode 100644 config/miccai2023/meanGT_hard_T1w_seed=15.json create mode 100644 config/miccai2023/meanGT_hard_T2star_seed=15.json create mode 100644 config/miccai2023/meanGT_hard_T2w_seed=15.json create mode 100644 config/miccai2023/meanGT_hard_all_seed=15.json create mode 100644 config/miccai2023/meanGT_hard_flip-1_mt-on_MTS_seed=15.json create mode 100644 config/miccai2023/meanGT_hard_flip-2_mt-off_MTS_seed=15.json create mode 100644 config/miccai2023/meanGT_hard_rec-average_dwi_seed=15.json create mode 100644 config/miccai2023/meanGT_soft_T1w_seed=15.json create mode 100644 config/miccai2023/meanGT_soft_T2star_seed=15.json create mode 100644 config/miccai2023/meanGT_soft_T2w_seed=15.json create mode 100644 config/miccai2023/meanGT_soft_all_seed=15.json create mode 100644 config/miccai2023/meanGT_soft_flip-1_mt-on_MTS_seed=15.json create mode 100644 config/miccai2023/meanGT_soft_flip-2_mt-off_MTS_seed=15.json create mode 100644 config/miccai2023/meanGT_soft_rec-average_dwi_seed=15.json delete mode 100644 config/super-duper/seg_sc_all.json delete mode 100644 config/super-duper/seg_sc_t1w.json delete mode 100644 config/super-duper/seg_sc_t2star.json delete mode 100644 config/super-duper/seg_sc_t2w.json diff --git a/config/contrast-specific/seg_sc_all.json b/config/contrast-specific/seg_sc_all.json deleted file mode 100644 index 62edfe8d..00000000 --- a/config/contrast-specific/seg_sc_all.json +++ /dev/null @@ -1,146 +0,0 @@ -{ - "command": "train", - "gpu_ids": [0], - "path_output": "contrast_specific_seg_sc_all_output", - "model_name": "contrast_specific_seg_sc_all_model", - "debugging": true, - "object_detection_params": { - "object_detection_path": null, - "safety_factor": [1.0, 1.0, 1.0] - }, - "loader_parameters": { - "path_data": ["spine-generic-processed"], - "subject_selection": { - "n": [], - "metadata": [], - "value": [] - }, - "target_suffix": ["_seg-manual"], - "extensions": [".nii.gz"], - "roi_params": { - "suffix": null, - "slice_filter_roi": null - }, - "contrast_params": { - "training_validation": ["T1w", "T2w", "T2star"], - "testing": ["T1w", "T2w", "T2star"], - "balance": {} - }, - "patch_filter_params": { - "filter_empty_mask": true, - "filter_empty_input": true - }, - "slice_axis": "axial", - "multichannel": false, - "soft_gt": false - }, - "split_dataset": { - "fname_split": "super_duper_seg_sc_all_output/split_datasets.joblib", - "random_seed": 42, - "center_test": [], - "method": "per_patient", - "balance": null, - "train_fraction": 0.6, - "test_fraction": 0.2 - }, - "training_parameters": { - "batch_size": 2, - "loss": { - "name": "DiceLoss" - }, - "training_time": { - "num_epochs": 100, - "early_stopping_patience": 25, - "early_stopping_epsilon": 0.001 - }, - "scheduler": { - "initial_lr": 1e-3, - "lr_scheduler": { - "name": "CosineAnnealingLR", - "base_lr": 1e-5, - "max_lr": 1e-3 - } - }, - "balance_samples": { - "applied": false, - "type": "gt" - }, - "mixup_alpha": null, - "transfer_learning": { - "retrain_model": null, - "retrain_fraction": 1.0, - "reset": true - } - }, - "default_model": { - "name": "Unet", - "dropout_rate": 0.3, - "bn_momentum": 0.1, - "depth": 4, - "is_2d": false, - "final_activation": "sigmoid" - }, - "Modified3DUNet": { - "applied": true, - "length_3D": [224, 256, 320], - "stride_3D": [224, 256, 320], - "attention": false, - "n_filters": 8 - }, - "uncertainty": { - "epistemic": false, - "aleatoric": false, - "n_it": 0 - }, - "postprocessing": { - "binarize_prediction": {"thr": 0.5} - }, - "evaluation_parameters": {}, - "transformation": { - "Resample": { - "hspace": 1, - "wspace": 1, - "dspace": 1 - }, - "CenterCrop": { - "size": [224, 256, 320] - }, - "RandomAffine": { - "degrees": 10, - "scale": [0.2, 0.2, 0.2], - "translate": [0.0, 0.0, 0.0], - "applied_to": ["im", "gt"], - "dataset_type": ["training"] - }, - "ElasticTransform": { - "alpha_range": [25.0, 35.0], - "sigma_range": [3.5, 5.5], - "p": 0.5, - "applied_to": ["im", "gt"], - "dataset_type": ["training"] - }, - "RandomGamma": { - "log_gamma_range": [-1.0, 1.0], - "p": 0.5, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "RandomBiasField": { - "coefficients": 0.5, - "order": 3, - "p": 0.3, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "RandomBlur": { - "sigma_range": [0.0, 2.0], - "p": 0.3, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "NumpyToTensor": {}, - "NormalizeInstance": { - "applied_to": ["im"] - } - } -} \ No newline at end of file diff --git a/config/contrast-specific/seg_sc_t1w.json b/config/contrast-specific/seg_sc_t1w.json deleted file mode 100644 index 2d82afe7..00000000 --- a/config/contrast-specific/seg_sc_t1w.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "command": "train", - "gpu_ids": [0], - "path_output": "contrast_specific_seg_sc_t1w_output", - "model_name": "contrast_specific_seg_sc_t1w_model", - "debugging": true, - "object_detection_params": { - "object_detection_path": null, - "safety_factor": [1.0, 1.0, 1.0] - }, - "loader_parameters": { - "path_data": ["spine-generic-processed"], - "subject_selection": { - "n": [], - "metadata": [], - "value": [] - }, - "target_suffix": ["_seg-manual"], - "extensions": [".nii.gz"], - "roi_params": { - "suffix": null, - "slice_filter_roi": null - }, - "contrast_params": { - "training_validation": ["T1w"], - "testing": ["T1w"], - "balance": {} - }, - "patch_filter_params": { - "filter_empty_mask": true, - "filter_empty_input": true - }, - "slice_axis": "axial", - "multichannel": false, - "soft_gt": false - }, - "split_dataset": { - "fname_split": "super_duper_seg_sc_t1w_output/split_datasets.joblib", - "random_seed": 42, - "center_test": [], - "method": "per_patient", - "balance": null, - "train_fraction": 0.6, - "test_fraction": 0.2 - }, - "training_parameters": { - "batch_size": 2, - "loss": { - "name": "DiceLoss" - }, - "training_time": { - "num_epochs": 100, - "early_stopping_patience": 25, - "early_stopping_epsilon": 0.001 - }, - "scheduler": { - "initial_lr": 1e-3, - "lr_scheduler": { - "name": "CosineAnnealingLR", - "base_lr": 1e-5, - "max_lr": 1e-3 - } - }, - "balance_samples": { - "applied": false, - "type": "gt" - }, - "mixup_alpha": null, - "transfer_learning": { - "retrain_model": null, - "retrain_fraction": 1.0, - "reset": true - } - }, - "default_model": { - "name": "Unet", - "dropout_rate": 0.3, - "bn_momentum": 0.1, - "depth": 4, - "is_2d": false, - "final_activation": "sigmoid" - }, - "Modified3DUNet": { - "applied": true, - "length_3D": [224, 256, 320], - "stride_3D": [224, 256, 320], - "attention": false, - "n_filters": 8 - }, - "uncertainty": { - "epistemic": false, - "aleatoric": false, - "n_it": 0 - }, - "postprocessing": { - "binarize_prediction": {"thr": 0.5} - }, - "evaluation_parameters": {}, - "transformation": { - "Resample": - { - "hspace": 1, - "wspace": 1, - "dspace": 1 - }, - "CenterCrop": { - "size": [224, 256, 320] - }, - "RandomAffine": { - "degrees": 10, - "scale": [0.2, 0.2, 0.2], - "translate": [0.0, 0.0, 0.0], - "applied_to": ["im", "gt"], - "dataset_type": ["training"] - }, - "ElasticTransform": { - "alpha_range": [25.0, 35.0], - "sigma_range": [3.5, 5.5], - "p": 0.5, - "applied_to": ["im", "gt"], - "dataset_type": ["training"] - }, - "RandomGamma": { - "log_gamma_range": [-1.0, 1.0], - "p": 0.5, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "RandomBiasField": { - "coefficients": 0.5, - "order": 3, - "p": 0.3, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "RandomBlur": { - "sigma_range": [0.0, 2.0], - "p": 0.3, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "NumpyToTensor": {}, - "NormalizeInstance": { - "applied_to": ["im"] - } - } -} \ No newline at end of file diff --git a/config/contrast-specific/seg_sc_t2star.json b/config/contrast-specific/seg_sc_t2star.json deleted file mode 100644 index f130b70a..00000000 --- a/config/contrast-specific/seg_sc_t2star.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "command": "train", - "gpu_ids": [0], - "path_output": "contrast_specific_seg_sc_t2star_output", - "model_name": "contrast_specific_seg_sc_t2star_model", - "debugging": true, - "object_detection_params": { - "object_detection_path": null, - "safety_factor": [1.0, 1.0, 1.0] - }, - "loader_parameters": { - "path_data": ["spine-generic-processed"], - "subject_selection": { - "n": [], - "metadata": [], - "value": [] - }, - "target_suffix": ["_seg-manual"], - "extensions": [".nii.gz"], - "roi_params": { - "suffix": null, - "slice_filter_roi": null - }, - "contrast_params": { - "training_validation": ["T2star"], - "testing": ["T2star"], - "balance": {} - }, - "patch_filter_params": { - "filter_empty_mask": true, - "filter_empty_input": true - }, - "slice_axis": "axial", - "multichannel": false, - "soft_gt": false - }, - "split_dataset": { - "fname_split": "super_duper_seg_sc_t2star_output/split_datasets.joblib", - "random_seed": 42, - "center_test": [], - "method": "per_patient", - "balance": null, - "train_fraction": 0.6, - "test_fraction": 0.2 - }, - "training_parameters": { - "batch_size": 2, - "loss": { - "name": "DiceLoss" - }, - "training_time": { - "num_epochs": 100, - "early_stopping_patience": 25, - "early_stopping_epsilon": 0.001 - }, - "scheduler": { - "initial_lr": 1e-3, - "lr_scheduler": { - "name": "CosineAnnealingLR", - "base_lr": 1e-5, - "max_lr": 1e-3 - } - }, - "balance_samples": { - "applied": false, - "type": "gt" - }, - "mixup_alpha": null, - "transfer_learning": { - "retrain_model": null, - "retrain_fraction": 1.0, - "reset": true - } - }, - "default_model": { - "name": "Unet", - "dropout_rate": 0.3, - "bn_momentum": 0.1, - "depth": 4, - "is_2d": false, - "final_activation": "sigmoid" - }, - "Modified3DUNet": { - "applied": true, - "length_3D": [224, 256, 320], - "stride_3D": [224, 256, 320], - "attention": false, - "n_filters": 8 - }, - "uncertainty": { - "epistemic": false, - "aleatoric": false, - "n_it": 0 - }, - "postprocessing": { - "binarize_prediction": {"thr": 0.5} - }, - "evaluation_parameters": {}, - "transformation": { - "Resample": - { - "hspace": 1, - "wspace": 1, - "dspace": 1 - }, - "CenterCrop": { - "size": [224, 256, 320] - }, - "RandomAffine": { - "degrees": 10, - "scale": [0.2, 0.2, 0.2], - "translate": [0.0, 0.0, 0.0], - "applied_to": ["im", "gt"], - "dataset_type": ["training"] - }, - "ElasticTransform": { - "alpha_range": [25.0, 35.0], - "sigma_range": [3.5, 5.5], - "p": 0.5, - "applied_to": ["im", "gt"], - "dataset_type": ["training"] - }, - "RandomGamma": { - "log_gamma_range": [-1.0, 1.0], - "p": 0.5, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "RandomBiasField": { - "coefficients": 0.5, - "order": 3, - "p": 0.3, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "RandomBlur": { - "sigma_range": [0.0, 2.0], - "p": 0.3, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "NumpyToTensor": {}, - "NormalizeInstance": { - "applied_to": ["im"] - } - } -} \ No newline at end of file diff --git a/config/contrast-specific/seg_sc_t2w.json b/config/contrast-specific/seg_sc_t2w.json deleted file mode 100644 index aa227486..00000000 --- a/config/contrast-specific/seg_sc_t2w.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "command": "train", - "gpu_ids": [0], - "path_output": "contrast_specific_seg_sc_t2w_output", - "model_name": "contrast_specific_seg_sc_t2w_model", - "debugging": true, - "object_detection_params": { - "object_detection_path": null, - "safety_factor": [1.0, 1.0, 1.0] - }, - "loader_parameters": { - "path_data": ["spine-generic-processed"], - "subject_selection": { - "n": [], - "metadata": [], - "value": [] - }, - "target_suffix": ["_seg-manual"], - "extensions": [".nii.gz"], - "roi_params": { - "suffix": null, - "slice_filter_roi": null - }, - "contrast_params": { - "training_validation": ["T2w"], - "testing": ["T2w"], - "balance": {} - }, - "patch_filter_params": { - "filter_empty_mask": true, - "filter_empty_input": true - }, - "slice_axis": "axial", - "multichannel": false, - "soft_gt": false - }, - "split_dataset": { - "fname_split": "super_duper_seg_sc_t2w_output/split_datasets.joblib", - "random_seed": 42, - "center_test": [], - "method": "per_patient", - "balance": null, - "train_fraction": 0.6, - "test_fraction": 0.2 - }, - "training_parameters": { - "batch_size": 2, - "loss": { - "name": "DiceLoss" - }, - "training_time": { - "num_epochs": 100, - "early_stopping_patience": 25, - "early_stopping_epsilon": 0.001 - }, - "scheduler": { - "initial_lr": 1e-3, - "lr_scheduler": { - "name": "CosineAnnealingLR", - "base_lr": 1e-5, - "max_lr": 1e-3 - } - }, - "balance_samples": { - "applied": false, - "type": "gt" - }, - "mixup_alpha": null, - "transfer_learning": { - "retrain_model": null, - "retrain_fraction": 1.0, - "reset": true - } - }, - "default_model": { - "name": "Unet", - "dropout_rate": 0.3, - "bn_momentum": 0.1, - "depth": 4, - "is_2d": false, - "final_activation": "sigmoid" - }, - "Modified3DUNet": { - "applied": true, - "length_3D": [224, 256, 320], - "stride_3D": [224, 256, 320], - "attention": false, - "n_filters": 8 - }, - "uncertainty": { - "epistemic": false, - "aleatoric": false, - "n_it": 0 - }, - "postprocessing": { - "binarize_prediction": {"thr": 0.5} - }, - "evaluation_parameters": {}, - "transformation": { - "Resample": - { - "hspace": 1, - "wspace": 1, - "dspace": 1 - }, - "CenterCrop": { - "size": [224, 256, 320] - }, - "RandomAffine": { - "degrees": 10, - "scale": [0.2, 0.2, 0.2], - "translate": [0.0, 0.0, 0.0], - "applied_to": ["im", "gt"], - "dataset_type": ["training"] - }, - "ElasticTransform": { - "alpha_range": [25.0, 35.0], - "sigma_range": [3.5, 5.5], - "p": 0.5, - "applied_to": ["im", "gt"], - "dataset_type": ["training"] - }, - "RandomGamma": { - "log_gamma_range": [-1.0, 1.0], - "p": 0.5, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "RandomBiasField": { - "coefficients": 0.5, - "order": 3, - "p": 0.3, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "RandomBlur": { - "sigma_range": [0.0, 2.0], - "p": 0.3, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "NumpyToTensor": {}, - "NormalizeInstance": { - "applied_to": ["im"] - } - } -} \ No newline at end of file diff --git a/config/miccai2023/hard_hard_T1w_seed=15.json b/config/miccai2023/hard_hard_T1w_seed=15.json new file mode 100644 index 00000000..9577f9e8 --- /dev/null +++ b/config/miccai2023/hard_hard_T1w_seed=15.json @@ -0,0 +1,235 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "hard_hard_T1w_seed=15", + "model_name": "hard_hard_T1w_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "hard_hard_T1w_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_seg-manual" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "T1w" + ], + "testing": [ + "T1w" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": false + }, + "split_dataset": { + "fname_split": "joblibs/group-8/split_datasets_T1w_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "DiceLoss" + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "sigmoid" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": 0.5 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/hard_hard_T2star_seed=15.json b/config/miccai2023/hard_hard_T2star_seed=15.json new file mode 100644 index 00000000..4a989238 --- /dev/null +++ b/config/miccai2023/hard_hard_T2star_seed=15.json @@ -0,0 +1,235 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "hard_hard_T2star_seed=15", + "model_name": "hard_hard_T2star_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "hard_hard_T2star_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_seg-manual" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "T2star" + ], + "testing": [ + "T2star" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": false + }, + "split_dataset": { + "fname_split": "joblibs/group-8/split_datasets_T2star_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "DiceLoss" + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "sigmoid" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": 0.5 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/hard_hard_T2w_seed=15.json b/config/miccai2023/hard_hard_T2w_seed=15.json new file mode 100644 index 00000000..20405275 --- /dev/null +++ b/config/miccai2023/hard_hard_T2w_seed=15.json @@ -0,0 +1,235 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "hard_hard_T2w_seed=15", + "model_name": "hard_hard_T2w_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "hard_hard_T2w_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_seg-manual" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "T2w" + ], + "testing": [ + "T2w" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": false + }, + "split_dataset": { + "fname_split": "joblibs/group-8/split_datasets_T2w_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "DiceLoss" + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "sigmoid" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": 0.5 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/hard_hard_all_seed=15.json b/config/miccai2023/hard_hard_all_seed=15.json new file mode 100644 index 00000000..4b84c959 --- /dev/null +++ b/config/miccai2023/hard_hard_all_seed=15.json @@ -0,0 +1,243 @@ +{ + "command": "train", + "gpu_ids": [ + 2 + ], + "path_output": "hard_hard_all_seed=15", + "model_name": "hard_hard_all_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-9", + "run_name": "hard_hard_all_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/temp/adrian/contrast-agnostic-seg-models/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_seg-manual" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "T1w", + "T2w", + "T2star", + "dwi", + "MTS" + ], + "testing": [ + "T1w", + "T2w", + "T2star", + "dwi", + "MTS" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": false + }, + "split_dataset": { + "fname_split": "joblibs/MTS/all/split_datasets_all_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "DiceLoss" + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "sigmoid" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": 0.5 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/hard_hard_flip-1_mt-on_MTS_seed=15.json b/config/miccai2023/hard_hard_flip-1_mt-on_MTS_seed=15.json new file mode 100644 index 00000000..31b51565 --- /dev/null +++ b/config/miccai2023/hard_hard_flip-1_mt-on_MTS_seed=15.json @@ -0,0 +1,235 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "hard_hard_flip-1_mt-on_MTS_seed=15", + "model_name": "hard_hard_flip-1_mt-on_MTS_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-9", + "run_name": "hard_hard_flip-1_mt-on_MTS_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/temp/adrian/contrast-agnostic-seg-models/data_processed_clean_MTon_MTS" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_seg-manual" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "MTS" + ], + "testing": [ + "MTS" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": false + }, + "split_dataset": { + "fname_split": "joblibs/tests/split_datasets_flip-1_mt-on_MTS_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "DiceLoss" + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "sigmoid" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": 0.5 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/hard_hard_flip-2_mt-off_MTS_seed=15.json b/config/miccai2023/hard_hard_flip-2_mt-off_MTS_seed=15.json new file mode 100644 index 00000000..ede03161 --- /dev/null +++ b/config/miccai2023/hard_hard_flip-2_mt-off_MTS_seed=15.json @@ -0,0 +1,235 @@ +{ + "command": "train", + "gpu_ids": [ + 1 + ], + "path_output": "hard_hard_flip-2_mt-off_MTS_seed=15", + "model_name": "hard_hard_flip-2_mt-off_MTS_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-9", + "run_name": "hard_hard_flip-2_mt-off_MTS_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/temp/adrian/contrast-agnostic-seg-models/data_processed_clean_T1w_MTS" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_seg-manual" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "MTS" + ], + "testing": [ + "MTS" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": false + }, + "split_dataset": { + "fname_split": "joblibs/MTS/T1w_MTS/split_datasets_flip-2_mt-off_MTS_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "DiceLoss" + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "sigmoid" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": 0.5 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/hard_hard_rec-average_dwi_seed=15.json b/config/miccai2023/hard_hard_rec-average_dwi_seed=15.json new file mode 100644 index 00000000..e39286a5 --- /dev/null +++ b/config/miccai2023/hard_hard_rec-average_dwi_seed=15.json @@ -0,0 +1,235 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "hard_hard_rec-average_dwi_seed=15", + "model_name": "hard_hard_rec-average_dwi_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "hard_hard_rec-average_dwi_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_seg-manual" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "dwi" + ], + "testing": [ + "dwi" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": false + }, + "split_dataset": { + "fname_split": "joblibs/group-8/split_datasets_rec-average_dwi_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "DiceLoss" + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "sigmoid" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": 0.5 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/hard_soft_T1w_seed=15.json b/config/miccai2023/hard_soft_T1w_seed=15.json new file mode 100644 index 00000000..42807bf7 --- /dev/null +++ b/config/miccai2023/hard_soft_T1w_seed=15.json @@ -0,0 +1,239 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "hard_soft_T1w_seed=15", + "model_name": "hard_soft_T1w_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "hard_soft_T1w_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_seg-manual" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "T1w" + ], + "testing": [ + "T1w" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/group-8/split_datasets_T1w_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "AdapWingLoss", + "epsilon": 1, + "theta": 0.5, + "omega": 8, + "alpha": 2.1 + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "relu" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": -1 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/hard_soft_T2star_seed=15.json b/config/miccai2023/hard_soft_T2star_seed=15.json new file mode 100644 index 00000000..5d5aa7e7 --- /dev/null +++ b/config/miccai2023/hard_soft_T2star_seed=15.json @@ -0,0 +1,239 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "hard_soft_T2star_seed=15", + "model_name": "hard_soft_T2star_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "hard_soft_T2star_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_seg-manual" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "T2star" + ], + "testing": [ + "T2star" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/group-8/split_datasets_T2star_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "AdapWingLoss", + "epsilon": 1, + "theta": 0.5, + "omega": 8, + "alpha": 2.1 + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "relu" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": -1 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/hard_soft_T2w_seed=15.json b/config/miccai2023/hard_soft_T2w_seed=15.json new file mode 100644 index 00000000..af46d854 --- /dev/null +++ b/config/miccai2023/hard_soft_T2w_seed=15.json @@ -0,0 +1,239 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "hard_soft_T2w_seed=15", + "model_name": "hard_soft_T2w_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "hard_soft_T2w_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_seg-manual" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "T2w" + ], + "testing": [ + "T2w" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/group-8/split_datasets_T2w_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "AdapWingLoss", + "epsilon": 1, + "theta": 0.5, + "omega": 8, + "alpha": 2.1 + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "relu" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": -1 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/hard_soft_all_seed=15.json b/config/miccai2023/hard_soft_all_seed=15.json new file mode 100644 index 00000000..507399ac --- /dev/null +++ b/config/miccai2023/hard_soft_all_seed=15.json @@ -0,0 +1,247 @@ +{ + "command": "train", + "gpu_ids": [ + 2 + ], + "path_output": "hard_soft_all_seed=15", + "model_name": "hard_soft_all_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-9", + "run_name": "hard_soft_all_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/temp/adrian/contrast-agnostic-seg-models/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_seg-manual" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "T1w", + "T2w", + "T2star", + "dwi", + "MTS" + ], + "testing": [ + "T1w", + "T2w", + "T2star", + "dwi", + "MTS" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/MTS/all/split_datasets_all_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "AdapWingLoss", + "epsilon": 1, + "theta": 0.5, + "omega": 8, + "alpha": 2.1 + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "relu" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": -1 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/hard_soft_flip-1_mt-on_MTS_seed=15.json b/config/miccai2023/hard_soft_flip-1_mt-on_MTS_seed=15.json new file mode 100644 index 00000000..50a0117c --- /dev/null +++ b/config/miccai2023/hard_soft_flip-1_mt-on_MTS_seed=15.json @@ -0,0 +1,239 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "hard_soft_flip-1_mt-on_MTS_seed=15", + "model_name": "hard_soft_flip-1_mt-on_MTS_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-9", + "run_name": "hard_soft_flip-1_mt-on_MTS_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/temp/adrian/contrast-agnostic-seg-models/data_processed_clean_MTon_MTS" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_seg-manual" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "MTS" + ], + "testing": [ + "MTS" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/tests/split_datasets_flip-1_mt-on_MTS_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "AdapWingLoss", + "epsilon": 1, + "theta": 0.5, + "omega": 8, + "alpha": 2.1 + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "relu" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": -1 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/hard_soft_flip-2_mt-off_MTS_seed=15.json b/config/miccai2023/hard_soft_flip-2_mt-off_MTS_seed=15.json new file mode 100644 index 00000000..12e23c68 --- /dev/null +++ b/config/miccai2023/hard_soft_flip-2_mt-off_MTS_seed=15.json @@ -0,0 +1,239 @@ +{ + "command": "train", + "gpu_ids": [ + 1 + ], + "path_output": "hard_soft_flip-2_mt-off_MTS_seed=15", + "model_name": "hard_soft_flip-2_mt-off_MTS_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-9", + "run_name": "hard_soft_flip-2_mt-off_MTS_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/temp/adrian/contrast-agnostic-seg-models/data_processed_clean_T1w_MTS" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_seg-manual" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "MTS" + ], + "testing": [ + "MTS" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/MTS/T1w_MTS/split_datasets_flip-2_mt-off_MTS_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "AdapWingLoss", + "epsilon": 1, + "theta": 0.5, + "omega": 8, + "alpha": 2.1 + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "relu" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": -1 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/hard_soft_rec-average_dwi_seed=15.json b/config/miccai2023/hard_soft_rec-average_dwi_seed=15.json new file mode 100644 index 00000000..7ea045c4 --- /dev/null +++ b/config/miccai2023/hard_soft_rec-average_dwi_seed=15.json @@ -0,0 +1,239 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "hard_soft_rec-average_dwi_seed=15", + "model_name": "hard_soft_rec-average_dwi_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "hard_soft_rec-average_dwi_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_seg-manual" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "dwi" + ], + "testing": [ + "dwi" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/group-8/split_datasets_rec-average_dwi_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "AdapWingLoss", + "epsilon": 1, + "theta": 0.5, + "omega": 8, + "alpha": 2.1 + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "relu" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": -1 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/meanGT_hard_T1w_seed=15.json b/config/miccai2023/meanGT_hard_T1w_seed=15.json new file mode 100644 index 00000000..4fe45096 --- /dev/null +++ b/config/miccai2023/meanGT_hard_T1w_seed=15.json @@ -0,0 +1,235 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "meanGT_hard_T1w_seed=15", + "model_name": "meanGT_hard_T1w_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "meanGT_hard_T1w_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_softseg" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "T1w" + ], + "testing": [ + "T1w" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/group-8/split_datasets_T1w_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "DiceLoss" + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "sigmoid" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": 0.5 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/meanGT_hard_T2star_seed=15.json b/config/miccai2023/meanGT_hard_T2star_seed=15.json new file mode 100644 index 00000000..fc29ce72 --- /dev/null +++ b/config/miccai2023/meanGT_hard_T2star_seed=15.json @@ -0,0 +1,235 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "meanGT_hard_T2star_seed=15", + "model_name": "meanGT_hard_T2star_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "meanGT_hard_T2star_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_softseg" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "T2star" + ], + "testing": [ + "T2star" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/group-8/split_datasets_T2star_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "DiceLoss" + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "sigmoid" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": 0.5 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/meanGT_hard_T2w_seed=15.json b/config/miccai2023/meanGT_hard_T2w_seed=15.json new file mode 100644 index 00000000..69399967 --- /dev/null +++ b/config/miccai2023/meanGT_hard_T2w_seed=15.json @@ -0,0 +1,235 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "meanGT_hard_T2w_seed=15", + "model_name": "meanGT_hard_T2w_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "meanGT_hard_T2w_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_softseg" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "T2w" + ], + "testing": [ + "T2w" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/group-8/split_datasets_T2w_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "DiceLoss" + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "sigmoid" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": 0.5 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/meanGT_hard_all_seed=15.json b/config/miccai2023/meanGT_hard_all_seed=15.json new file mode 100644 index 00000000..0201892d --- /dev/null +++ b/config/miccai2023/meanGT_hard_all_seed=15.json @@ -0,0 +1,243 @@ +{ + "command": "train", + "gpu_ids": [ + 2 + ], + "path_output": "meanGT_hard_all_seed=15", + "model_name": "meanGT_hard_all_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-9", + "run_name": "meanGT_hard_all_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/temp/adrian/contrast-agnostic-seg-models/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_softseg" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "T1w", + "T2w", + "T2star", + "dwi", + "MTS" + ], + "testing": [ + "T1w", + "T2w", + "T2star", + "dwi", + "MTS" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/MTS/all/split_datasets_all_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "DiceLoss" + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "sigmoid" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": 0.5 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/meanGT_hard_flip-1_mt-on_MTS_seed=15.json b/config/miccai2023/meanGT_hard_flip-1_mt-on_MTS_seed=15.json new file mode 100644 index 00000000..9116ab58 --- /dev/null +++ b/config/miccai2023/meanGT_hard_flip-1_mt-on_MTS_seed=15.json @@ -0,0 +1,235 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "meanGT_hard_flip-1_mt-on_MTS_seed=15", + "model_name": "meanGT_hard_flip-1_mt-on_MTS_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-9", + "run_name": "meanGT_hard_flip-1_mt-on_MTS_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/temp/adrian/contrast-agnostic-seg-models/data_processed_clean_MTon_MTS" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_softseg" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "MTS" + ], + "testing": [ + "MTS" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/tests/split_datasets_flip-1_mt-on_MTS_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "DiceLoss" + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "sigmoid" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": 0.5 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/meanGT_hard_flip-2_mt-off_MTS_seed=15.json b/config/miccai2023/meanGT_hard_flip-2_mt-off_MTS_seed=15.json new file mode 100644 index 00000000..01edfce6 --- /dev/null +++ b/config/miccai2023/meanGT_hard_flip-2_mt-off_MTS_seed=15.json @@ -0,0 +1,235 @@ +{ + "command": "train", + "gpu_ids": [ + 1 + ], + "path_output": "meanGT_hard_flip-2_mt-off_MTS_seed=15", + "model_name": "meanGT_hard_flip-2_mt-off_MTS_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-9", + "run_name": "meanGT_hard_flip-2_mt-off_MTS_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/temp/adrian/contrast-agnostic-seg-models/data_processed_clean_T1w_MTS" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_softseg" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "MTS" + ], + "testing": [ + "MTS" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/MTS/T1w_MTS/split_datasets_flip-2_mt-off_MTS_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "DiceLoss" + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "sigmoid" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": 0.5 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/meanGT_hard_rec-average_dwi_seed=15.json b/config/miccai2023/meanGT_hard_rec-average_dwi_seed=15.json new file mode 100644 index 00000000..89004f26 --- /dev/null +++ b/config/miccai2023/meanGT_hard_rec-average_dwi_seed=15.json @@ -0,0 +1,235 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "meanGT_hard_rec-average_dwi_seed=15", + "model_name": "meanGT_hard_rec-average_dwi_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "meanGT_hard_rec-average_dwi_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_softseg" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "dwi" + ], + "testing": [ + "dwi" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/group-8/split_datasets_rec-average_dwi_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "DiceLoss" + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "sigmoid" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": 0.5 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/meanGT_soft_T1w_seed=15.json b/config/miccai2023/meanGT_soft_T1w_seed=15.json new file mode 100644 index 00000000..3352f0b2 --- /dev/null +++ b/config/miccai2023/meanGT_soft_T1w_seed=15.json @@ -0,0 +1,239 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "meanGT_soft_T1w_seed=15", + "model_name": "meanGT_soft_T1w_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "meanGT_soft_T1w_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_softseg" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "T1w" + ], + "testing": [ + "T1w" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/group-8/split_datasets_T1w_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "AdapWingLoss", + "epsilon": 1, + "theta": 0.5, + "omega": 8, + "alpha": 2.1 + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "relu" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": -1 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/meanGT_soft_T2star_seed=15.json b/config/miccai2023/meanGT_soft_T2star_seed=15.json new file mode 100644 index 00000000..e48a1e14 --- /dev/null +++ b/config/miccai2023/meanGT_soft_T2star_seed=15.json @@ -0,0 +1,239 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "meanGT_soft_T2star_seed=15", + "model_name": "meanGT_soft_T2star_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "meanGT_soft_T2star_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_softseg" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "T2star" + ], + "testing": [ + "T2star" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/group-8/split_datasets_T2star_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "AdapWingLoss", + "epsilon": 1, + "theta": 0.5, + "omega": 8, + "alpha": 2.1 + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "relu" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": -1 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/meanGT_soft_T2w_seed=15.json b/config/miccai2023/meanGT_soft_T2w_seed=15.json new file mode 100644 index 00000000..1d51a075 --- /dev/null +++ b/config/miccai2023/meanGT_soft_T2w_seed=15.json @@ -0,0 +1,239 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "meanGT_soft_T2w_seed=15", + "model_name": "meanGT_soft_T2w_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "meanGT_soft_T2w_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_softseg" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "T2w" + ], + "testing": [ + "T2w" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/group-8/split_datasets_T2w_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "AdapWingLoss", + "epsilon": 1, + "theta": 0.5, + "omega": 8, + "alpha": 2.1 + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "relu" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": -1 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/meanGT_soft_all_seed=15.json b/config/miccai2023/meanGT_soft_all_seed=15.json new file mode 100644 index 00000000..f5fc638c --- /dev/null +++ b/config/miccai2023/meanGT_soft_all_seed=15.json @@ -0,0 +1,247 @@ +{ + "command": "train", + "gpu_ids": [ + 2 + ], + "path_output": "meanGT_soft_all_seed=15", + "model_name": "meanGT_soft_all_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-9", + "run_name": "meanGT_soft_all_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/temp/adrian/contrast-agnostic-seg-models/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_softseg" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "T1w", + "T2w", + "T2star", + "dwi", + "MTS" + ], + "testing": [ + "T1w", + "T2w", + "T2star", + "dwi", + "MTS" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/MTS/all/split_datasets_all_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "AdapWingLoss", + "epsilon": 1, + "theta": 0.5, + "omega": 8, + "alpha": 2.1 + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "relu" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": -1 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/meanGT_soft_flip-1_mt-on_MTS_seed=15.json b/config/miccai2023/meanGT_soft_flip-1_mt-on_MTS_seed=15.json new file mode 100644 index 00000000..0153bb83 --- /dev/null +++ b/config/miccai2023/meanGT_soft_flip-1_mt-on_MTS_seed=15.json @@ -0,0 +1,239 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "meanGT_soft_flip-1_mt-on_MTS_seed=15", + "model_name": "meanGT_soft_flip-1_mt-on_MTS_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-9", + "run_name": "meanGT_soft_flip-1_mt-on_MTS_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/temp/adrian/contrast-agnostic-seg-models/data_processed_clean_MTon_MTS" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_softseg" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "MTS" + ], + "testing": [ + "MTS" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/tests/split_datasets_flip-1_mt-on_MTS_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "AdapWingLoss", + "epsilon": 1, + "theta": 0.5, + "omega": 8, + "alpha": 2.1 + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.0005, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "relu" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": -1 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/meanGT_soft_flip-2_mt-off_MTS_seed=15.json b/config/miccai2023/meanGT_soft_flip-2_mt-off_MTS_seed=15.json new file mode 100644 index 00000000..ef554c08 --- /dev/null +++ b/config/miccai2023/meanGT_soft_flip-2_mt-off_MTS_seed=15.json @@ -0,0 +1,239 @@ +{ + "command": "train", + "gpu_ids": [ + 1 + ], + "path_output": "meanGT_soft_flip-2_mt-off_MTS_seed=15", + "model_name": "meanGT_soft_flip-2_mt-off_MTS_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-9", + "run_name": "meanGT_soft_flip-2_mt-off_MTS_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/temp/adrian/contrast-agnostic-seg-models/data_processed_clean_T1w_MTS" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_softseg" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "MTS" + ], + "testing": [ + "MTS" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/MTS/T1w_MTS/split_datasets_flip-2_mt-off_MTS_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "AdapWingLoss", + "epsilon": 1, + "theta": 0.5, + "omega": 8, + "alpha": 2.1 + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "relu" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": -1 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/miccai2023/meanGT_soft_rec-average_dwi_seed=15.json b/config/miccai2023/meanGT_soft_rec-average_dwi_seed=15.json new file mode 100644 index 00000000..bf9cdad3 --- /dev/null +++ b/config/miccai2023/meanGT_soft_rec-average_dwi_seed=15.json @@ -0,0 +1,239 @@ +{ + "command": "train", + "gpu_ids": [ + 0 + ], + "path_output": "meanGT_soft_rec-average_dwi_seed=15", + "model_name": "meanGT_soft_rec-average_dwi_seed=15", + "debugging": true, + "object_detection_params": { + "object_detection_path": null, + "safety_factor": [ + 1.0, + 1.0, + 1.0 + ] + }, + "wandb": { + "wandb_api_key": "18bbcc09542538f6d67167d2bb62b6415d3ce12b", + "project_name": "contrast-agnostic-softseg-sc-project", + "group_name": "group-8", + "run_name": "meanGT_soft_rec-average_dwi_seed=15", + "log_grads_every": 10 + }, + "loader_parameters": { + "path_data": [ + "/home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean" + ], + "subject_selection": { + "n": [], + "metadata": [], + "value": [] + }, + "target_suffix": [ + "_softseg" + ], + "extensions": [ + ".nii.gz" + ], + "roi_params": { + "suffix": null, + "slice_filter_roi": null + }, + "contrast_params": { + "training_validation": [ + "dwi" + ], + "testing": [ + "dwi" + ], + "balance": {} + }, + "patch_filter_params": { + "filter_empty_mask": true, + "filter_empty_input": true + }, + "slice_axis": "axial", + "multichannel": false, + "soft_gt": true + }, + "split_dataset": { + "fname_split": "joblibs/group-8/split_datasets_rec-average_dwi_seed=15.joblib", + "center_test": [], + "method": "per_patient", + "balance": null, + "train_fraction": 0.6, + "test_fraction": 0.2 + }, + "training_parameters": { + "batch_size": 8, + "loss": { + "name": "AdapWingLoss", + "epsilon": 1, + "theta": 0.5, + "omega": 8, + "alpha": 2.1 + }, + "training_time": { + "num_epochs": 200, + "early_stopping_patience": 50, + "early_stopping_epsilon": 0.001 + }, + "scheduler": { + "initial_lr": 0.001, + "lr_scheduler": { + "name": "CosineAnnealingLR", + "base_lr": 0.0001, + "max_lr": 0.001 + } + }, + "balance_samples": { + "applied": false, + "type": "gt" + }, + "mixup_alpha": null, + "transfer_learning": { + "retrain_model": null, + "retrain_fraction": 1.0, + "reset": true + } + }, + "default_model": { + "name": "Unet", + "dropout_rate": 0.3, + "bn_momentum": 0.1, + "depth": 4, + "is_2d": false, + "final_activation": "relu" + }, + "Modified3DUNet": { + "applied": true, + "length_3D": [ + 48, + 176, + 288 + ], + "stride_3D": [ + 48, + 176, + 288 + ], + "attention": false, + "n_filters": 8 + }, + "uncertainty": { + "epistemic": false, + "aleatoric": false, + "n_it": 0 + }, + "postprocessing": { + "binarize_prediction": { + "thr": -1 + }, + "remove_noise": { + "thr": -1 + }, + "keep_largest": {}, + "fill_holes": {}, + "remove_small": { + "unit": "vox", + "thr": 3 + } + }, + "evaluation_parameters": {}, + "transformation": { + "Resample": { + "hspace": 1, + "wspace": 1, + "dspace": 1 + }, + "CenterCrop": { + "size": [ + 48, + 176, + 288 + ] + }, + "RandomAffine": { + "degrees": 20, + "scale": [ + 0.2, + 0.2, + 0.2 + ], + "translate": [ + 0.1, + 0.1, + 0.1 + ], + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "ElasticTransform": { + "alpha_range": [ + 25.0, + 35.0 + ], + "sigma_range": [ + 3.5, + 5.5 + ], + "p": 0.5, + "applied_to": [ + "im", + "gt" + ], + "dataset_type": [ + "training" + ] + }, + "RandomGamma": { + "log_gamma_range": [ + -1.0, + 1.0 + ], + "p": 0.5, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBiasField": { + "coefficients": 0.5, + "order": 3, + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "RandomBlur": { + "sigma_range": [ + 0.0, + 2.0 + ], + "p": 0.3, + "applied_to": [ + "im" + ], + "dataset_type": [ + "training" + ] + }, + "NumpyToTensor": {}, + "NormalizeInstance": { + "applied_to": [ + "im" + ] + } + } +} \ No newline at end of file diff --git a/config/super-duper/seg_sc_all.json b/config/super-duper/seg_sc_all.json deleted file mode 100644 index 6c7eaeb2..00000000 --- a/config/super-duper/seg_sc_all.json +++ /dev/null @@ -1,146 +0,0 @@ -{ - "command": "train", - "gpu_ids": [0], - "path_output": "super_duper_seg_sc_all_output", - "model_name": "super_duper_seg_sc_all_model", - "debugging": true, - "object_detection_params": { - "object_detection_path": null, - "safety_factor": [1.0, 1.0, 1.0] - }, - "loader_parameters": { - "path_data": ["spine-generic-processed"], - "subject_selection": { - "n": [], - "metadata": [], - "value": [] - }, - "target_suffix": ["_softseg"], - "extensions": [".nii.gz"], - "roi_params": { - "suffix": null, - "slice_filter_roi": null - }, - "contrast_params": { - "training_validation": ["T1w", "T2w", "T2star"], - "testing": ["T1w", "T2w", "T2star"], - "balance": {} - }, - "patch_filter_params": { - "filter_empty_mask": true, - "filter_empty_input": true - }, - "slice_axis": "axial", - "multichannel": false, - "soft_gt": true - }, - "split_dataset": { - "fname_split": null, - "random_seed": 42, - "center_test": [], - "method": "per_patient", - "balance": null, - "train_fraction": 0.6, - "test_fraction": 0.2 - }, - "training_parameters": { - "batch_size": 2, - "loss": { - "name": "DiceLoss" - }, - "training_time": { - "num_epochs": 100, - "early_stopping_patience": 25, - "early_stopping_epsilon": 0.001 - }, - "scheduler": { - "initial_lr": 1e-3, - "lr_scheduler": { - "name": "CosineAnnealingLR", - "base_lr": 1e-5, - "max_lr": 1e-3 - } - }, - "balance_samples": { - "applied": false, - "type": "gt" - }, - "mixup_alpha": null, - "transfer_learning": { - "retrain_model": null, - "retrain_fraction": 1.0, - "reset": true - } - }, - "default_model": { - "name": "Unet", - "dropout_rate": 0.3, - "bn_momentum": 0.1, - "depth": 4, - "is_2d": false, - "final_activation": "relu" - }, - "Modified3DUNet": { - "applied": true, - "length_3D": [224, 256, 320], - "stride_3D": [224, 256, 320], - "attention": false, - "n_filters": 8 - }, - "uncertainty": { - "epistemic": false, - "aleatoric": false, - "n_it": 0 - }, - "postprocessing": { - "binarize_prediction": {"thr": -1} - }, - "evaluation_parameters": {}, - "transformation": { - "Resample": { - "hspace": 1, - "wspace": 1, - "dspace": 1 - }, - "CenterCrop": { - "size": [224, 256, 320] - }, - "RandomAffine": { - "degrees": 10, - "scale": [0.2, 0.2, 0.2], - "translate": [0.0, 0.0, 0.0], - "applied_to": ["im", "gt"], - "dataset_type": ["training"] - }, - "ElasticTransform": { - "alpha_range": [25.0, 35.0], - "sigma_range": [3.5, 5.5], - "p": 0.5, - "applied_to": ["im", "gt"], - "dataset_type": ["training"] - }, - "RandomGamma": { - "log_gamma_range": [-1.0, 1.0], - "p": 0.5, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "RandomBiasField": { - "coefficients": 0.5, - "order": 3, - "p": 0.3, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "RandomBlur": { - "sigma_range": [0.0, 2.0], - "p": 0.3, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "NumpyToTensor": {}, - "NormalizeInstance": { - "applied_to": ["im"] - } - } -} \ No newline at end of file diff --git a/config/super-duper/seg_sc_t1w.json b/config/super-duper/seg_sc_t1w.json deleted file mode 100644 index 46df1c43..00000000 --- a/config/super-duper/seg_sc_t1w.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "command": "train", - "gpu_ids": [0], - "path_output": "super_duper_seg_sc_t1w_output", - "model_name": "super_duper_seg_sc_t1w_model", - "debugging": true, - "object_detection_params": { - "object_detection_path": null, - "safety_factor": [1.0, 1.0, 1.0] - }, - "loader_parameters": { - "path_data": ["spine-generic-processed"], - "subject_selection": { - "n": [], - "metadata": [], - "value": [] - }, - "target_suffix": ["_softseg"], - "extensions": [".nii.gz"], - "roi_params": { - "suffix": null, - "slice_filter_roi": null - }, - "contrast_params": { - "training_validation": ["T1w"], - "testing": ["T1w"], - "balance": {} - }, - "patch_filter_params": { - "filter_empty_mask": true, - "filter_empty_input": true - }, - "slice_axis": "axial", - "multichannel": false, - "soft_gt": true - }, - "split_dataset": { - "fname_split": null, - "random_seed": 42, - "center_test": [], - "method": "per_patient", - "balance": null, - "train_fraction": 0.6, - "test_fraction": 0.2 - }, - "training_parameters": { - "batch_size": 2, - "loss": { - "name": "DiceLoss" - }, - "training_time": { - "num_epochs": 100, - "early_stopping_patience": 25, - "early_stopping_epsilon": 0.001 - }, - "scheduler": { - "initial_lr": 1e-3, - "lr_scheduler": { - "name": "CosineAnnealingLR", - "base_lr": 1e-5, - "max_lr": 1e-3 - } - }, - "balance_samples": { - "applied": false, - "type": "gt" - }, - "mixup_alpha": null, - "transfer_learning": { - "retrain_model": null, - "retrain_fraction": 1.0, - "reset": true - } - }, - "default_model": { - "name": "Unet", - "dropout_rate": 0.3, - "bn_momentum": 0.1, - "depth": 4, - "is_2d": false, - "final_activation": "relu" - }, - "Modified3DUNet": { - "applied": true, - "length_3D": [224, 256, 320], - "stride_3D": [224, 256, 320], - "attention": false, - "n_filters": 8 - }, - "uncertainty": { - "epistemic": false, - "aleatoric": false, - "n_it": 0 - }, - "postprocessing": { - "binarize_prediction": {"thr": -1} - }, - "evaluation_parameters": {}, - "transformation": { - "Resample": - { - "hspace": 1, - "wspace": 1, - "dspace": 1 - }, - "CenterCrop": { - "size": [224, 256, 320] - }, - "RandomAffine": { - "degrees": 10, - "scale": [0.2, 0.2, 0.2], - "translate": [0.0, 0.0, 0.0], - "applied_to": ["im", "gt"], - "dataset_type": ["training"] - }, - "ElasticTransform": { - "alpha_range": [25.0, 35.0], - "sigma_range": [3.5, 5.5], - "p": 0.5, - "applied_to": ["im", "gt"], - "dataset_type": ["training"] - }, - "RandomGamma": { - "log_gamma_range": [-1.0, 1.0], - "p": 0.5, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "RandomBiasField": { - "coefficients": 0.5, - "order": 3, - "p": 0.3, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "RandomBlur": { - "sigma_range": [0.0, 2.0], - "p": 0.3, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "NumpyToTensor": {}, - "NormalizeInstance": { - "applied_to": ["im"] - } - } -} \ No newline at end of file diff --git a/config/super-duper/seg_sc_t2star.json b/config/super-duper/seg_sc_t2star.json deleted file mode 100644 index 79c0cc9d..00000000 --- a/config/super-duper/seg_sc_t2star.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "command": "train", - "gpu_ids": [0], - "path_output": "super_duper_seg_sc_t2star_output", - "model_name": "super_duper_seg_sc_t2star_model", - "debugging": true, - "object_detection_params": { - "object_detection_path": null, - "safety_factor": [1.0, 1.0, 1.0] - }, - "loader_parameters": { - "path_data": ["spine-generic-processed"], - "subject_selection": { - "n": [], - "metadata": [], - "value": [] - }, - "target_suffix": ["_softseg"], - "extensions": [".nii.gz"], - "roi_params": { - "suffix": null, - "slice_filter_roi": null - }, - "contrast_params": { - "training_validation": ["T2star"], - "testing": ["T2star"], - "balance": {} - }, - "patch_filter_params": { - "filter_empty_mask": true, - "filter_empty_input": true - }, - "slice_axis": "axial", - "multichannel": false, - "soft_gt": true - }, - "split_dataset": { - "fname_split": null, - "random_seed": 42, - "center_test": [], - "method": "per_patient", - "balance": null, - "train_fraction": 0.6, - "test_fraction": 0.2 - }, - "training_parameters": { - "batch_size": 2, - "loss": { - "name": "DiceLoss" - }, - "training_time": { - "num_epochs": 100, - "early_stopping_patience": 25, - "early_stopping_epsilon": 0.001 - }, - "scheduler": { - "initial_lr": 1e-3, - "lr_scheduler": { - "name": "CosineAnnealingLR", - "base_lr": 1e-5, - "max_lr": 1e-3 - } - }, - "balance_samples": { - "applied": false, - "type": "gt" - }, - "mixup_alpha": null, - "transfer_learning": { - "retrain_model": null, - "retrain_fraction": 1.0, - "reset": true - } - }, - "default_model": { - "name": "Unet", - "dropout_rate": 0.3, - "bn_momentum": 0.1, - "depth": 4, - "is_2d": false, - "final_activation": "relu" - }, - "Modified3DUNet": { - "applied": true, - "length_3D": [224, 256, 320], - "stride_3D": [224, 256, 320], - "attention": false, - "n_filters": 8 - }, - "uncertainty": { - "epistemic": false, - "aleatoric": false, - "n_it": 0 - }, - "postprocessing": { - "binarize_prediction": {"thr": -1} - }, - "evaluation_parameters": {}, - "transformation": { - "Resample": - { - "hspace": 1, - "wspace": 1, - "dspace": 1 - }, - "CenterCrop": { - "size": [224, 256, 320] - }, - "RandomAffine": { - "degrees": 10, - "scale": [0.2, 0.2, 0.2], - "translate": [0.0, 0.0, 0.0], - "applied_to": ["im", "gt"], - "dataset_type": ["training"] - }, - "ElasticTransform": { - "alpha_range": [25.0, 35.0], - "sigma_range": [3.5, 5.5], - "p": 0.5, - "applied_to": ["im", "gt"], - "dataset_type": ["training"] - }, - "RandomGamma": { - "log_gamma_range": [-1.0, 1.0], - "p": 0.5, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "RandomBiasField": { - "coefficients": 0.5, - "order": 3, - "p": 0.3, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "RandomBlur": { - "sigma_range": [0.0, 2.0], - "p": 0.3, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "NumpyToTensor": {}, - "NormalizeInstance": { - "applied_to": ["im"] - } - } -} \ No newline at end of file diff --git a/config/super-duper/seg_sc_t2w.json b/config/super-duper/seg_sc_t2w.json deleted file mode 100644 index 7abb5d9a..00000000 --- a/config/super-duper/seg_sc_t2w.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "command": "train", - "gpu_ids": [0], - "path_output": "super_duper_seg_sc_t2w_output", - "model_name": "super_duper_seg_sc_t2w_model", - "debugging": true, - "object_detection_params": { - "object_detection_path": null, - "safety_factor": [1.0, 1.0, 1.0] - }, - "loader_parameters": { - "path_data": ["spine-generic-processed"], - "subject_selection": { - "n": [], - "metadata": [], - "value": [] - }, - "target_suffix": ["_softseg"], - "extensions": [".nii.gz"], - "roi_params": { - "suffix": null, - "slice_filter_roi": null - }, - "contrast_params": { - "training_validation": ["T2w"], - "testing": ["T2w"], - "balance": {} - }, - "patch_filter_params": { - "filter_empty_mask": true, - "filter_empty_input": true - }, - "slice_axis": "axial", - "multichannel": false, - "soft_gt": true - }, - "split_dataset": { - "fname_split": null, - "random_seed": 42, - "center_test": [], - "method": "per_patient", - "balance": null, - "train_fraction": 0.6, - "test_fraction": 0.2 - }, - "training_parameters": { - "batch_size": 2, - "loss": { - "name": "DiceLoss" - }, - "training_time": { - "num_epochs": 100, - "early_stopping_patience": 25, - "early_stopping_epsilon": 0.001 - }, - "scheduler": { - "initial_lr": 1e-3, - "lr_scheduler": { - "name": "CosineAnnealingLR", - "base_lr": 1e-5, - "max_lr": 1e-3 - } - }, - "balance_samples": { - "applied": false, - "type": "gt" - }, - "mixup_alpha": null, - "transfer_learning": { - "retrain_model": null, - "retrain_fraction": 1.0, - "reset": true - } - }, - "default_model": { - "name": "Unet", - "dropout_rate": 0.3, - "bn_momentum": 0.1, - "depth": 4, - "is_2d": false, - "final_activation": "relu" - }, - "Modified3DUNet": { - "applied": true, - "length_3D": [224, 256, 320], - "stride_3D": [224, 256, 320], - "attention": false, - "n_filters": 8 - }, - "uncertainty": { - "epistemic": false, - "aleatoric": false, - "n_it": 0 - }, - "postprocessing": { - "binarize_prediction": {"thr": -1} - }, - "evaluation_parameters": {}, - "transformation": { - "Resample": - { - "hspace": 1, - "wspace": 1, - "dspace": 1 - }, - "CenterCrop": { - "size": [224, 256, 320] - }, - "RandomAffine": { - "degrees": 10, - "scale": [0.2, 0.2, 0.2], - "translate": [0.0, 0.0, 0.0], - "applied_to": ["im", "gt"], - "dataset_type": ["training"] - }, - "ElasticTransform": { - "alpha_range": [25.0, 35.0], - "sigma_range": [3.5, 5.5], - "p": 0.5, - "applied_to": ["im", "gt"], - "dataset_type": ["training"] - }, - "RandomGamma": { - "log_gamma_range": [-1.0, 1.0], - "p": 0.5, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "RandomBiasField": { - "coefficients": 0.5, - "order": 3, - "p": 0.3, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "RandomBlur": { - "sigma_range": [0.0, 2.0], - "p": 0.3, - "applied_to": ["im"], - "dataset_type": ["training"] - }, - "NumpyToTensor": {}, - "NormalizeInstance": { - "applied_to": ["im"] - } - } -} \ No newline at end of file From a495e735653d55bac09d43429044ad9440c7c4d9 Mon Sep 17 00:00:00 2001 From: Adrian EL BAZ Date: Thu, 9 Mar 2023 14:49:44 -0500 Subject: [PATCH 07/11] Updating training scripts - MTS + remaining contrasts --- training_scripts/acq-MTon_MTS/training_run.sh | 9 +++------ training_scripts/acq-T1w_MTS/training_run.sh | 9 +++------ training_scripts/all/training_run.sh | 9 ++++----- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/training_scripts/acq-MTon_MTS/training_run.sh b/training_scripts/acq-MTon_MTS/training_run.sh index 7dc3197e..57909f9d 100644 --- a/training_scripts/acq-MTon_MTS/training_run.sh +++ b/training_scripts/acq-MTon_MTS/training_run.sh @@ -1,7 +1,6 @@ ####### Training Run ####### -seeds=(15) # seeds=(42 15 34 98 62) +seeds=(15) config_types=("hard_hard" "hard_soft" "meanGT_soft" "meanGT_hard") -#contrasts=("T1w" "T2w" "T2star" "rec-average_dwi" "all") contrasts=("flip-1_mt-on_MTS") # We can't differentiate between variants of MTS for seed in ${seeds[@]} @@ -11,12 +10,10 @@ do for contrast in ${contrasts[@]} do sleep 5 - #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json - output_dir=./batch_results/group-9/"$config"_"$contrast"_seed="$seed" + output_dir=./results/miccai2023/"$config"_"$contrast"_seed="$seed" echo $output_dir mkdir $output_dir - #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json - CUDA_VISIBLE=0 ivadomed --train -c ./batch_configs/group-9/"$config"_"$contrast"_seed="$seed".json --path-output $output_dir + CUDA_VISIBLE=0 ivadomed --train -c ./config/miccai2023/"$config"_"$contrast"_seed="$seed".json --path-output $output_dir done done done \ No newline at end of file diff --git a/training_scripts/acq-T1w_MTS/training_run.sh b/training_scripts/acq-T1w_MTS/training_run.sh index d6545d62..b365b2ec 100644 --- a/training_scripts/acq-T1w_MTS/training_run.sh +++ b/training_scripts/acq-T1w_MTS/training_run.sh @@ -1,7 +1,6 @@ ####### Training Run ####### -seeds=(15) # seeds=(42 15 34 98 62) +seeds=(15) config_types=("hard_hard" "hard_soft" "meanGT_soft" "meanGT_hard") -#contrasts=("T1w" "T2w" "T2star" "rec-average_dwi" "all") contrasts=("flip-2_mt-off_MTS") # We can't differentiate between variants of MTS for seed in ${seeds[@]} @@ -11,12 +10,10 @@ do for contrast in ${contrasts[@]} do sleep 5 - #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json - output_dir=./batch_results/group-9/"$config"_"$contrast"_seed="$seed" + output_dir=./results/miccai2023/"$config"_"$contrast"_seed="$seed" echo $output_dir mkdir $output_dir - #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json - CUDA_VISIBLE=1 ivadomed --train -c ./batch_configs/group-9/"$config"_"$contrast"_seed="$seed".json --path-output $output_dir + CUDA_VISIBLE=1 ivadomed --train -c ./config/miccai2023/"$config"_"$contrast"_seed="$seed".json --path-output $output_dir done done done \ No newline at end of file diff --git a/training_scripts/all/training_run.sh b/training_scripts/all/training_run.sh index e97e37c4..785b4b39 100644 --- a/training_scripts/all/training_run.sh +++ b/training_scripts/all/training_run.sh @@ -1,8 +1,7 @@ ####### Training Run ####### -seeds=(15) # seeds=(42 15 34 98 62) +seeds=(15) config_types=("hard_hard" "hard_soft" "meanGT_soft" "meanGT_hard") -#contrasts=("T1w" "T2w" "T2star" "rec-average_dwi" "all") -contrasts=("all") # We can't differentiate between variants of MTS +contrasts=("T1w" "T2w" "T2star" "rec-average_dwi" "all") for seed in ${seeds[@]} do @@ -12,11 +11,11 @@ do do sleep 5 #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json - output_dir=./batch_results/group-9/"$config"_"$contrast"_seed="$seed" + output_dir=./results/miccai2023/"$config"_"$contrast"_seed="$seed" echo $output_dir mkdir $output_dir #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json - CUDA_VISIBLE=2 ivadomed --train -c ./batch_configs/group-9/"$config"_"$contrast"_seed="$seed".json --path-output $output_dir + CUDA_VISIBLE=2 ivadomed --train -c ./config/miccai2023/"$config"_"$contrast"_seed="$seed".json --path-output $output_dir done done done \ No newline at end of file From c9445c9a272bf0a3482d11136e740fbe49f670a9 Mon Sep 17 00:00:00 2001 From: Adrian EL BAZ Date: Thu, 9 Mar 2023 15:33:30 -0500 Subject: [PATCH 08/11] Adding Miccai 2023 Spine-generic evaluation scripts --- evaluation/compute_evaluation_metrics.py | 290 +++++++++++++++++++++++ evaluation/miccai_results_models.py | 109 +++++++++ 2 files changed, 399 insertions(+) create mode 100644 evaluation/compute_evaluation_metrics.py create mode 100644 evaluation/miccai_results_models.py diff --git a/evaluation/compute_evaluation_metrics.py b/evaluation/compute_evaluation_metrics.py new file mode 100644 index 00000000..ca11e45d --- /dev/null +++ b/evaluation/compute_evaluation_metrics.py @@ -0,0 +1,290 @@ +#!/usr/bin/env python +# -*- coding: utf-8 +# Computes mean dice coefficient across manual segmentations from candidates and ground truth segmentations. +# +# For usage, type: python compute_dice.py -h +# +# Authors: Sandrine Bédard & Adrian El Baz + +import argparse +import logging +import os +import sys +import numpy as np +import nibabel as nib +import csv +import pandas as pd +from scipy import spatial +from pathlib import Path + +# Initialize logging +logger = logging.getLogger(__name__) +logger.setLevel(logging.INFO) # default: logging.DEBUG, logging.INFO +hdlr = logging.StreamHandler(sys.stdout) +logging.root.addHandler(hdlr) + + +def numeric_score(prediction, groundtruth): + """Computation of statistical numerical scores: + * FP = Soft False Positives + * FN = Soft False Negatives + * TP = Soft True Positives + * TN = Soft True Negatives + Robust to hard or soft input masks. For example:: + prediction=np.asarray([0, 0.5, 1]) + groundtruth=np.asarray([0, 1, 1]) + Leads to FP = 1.5 + Note: It assumes input values are between 0 and 1. + Args: + prediction (ndarray): Binary prediction. + groundtruth (ndarray): Binary groundtruth. + Returns: + float, float, float, float: FP, FN, TP, TN + """ + FP = float(np.sum(prediction * (1.0 - groundtruth))) + FN = float(np.sum((1.0 - prediction) * groundtruth)) + TP = float(np.sum(prediction * groundtruth)) + TN = float(np.sum((1.0 - prediction) * (1.0 - groundtruth))) + return FP, FN, TP, TN + + +def get_vol(data, remove_lastdim=False): + """Get volume.""" + ## Binarize + if remove_lastdim: + vol = np.sum(np.squeeze(np.where(np.asarray(data.get_fdata())>0.5, 1, 0), axis=3)) + else: + vol = np.sum(np.where(np.asarray(data.get_fdata())>0.5, 1, 0)) + #vol = np.sum(data.get_fdata()) + px, py, pz = data.header['pixdim'][1:4] + vol *= px * py * pz + return vol + + +def precision_score(prediction, groundtruth, err_value=0.0): + """Positive predictive value (PPV). + Precision equals the number of true positive voxels divided by the sum of true and false positive voxels. + True and false positives are computed on soft masks, see ``"numeric_score"``. + Args: + prediction (ndarray): First array. + groundtruth (ndarray): Second array. + err_value (float): Value returned in case of error. + Returns: + float: Precision score. + """ + FP, FN, TP, TN = numeric_score(prediction, groundtruth) + if (TP + FP) <= 0.0: + return err_value + + precision = np.divide(TP, TP + FP) + return precision + + +def recall_score(prediction, groundtruth, err_value=0.0): + """True positive rate (TPR). + Recall equals the number of true positive voxels divided by the sum of true positive and false negative voxels. + True positive and false negative values are computed on soft masks, see ``"numeric_score"``. + Args: + prediction (ndarray): First array. + groundtruth (ndarray): Second array. + err_value (float): Value returned in case of error. + Returns: + float: Recall score. + """ + FP, FN, TP, TN = numeric_score(prediction, groundtruth) + if (TP + FN) <= 0.0: + return err_value + TPR = np.divide(TP, TP + FN) + return TPR + + +def specificity_score(prediction, groundtruth, err_value=0.0): + """True negative rate (TNR). + Specificity equals the number of true negative voxels divided by the sum of true negative and false positive voxels. + True negative and false positive values are computed on soft masks, see ``"numeric_score"``. + Args: + prediction (ndarray): First array. + groundtruth (ndarray): Second array. + err_value (float): Value returned in case of error. + Returns: + float: Specificity score. + """ + FP, FN, TP, TN = numeric_score(prediction, groundtruth) + if (TN + FP) <= 0.0: + return err_value + TNR = np.divide(TN, TN + FP) + return TNR + + +def hausdorff_score(prediction, groundtruth): + """Compute the directed Hausdorff distance between two N-D arrays. + Args: + prediction (ndarray): First array. + groundtruth (ndarray): Second array. + Returns: + float: Hausdorff distance. + """ + if len(prediction.shape) == 4: + n_classes, height, depth, width = prediction.shape + # Reshape to have only 3 dimensions where prediction[:, idx, :] represents each 2D slice + prediction = prediction.reshape((height, n_classes * depth, width)) + groundtruth = groundtruth.reshape((height, n_classes * depth, width)) + + if len(prediction.shape) == 3: + mean_hansdorff = 0 + for idx in range(prediction.shape[1]): + pred = prediction[:, idx, :] + gt = groundtruth[:, idx, :] + mean_hansdorff += spatial.distance.directed_hausdorff(pred, gt)[0] + mean_hansdorff = mean_hansdorff / prediction.shape[1] + return mean_hansdorff + + return spatial.distance.directed_hausdorff(prediction, groundtruth)[0] + + +def accuracy_score(prediction, groundtruth, err_value=0.0): + """Accuracy. + Accuracy equals the number of true positive and true negative voxels divided by the total number of voxels. + True positive/negative and false positive/negative values are computed on soft masks, see ``"numeric_score"``. + Args: + prediction (ndarray): First array. + groundtruth (ndarray): Second array. + Returns: + float: Accuracy. + """ + FP, FN, TP, TN = numeric_score(prediction, groundtruth) + N = FP + FN + TP + TN + if N <= 0.0: + return err_value + accuracy = np.divide(TP + TN, N) + return accuracy + + +def mse(im1, im2): + """Compute the Mean Squared Error. + Compute the Mean Squared Error between the two images, i.e. sum of the squared difference. + Args: + im1 (ndarray): First array. + im2 (ndarray): Second array. + Returns: + float: Mean Squared Error. + """ + im1 = np.asarray(im1) + im2 = np.asarray(im2) + + if im1.shape != im2.shape: + raise ValueError("Shape mismatch: im1 and im2 must have the same shape.") + + err = np.sum((im1.astype("float") - im2.astype("float")) ** 2) + err /= float(im1.shape[0] * im1.shape[1]) + + return err + +def get_rvd(im1, im2): + """Relative volume difference. + The volume is here defined by the physical volume, in mm3, of the non-zero voxels of a given mask. + Relative volume difference equals the difference between the ground-truth and prediction volumes, divided by the + ground-truth volume. + Optimal value is zero. Negative value indicates over-segmentation, while positive value indicates + under-segmentation. + """ + vol_pred = get_vol(im1) + vol_gt = get_vol(im2, remove_lastdim=True) # Pred mask 4th dim removal + + if vol_gt == 0.0: + return np.nan + + rvd = (vol_gt - vol_pred) + rvd /= vol_gt + + return rvd + + +def get_avd(im1, im2): + """Absolute volume difference. + The volume is here defined by the physical volume, in mm3, of the non-zero voxels of a given mask. + Absolute volume difference equals the absolute value of the Relative Volume Difference. + Optimal value is zero. + """ + return abs(get_rvd(im1, im2)) + + +def compute_dice(im1, im2, empty_score=np.nan): + """Computes the Dice coefficient between im1 and im2. + Compute a soft Dice coefficient between im1 and im2, ie equals twice the sum of the two masks product, divided by + the sum of each mask sum. + If both images are empty, then it returns empty_score. + Args: + im1 (ndarray): First array. + im2 (ndarray): Second array. + empty_score (float): Returned value if both input array are empty. + Returns: + float: Dice coefficient. + """ + im1 = np.asarray(im1) + im2 = np.squeeze(np.asarray(im2), axis=3) # Fix pred mask 4th dim + # Binarization threshold + im1 = np.where(im1>0.5, 1, 0) + im2 = np.where(im2>0.5, 1, 0) + + if im1.shape != im2.shape: + raise ValueError("Shape mismatch: im1 and im2 must have the same shape.") + + im_sum = im1.sum() + im2.sum() + if im_sum == 0: + return empty_score + + intersection = (im1 * im2).sum() + return (2. * intersection) / im_sum + +def compute_folder_metrics(base_folder: str, exclude_list: list = []): + data_all_path = "../duke/temp/adrian/contrast-agnostic-seg-models/data_processed_clean" + data_MTon_MTS = "../duke/temp/adrian/contrast-agnostic-seg-models/data_processed_clean_MTon_MTS" + data_T1w_MTS = "../duke/temp/adrian/contrast-agnostic-seg-models/data_processed_clean_T1w_MTS" + + exp_folders = next(os.walk(base_folder))[1] + if exclude_list: + exp_folders = [f for f in exp_folders for excl in exclude_list if excl not in f] + for exp in exp_folders: + pred_mask_paths = [os.path.join(dirpath,f) for (dirpath, dirnames, filenames) in os.walk(os.path.join(base_folder, exp, "pred_masks")) for f in filenames if f.endswith("pred.nii.gz")] + prefix_paths = [pth.split('/')[-1].split('_pred')[0] for pth in pred_mask_paths] + patients = [pth.split('_')[0] for pth in prefix_paths] + exp_result = {"Filename": [], "Dice": [], "RVD": []} + for (patient, prefix, pred_mask_path) in zip(patients, prefix_paths, pred_mask_paths): + if "flip-1" in prefix: # different MTS not currently recogizable + data_folder = data_MTon_MTS + elif "flip-2" in prefix: # different MTS not currently recogizable + data_folder = data_T1w_MTS + else: + data_folder= data_all_path + type_folder = "anat" if "dwi" not in prefix else "dwi" + ground_truth_path = os.path.join(data_folder, f"derivatives/labels_softseg/{patient}/{type_folder}/{prefix}_softseg.nii.gz" ) + im1 = nib.load(ground_truth_path) + im2 = nib.load(pred_mask_path) + + # Binarization occurs directly in metric computations + dice = compute_dice(im1.get_fdata(), im2.get_fdata()) + rvd = get_rvd(im1,im2) + exp_result["Filename"].append(pred_mask_path) + exp_result["Dice"].append(dice) + exp_result["RVD"].append(rvd) + + df = pd.DataFrame.from_dict(exp_result) + if not os.path.isdir(f"./spine-generic-test-results/{exp}/"): + Path(f"./spine-generic-test-results/{exp}/").mkdir(parents=True, exist_ok=True) + df.to_csv(f"./spine-generic-test-results/{exp}/evaluation_3Dmetrics.csv") + +def main(): + """2 Experiment folders were used. One for MTS contrasts and "all", the other + for the rest of the experiments. Replace the folder names by your own experiment + folders. + """ + + g9_base_folder = "../duke/temp/adrian/contrast-agnostic-seg-models/Group9_20-12-2022/" + g8_base_folder = "../duke/temp/adrian/contrast-agnostic-seg-models/Group8_01-12-2022/" + + compute_folder_metrics(g9_base_folder) + compute_folder_metrics(g8_base_folder, ["all"]) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/evaluation/miccai_results_models.py b/evaluation/miccai_results_models.py new file mode 100644 index 00000000..7ee309e7 --- /dev/null +++ b/evaluation/miccai_results_models.py @@ -0,0 +1,109 @@ +import pandas as pd +import numpy as np +import scipy.stats +import os +import json + +def mean_confidence_interval(data, confidence=0.95): + a = 1.0 * np.array(data) + n = len(a) + m, se = np.mean(a), scipy.stats.sem(a) + h = se * scipy.stats.t.ppf((1 + confidence) / 2., n-1) + return m, h #m-h, m+h + +def mean_std(data): + a = 1.0 * np.array(data) + return np.mean(a), np.std(a) + + +def compute_metrics(data_paths): + """Stores DICE and Relative Difference Volume (RVD) of CSV segmentations + results in list_paths for each model.""" + results = {} + for dp in data_paths: + data_path = f"./spine-generic-test-results/{dp}/evaluation_3Dmetrics.csv" + df = pd.read_csv(data_path) + volume_diff = df["RVD"] + + avg_vol, conf_vol = mean_std(volume_diff) + avg_dice, conf_dice = mean_std(df["Dice"]) + print(f"Model {dp} | \n \t DICE : {avg_dice*100} ± {conf_dice*100} \n \t VOLUME : {avg_vol*100} ± {conf_vol*100}") + results[dp] = {"avg_vol": avg_vol * 100, "conf_vol": conf_vol * 100,"avg_dice": avg_dice * 100, "conf_dice": conf_dice * 100} + + return results + +def get_metric_values(list_paths): + """Accumulates DICE and Relative Difference Volume (RVD) of CSV segmentations + results in list_paths.""" + dices = [] + volume_diffs = [] + for dp in list_paths: + data_path = f"./spine-generic-test-results/{dp}/evaluation_3Dmetrics.csv" + df = pd.read_csv(data_path) + volume_diff = df["RVD"] + dice = df["Dice"] + dices = np.concatenate((dices, np.array(dice)), axis=None) + volume_diffs = np.concatenate((volume_diffs, np.array(volume_diff)), axis=None) + return *mean_std(dices), *mean_std(volume_diffs) + + +if __name__ == "__main__": + + contrasts = ["T1w", "T2w", "T2star", "rec-average_dwi", "flip-1_mt-on_MTS", "flip-2_mt-off_MTS", "all"] + spec_contrasts = [c for c in contrasts if c != "all"] + methods = ["meanGT", "hard"] + aug_methods = ["hard", "soft"] + results_path = "./temp_results" + list_paths = [f"{method}_{aug_method}_{contrast}_seed=15" for method in methods for aug_method in aug_methods for contrast in contrasts] + + ## Aggregated results (per_contrast and all_contrast) + aggregated_results = {} + for method in methods: + for aug_method in aug_methods: + for tp in ["percontrast", "allcontrast"]: + if tp == "percontrast": + avg_dice, conf_dice, avg_vol, conf_vol = get_metric_values([f"{method}_{aug_method}_{c}_seed=15" for c in spec_contrasts]) + + else: + avg_dice, conf_dice, avg_vol, conf_vol = get_metric_values([f"{method}_{aug_method}_all_seed=15"]) + aggregated_results[f"{method}_{aug_method}_{tp}"] = {"avg_vol": avg_vol * 100, "conf_vol": conf_vol * 100,"avg_dice": avg_dice * 100, "conf_dice": conf_dice * 100} + + with open("./spine-generic-test-results/miccai_aggregated_results.json", "w") as fp: + json.dump(aggregated_results, fp, indent=4) + with open("./spine-generic-test-results/miccai_aggregated_table_export.txt", "w") as fp: + for key, value in aggregated_results.items(): + line = "\\texttt" + "{" + f"{key}" + "}" + f"& {round(value['avg_dice'],2)} ± {round(value['conf_dice'],2)} & {round(value['avg_vol'],2)} ± {round(value['conf_vol'],2)} \\\\ \n" + fp.write(line) + + ## All 28 models results + key_paths = {} + for method in methods: + c_m = "soft\\_average" if method == "meanGT" else "hard" + for aug_method in aug_methods: + #ag_m = "soft" + for contrast in contrasts: + if "flip-1" in contrast : + c_con = "MTS-ON" + elif "flip-2" in contrast : + c_con = "MTS-OFF" + elif "all" in contrast: + c_con = "allcontrast" + elif "T2star" in contrast: + c_con = "T2star" + elif "dwi" in contrast: + c_con = "DWI" + else: + c_con = contrast + key_paths[f"{method}_{aug_method}_{contrast}_seed=15"] = ("DL\_" + f"{c_m}" + "\_" + f"{aug_method}" + "\_" + f"{c_con}" ) + + results = compute_metrics(list(key_paths.keys())) + with open ("./spine-generic-test-results/miccai_results.json", "w") as fp: + json.dump(results, fp, indent=4) + + with open("./spine-generic-test-results/miccai_table_export.txt", "w") as fp: + names = [] + for key, value in results.items(): + names.append(key + "\n") + line = "\\texttt" + "{" + f"{key_paths[key]}" + "}" + f"& {round(value['avg_dice'],2)} ± {round(value['conf_dice'],2)} & {round(value['avg_vol'],2)} ± {round(value['conf_vol'],2)} \\\\ \n" + fp.write(line) + \ No newline at end of file From eb4c081786e1075c76f129fa4f00068f2385197a Mon Sep 17 00:00:00 2001 From: ebadrian Date: Thu, 9 Mar 2023 16:23:38 -0500 Subject: [PATCH 09/11] Re-organizing folder structure --- inference.sh => evaluation/inference.sh | 0 .../change_mts_filenames.py | 2 -- .../config_generator.py | 0 batch_run.sh => utils/create_joblibs.sh | 28 +++---------------- 4 files changed, 4 insertions(+), 26 deletions(-) rename inference.sh => evaluation/inference.sh (100%) rename change_mts_filenames.py => utils/change_mts_filenames.py (97%) rename config_generator.py => utils/config_generator.py (100%) rename batch_run.sh => utils/create_joblibs.sh (70%) diff --git a/inference.sh b/evaluation/inference.sh similarity index 100% rename from inference.sh rename to evaluation/inference.sh diff --git a/change_mts_filenames.py b/utils/change_mts_filenames.py similarity index 97% rename from change_mts_filenames.py rename to utils/change_mts_filenames.py index 396fe733..b98570a3 100644 --- a/change_mts_filenames.py +++ b/utils/change_mts_filenames.py @@ -27,8 +27,6 @@ from glob import glob if __name__ == "__main__": - #dataset_type = "data_processed_clean_MTon_MTS" - #dataset_type = "data_processed_clean_T1w_MTS" user = "adelba" # POLYGRAMS user_temp_folder = "adrian" # DUKE TEMP FOLDER NAME dataset_type = "data_processed_clean" diff --git a/config_generator.py b/utils/config_generator.py similarity index 100% rename from config_generator.py rename to utils/config_generator.py diff --git a/batch_run.sh b/utils/create_joblibs.sh similarity index 70% rename from batch_run.sh rename to utils/create_joblibs.sh index ece1faad..c0b0ee8e 100644 --- a/batch_run.sh +++ b/utils/create_joblibs.sh @@ -1,4 +1,8 @@ ####### Config creation ####### +## Specific the contrasts you would like to consider during your experiments. +## You would need to create the config file for each one of your config +## template the following way: + #python config_generator.py --config config_templates/hard_hard.json \ # --datasets /home/GRAMES.POLYMTL.CA/adelba/duke/projects/ivadomed/contrast-agnostic-seg/contrast-agnostic-centerofmass-preprocess-clean-all-2022-10-22/data_processed_clean \ @@ -24,27 +28,3 @@ python config_generator.py --config config_templates/meanGT_soft.json \ # --ofolder joblibs/group-8 \ # --contrasts T1w T2w T2star rec-average_dwi \ # --seeds 15 - -####### Training Run ####### -seeds=(15) # seeds=(42 15 34 98 62) -config_types=("meanGT_soft") # ("hard_hard" "hard_soft" "meanGT_soft" "meanGT_hard") -contrasts=("T1w" "T2w" "T2star" "rec-average_dwi" "all") - -for seed in ${seeds[@]} -do - for config in ${config_types[@]} - do - for contrast in ${contrasts[@]} - do - sleep 5 - #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json - output_dir=./batch_results/group-9/"$config"_"$contrast"_seed="$seed" - echo $output_dir - mkdir $output_dir - #echo ./batch_configs/"$config"_"$contrast"_seed="$seed".json - CUDA_VISIBLE=0 ivadomed --train -c ./batch_configs/group-9/"$config"_"$contrast"_seed="$seed".json --path-output $output_dir - done - done -done - - \ No newline at end of file From e8bb0ed2511c5f3df835692131f14b7e501f709c Mon Sep 17 00:00:00 2001 From: ebadrian Date: Thu, 9 Mar 2023 16:36:39 -0500 Subject: [PATCH 10/11] README updates on how to reproduce MICCAI results --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7b213e4a..4b3b4177 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Re-run the analysis: [Launch processing](#launch-processing) ## Training ### config_generator.py -The script helps create joblibs that are going to represent splits of our dataset. It will create a joblibs folder containing the data split for each sub-experiment (i.e. hard_hard, soft_soft ...). The way we leverage the aforementioned python script is by running the bash script generate_config.sh that will execute the following command for each sub-experiment: +The script helps create joblibs that are going to represent splits of our dataset. It will create a joblibs folder containing the data split for each sub-experiment (i.e. hard_hard, soft_soft ...). The way we leverage the aforementioned python script is by running the bash script utils/create_joblibs.sh that will execute the following command for each sub-experiment: ``` python config_generator.py --config config_templates/hard_hard.json \ --datasets path/to/data @@ -104,8 +104,10 @@ For clarity, we go over a few examples about how to use the current training scr All training runs are using the ivadomed's framework and logging training metrics in a results folder (optionally with wandb). ### inference.sh -Once the models are trained, one can use the inference.sh bash script to segment SC for tests participants and qualitatively analyze the results. Again like in all bash scripts mentioned in this project, one has to change a few parameters to adapt to one's environment (e.g. dataset path ...). +Once the models are trained, one can use the evaluation/inference.sh bash script to segment SC for tests participants and qualitatively analyze the results. Again like in all bash scripts mentioned in this project, one has to change a few parameters to adapt to one's environment (e.g. dataset path ...). +### Evaluation on spine-generic-multi-subject (MICCAI 2023) +Once the inference is done for all models and to reproduce the results presented in our paper, one would have to run the compute_evaluation_metrics.py after specifying the experiment folder paths inside that python script. A spine-generic-test-results folder will be created, in which a json file with the DICE and Relative Volume Difference (RVD) metrics for each experiments on the test set. To obtain the aggregated results **per_contrast** and **all_contrast**, run the miccai_results_models.py script. It generates aggregated results by the aforementioned category of models and the associated Latex table used in the paper. ### compare_with_sct_model.py The comparison is being done by running `sct_deepseg_sc` on every subject/contrast that was used in the testing set on ivadomed. From c2ecc193f91688c69deec0d4be32e7fc3344fc00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandrine=20B=C3=A9dard?= <71230552+sandrinebedard@users.noreply.github.com> Date: Thu, 9 Mar 2023 17:10:40 -0500 Subject: [PATCH 11/11] Remove comparision with SCT --- README.md | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/README.md b/README.md index 4b3b4177..3434d6e8 100644 --- a/README.md +++ b/README.md @@ -109,26 +109,6 @@ Once the models are trained, one can use the evaluation/inference.shcompute_evaluation_metrics.py after specifying the experiment folder paths inside that python script. A spine-generic-test-results folder will be created, in which a json file with the DICE and Relative Volume Difference (RVD) metrics for each experiments on the test set. To obtain the aggregated results **per_contrast** and **all_contrast**, run the miccai_results_models.py script. It generates aggregated results by the aforementioned category of models and the associated Latex table used in the paper. -### compare_with_sct_model.py -The comparison is being done by running `sct_deepseg_sc` on every subject/contrast that was used in the testing set on ivadomed. - -One thing to note, is that the SCT scores have been marked after the usage of the function `sct_get_centerline` and cropping around this prior. -In order to make a fair comparison, the ivadomed model needs to be tested on a testing set that has the centerline precomputed. - -The function `compare_with_sct_model.py` prepares the dataset for this comparison by using `sct_get_centerline` on the images and using this prior on the TESTING set. - -The output folder will contain as many folders as inputs are given to `compare_with_sct_model.py`, with the suffix SCT. These folders "siumulate" output folders from ivadomed (they contain evaluation3dmetrics.csv files) in order to use violinpolots visualizations from the script `visualize_and_compare_testing_models.py` - - - -Problems with this approach: -1. _centerline.nii.gz derivatives for the testing set files are created in the database -2. The order that processes need to be done might confuse people a bit: - i. Joblib needs to be created - ii. The ivadomed model needs to be trained - iii. compare_with_sct_model script needs to run - iv. The ivadomed model needs to be tested - ## Compute CSA on prediction masks To compute CSA at C2-C3 vertebral levels on the prediction masks obtained from the trained models, the script `compute_csa.sh` is used. The input is the folder `data_processed_clean` (result from preprocessing) and the path of the prediction masks is added as an extra script argument `-script-args`.