diff --git a/models/wholeBody_ct_segmentation/configs/evaluate.json b/models/wholeBody_ct_segmentation/configs/evaluate.json index 0c6cc91c..147046fd 100644 --- a/models/wholeBody_ct_segmentation/configs/evaluate.json +++ b/models/wholeBody_ct_segmentation/configs/evaluate.json @@ -9,30 +9,17 @@ }, { "_target_": "Invertd", - "keys": [ - "pred", - "label" - ], + "keys": "pred", "transform": "@validate#preprocessing", "orig_keys": "image", "meta_key_postfix": "meta_dict", - "nearest_interp": [ - true, - true - ], + "nearest_interp": true, "to_tensor": true }, { "_target_": "AsDiscreted", - "keys": [ - "pred", - "label" - ], - "argmax": [ - true, - false - ], - "to_onehot": 105 + "keys": "pred", + "argmax": true }, { "_target_": "SaveImaged", @@ -61,8 +48,7 @@ "_target_": "MetricsSaver", "save_dir": "@output_dir", "metrics": [ - "val_mean_dice", - "val_acc" + "val_mean_dice" ], "metric_details": [ "val_mean_dice" diff --git a/models/wholeBody_ct_segmentation/configs/train.json b/models/wholeBody_ct_segmentation/configs/train.json index 8caf7d2e..977b1b99 100644 --- a/models/wholeBody_ct_segmentation/configs/train.json +++ b/models/wholeBody_ct_segmentation/configs/train.json @@ -21,6 +21,8 @@ "pixdim": "$[1.5, 1.5, 1.5] if @displayable_configs#highres else [3.0, 3.0, 3.0]", "modelname": "$'model.pt' if @displayable_configs#highres else 'model_lowres.pt'", "device": "$torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')", + "lazy": false, + "overrides": "${'mode': ('bilinear', 'nearest'), 'padding_mode': ('zeros', 'zeros'), 'dtype': torch.float32}", "network_def": { "_target_": "SegResNet", "spatial_dims": 3, @@ -96,9 +98,10 @@ ] }, { - "_target_": "NormalizeIntensityd", + "_target_": "ScaleIntensityd", "keys": "image", - "nonzero": true + "minv": 0.0, + "maxv": 1.0 }, { "_target_": "CropForegroundd", @@ -121,12 +124,6 @@ ], "sigma": 0.4 }, - { - "_target_": "ScaleIntensityd", - "keys": "image", - "minv": -1.0, - "maxv": 1.0 - }, { "_target_": "EnsureTyped", "keys": [ @@ -152,7 +149,13 @@ ], "preprocessing": { "_target_": "Compose", - "transforms": "$@train#deterministic_transforms + @train#random_transforms" + "transforms": "$@train#deterministic_transforms + @train#random_transforms", + "lazy_evaluation": "@lazy", + "override_keys": [ + "image", + "label" + ], + "overrides": "@overrides" }, "dataset": { "_target_": "CacheDataset", @@ -213,9 +216,11 @@ } ], "key_metric": { - "train_accuracy": { - "_target_": "ignite.metrics.Accuracy", - "output_transform": "$monai.handlers.from_engine(['pred', 'label'])" + "train_mean_dice": { + "_target_": "MeanDice", + "include_background": false, + "output_transform": "$monai.handlers.from_engine(['pred', 'label'])", + "num_classes": 105 } }, "trainer": { @@ -234,95 +239,79 @@ } }, "validate": { + "transforms": [ + { + "_target_": "LoadImaged", + "keys": [ + "image", + "label" + ] + }, + { + "_target_": "EnsureChannelFirstd", + "keys": [ + "image", + "label" + ] + }, + { + "_target_": "EnsureTyped", + "keys": "image" + }, + { + "_target_": "Orientationd", + "keys": "image", + "axcodes": "RAS" + }, + { + "_target_": "Spacingd", + "keys": "image", + "pixdim": "@pixdim", + "mode": "bilinear" + }, + { + "_target_": "Identityd", + "keys": "image" + }, + { + "_target_": "ScaleIntensityd", + "keys": "image", + "minv": 0.0, + "maxv": 1.0 + }, + { + "_target_": "CropForegroundd", + "keys": "image", + "source_key": "image", + "margin": 10, + "k_divisible": [ + 96, + 96, + 96 + ] + }, + { + "_target_": "GaussianSmoothd", + "keys": [ + "image" + ], + "sigma": 0.4 + } + ], "preprocessing": { "_target_": "Compose", - "transforms": [ - { - "_target_": "LoadImaged", - "keys": [ - "image", - "label" - ] - }, - { - "_target_": "EnsureChannelFirstd", - "keys": [ - "image", - "label" - ] - }, - { - "_target_": "EnsureTyped", - "keys": [ - "image", - "label" - ] - }, - { - "_target_": "Orientationd", - "keys": [ - "image", - "label" - ], - "axcodes": "RAS" - }, - { - "_target_": "Spacingd", - "keys": [ - "image", - "label" - ], - "pixdim": "@pixdim", - "mode": [ - "bilinear", - "nearest" - ] - }, - { - "_target_": "NormalizeIntensityd", - "keys": "image", - "nonzero": true - }, - { - "_target_": "CropForegroundd", - "keys": [ - "image", - "label" - ], - "source_key": "image", - "margin": 10, - "k_divisible": [ - 96, - 96, - 96 - ] - }, - { - "_target_": "GaussianSmoothd", - "keys": [ - "image" - ], - "sigma": 0.4 - }, - { - "_target_": "ScaleIntensityd", - "keys": "image", - "minv": -1.0, - "maxv": 1.0 - }, - { - "_target_": "CenterSpatialCropd", - "keys": [ - "image", - "label" - ], - "roi_size": [ - 160, - 160, - 160 - ] - } - ] + "transforms": "@validate#transforms", + "lazy_evaluation": "@lazy", + "override_keys": [ + "image", + "label" + ], + "overrides": "@overrides" + }, + "preprocessing_inverse": { + "_target_": "Compose", + "transforms": "@validate#transforms", + "lazy_evaluation": false }, "postprocessing": { "_target_": "Compose", @@ -335,14 +324,20 @@ { "_target_": "AsDiscreted", "keys": [ - "pred", - "label" + "pred" ], "argmax": [ - true, - false - ], - "to_onehot": 105 + true + ] + }, + { + "_target_": "Invertd", + "keys": "pred", + "transform": "@validate#preprocessing_inverse", + "orig_keys": "image", + "meta_key_postfix": "meta_dict", + "nearest_interp": true, + "to_tensor": true } ] }, @@ -392,13 +387,8 @@ "val_mean_dice": { "_target_": "MeanDice", "include_background": false, - "output_transform": "$monai.handlers.from_engine(['pred', 'label'])" - } - }, - "additional_metrics": { - "val_accuracy": { - "_target_": "ignite.metrics.Accuracy", - "output_transform": "$monai.handlers.from_engine(['pred', 'label'])" + "output_transform": "$monai.handlers.from_engine(['pred', 'label'])", + "num_classes": 105 } }, "evaluator": { @@ -409,7 +399,6 @@ "inferer": "@validate#inferer", "postprocessing": "@validate#postprocessing", "key_val_metric": "@validate#key_metric", - "additional_metrics": "@validate#additional_metrics", "val_handlers": "@validate#handlers", "amp": true }