From 1cff8b788aaedd683ced9c355cca8d7bb10ff99a Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Mon, 16 Oct 2023 10:10:51 +0800 Subject: [PATCH] Update to use MONAI v1.3 (#524) Part of https://github.com/Project-MONAI/model-zoo/pull/509. ### Status **Ready** ### Please ensure all the checkboxes: - [x] Codeformat tests passed locally by running `./runtests.sh --codeformat`. - [ ] In-line docstrings updated. - [x] Update `version` and `changelog` in `metadata.json` if changing an existing bundle. - [ ] Please ensure the naming rules in config files meet our requirements (please refer to: `CONTRIBUTING.md`). - [ ] Ensure versions of packages such as `monai`, `pytorch` and `numpy` are correct in `metadata.json`. - [ ] Descriptions should be consistent with the content, such as `eval_metrics` of the provided weights and TorchScript modules. - [ ] Files larger than 25MB are excluded and replaced by providing download links in `large_file.yml`. - [ ] Avoid using path that contains personal information within config files (such as use `/home/your_name/` for `"bundle_root"`). --------- Signed-off-by: KumoLiu Co-authored-by: Wenqi Li <831580+wyli@users.noreply.github.com> --- .../configs/metadata.json | 5 +++-- .../configs/inference.json | 3 ++- .../configs/metadata.json | 5 +++-- .../pathology_nuclick_annotation/configs/train.json | 6 ++++-- .../configs/inference.json | 3 ++- .../configs/metadata.json | 5 +++-- .../configs/train.json | 5 +++-- .../configs/inference.json | 7 +++---- .../configs/metadata.json | 11 ++++++----- .../configs/metadata.json | 5 +++-- .../configs/evaluate.json | 2 +- .../configs/inference.json | 2 -- .../configs/metadata.json | 5 +++-- .../configs/inference.json | 3 ++- .../configs/metadata.json | 5 +++-- .../configs/train.json | 13 +++++++------ .../wholeBody_ct_segmentation/configs/evaluate.json | 2 +- .../configs/inference.json | 2 -- .../wholeBody_ct_segmentation/configs/metadata.json | 5 +++-- 19 files changed, 52 insertions(+), 42 deletions(-) diff --git a/models/endoscopic_tool_segmentation/configs/metadata.json b/models/endoscopic_tool_segmentation/configs/metadata.json index b70f30f7..1fba50a7 100644 --- a/models/endoscopic_tool_segmentation/configs/metadata.json +++ b/models/endoscopic_tool_segmentation/configs/metadata.json @@ -1,7 +1,8 @@ { "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json", - "version": "0.5.5", + "version": "0.5.6", "changelog": { + "0.5.6": "update to use monai 1.3.0", "0.5.5": "update AddChanneld with EnsureChannelFirstd and set image_only to False", "0.5.4": "fix the wrong GPU index issue of multi-node", "0.5.3": "remove error dollar symbol in readme", @@ -26,7 +27,7 @@ "0.1.0": "complete the first version model package", "0.0.1": "initialize the model package structure" }, - "monai_version": "1.3.0rc1", + "monai_version": "1.3.0", "pytorch_version": "1.13.1", "numpy_version": "1.22.2", "optional_packages_version": { diff --git a/models/pathology_nuclick_annotation/configs/inference.json b/models/pathology_nuclick_annotation/configs/inference.json index e31c17fc..c21e9c89 100644 --- a/models/pathology_nuclick_annotation/configs/inference.json +++ b/models/pathology_nuclick_annotation/configs/inference.json @@ -33,7 +33,8 @@ { "_target_": "LoadImaged", "keys": "image", - "dtype": "uint8" + "dtype": "uint8", + "image_only": false }, { "_target_": "EnsureChannelFirstd", diff --git a/models/pathology_nuclick_annotation/configs/metadata.json b/models/pathology_nuclick_annotation/configs/metadata.json index a4d30da1..a02729f1 100644 --- a/models/pathology_nuclick_annotation/configs/metadata.json +++ b/models/pathology_nuclick_annotation/configs/metadata.json @@ -1,7 +1,8 @@ { "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json", - "version": "0.1.5", + "version": "0.1.6", "changelog": { + "0.1.6": "set image_only to False", "0.1.5": "add support for TensorRT conversion and inference", "0.1.4": "fix the wrong GPU index issue of multi-node", "0.1.3": "remove error dollar symbol in readme", @@ -18,7 +19,7 @@ "0.0.2": "Update The Torch Vision Transform", "0.0.1": "initialize the model package structure" }, - "monai_version": "1.2.0", + "monai_version": "1.3.0", "pytorch_version": "1.13.1", "numpy_version": "1.22.2", "optional_packages_version": { diff --git a/models/pathology_nuclick_annotation/configs/train.json b/models/pathology_nuclick_annotation/configs/train.json index f2ba5233..b1281626 100644 --- a/models/pathology_nuclick_annotation/configs/train.json +++ b/models/pathology_nuclick_annotation/configs/train.json @@ -51,7 +51,8 @@ "image", "label" ], - "dtype": "uint8" + "dtype": "uint8", + "image_only": false }, { "_target_": "EnsureChannelFirstd", @@ -207,7 +208,8 @@ "image", "label" ], - "dtype": "uint8" + "dtype": "uint8", + "image_only": false }, { "_target_": "EnsureChannelFirstd", diff --git a/models/renalStructures_CECT_segmentation/configs/inference.json b/models/renalStructures_CECT_segmentation/configs/inference.json index db19b61a..040a6330 100644 --- a/models/renalStructures_CECT_segmentation/configs/inference.json +++ b/models/renalStructures_CECT_segmentation/configs/inference.json @@ -41,7 +41,8 @@ "vein", "excret", "label" - ] + ], + "image_only": false }, { "_target_": "EnsureChannelFirstd", diff --git a/models/renalStructures_CECT_segmentation/configs/metadata.json b/models/renalStructures_CECT_segmentation/configs/metadata.json index 9d0277af..ecc7774d 100644 --- a/models/renalStructures_CECT_segmentation/configs/metadata.json +++ b/models/renalStructures_CECT_segmentation/configs/metadata.json @@ -1,10 +1,11 @@ { "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json", - "version": "0.1.0", + "version": "0.2.0", "changelog": { + "0.2.0": "set image_only to False", "0.1.0": "complete the model package" }, - "monai_version": "1.2.0", + "monai_version": "1.3.0", "pytorch_version": "1.13.1", "numpy_version": "1.24.3", "optional_packages_version": { diff --git a/models/renalStructures_CECT_segmentation/configs/train.json b/models/renalStructures_CECT_segmentation/configs/train.json index 82d563bb..7d1beded 100644 --- a/models/renalStructures_CECT_segmentation/configs/train.json +++ b/models/renalStructures_CECT_segmentation/configs/train.json @@ -73,7 +73,8 @@ "reader": null, "overwriting": false, "dtype": "float32", - "as_closest_canonical": true + "as_closest_canonical": true, + "image_only": false }, { "_target_": "EnsureChannelFirstd", @@ -284,7 +285,7 @@ ] }, { - "_target_": "SplitChanneld", + "_target_": "SplitDimd", "keys": [ "pred", "label" diff --git a/models/renalStructures_UNEST_segmentation/configs/inference.json b/models/renalStructures_UNEST_segmentation/configs/inference.json index f58a2d53..52eec8cf 100644 --- a/models/renalStructures_UNEST_segmentation/configs/inference.json +++ b/models/renalStructures_UNEST_segmentation/configs/inference.json @@ -22,8 +22,9 @@ "keys": "image" }, { - "_target_": "AddChanneld", - "keys": "image" + "_target_": "EnsureChannelFirstd", + "keys": "image", + "channel_dim": "no_channel" }, { "_target_": "Orientationd", @@ -90,7 +91,6 @@ "keys": "pred", "transform": "@preprocessing", "orig_keys": "image", - "meta_key_postfix": "meta_dict", "nearest_interp": false, "to_tensor": true }, @@ -102,7 +102,6 @@ { "_target_": "SaveImaged", "keys": "pred", - "meta_keys": "pred_meta_dict", "output_dir": "@output_dir" } ] diff --git a/models/renalStructures_UNEST_segmentation/configs/metadata.json b/models/renalStructures_UNEST_segmentation/configs/metadata.json index 8485a2d8..06c84f20 100644 --- a/models/renalStructures_UNEST_segmentation/configs/metadata.json +++ b/models/renalStructures_UNEST_segmentation/configs/metadata.json @@ -1,7 +1,8 @@ { "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json", - "version": "0.2.2", + "version": "0.2.3", "changelog": { + "0.2.3": "update AddChanneld with EnsureChannelFirstd and remove meta_dict", "0.2.2": "add name tag", "0.2.1": "fix license Copyright error", "0.2.0": "update license files", @@ -10,16 +11,16 @@ "0.1.1": "fixed the model state dict name", "0.1.0": "complete the model package" }, - "monai_version": "1.0.0", - "pytorch_version": "1.10.0", - "numpy_version": "1.21.2", + "monai_version": "1.3.0", + "pytorch_version": "1.13.1", + "numpy_version": "1.22.2", "optional_packages_version": { "nibabel": "3.2.1", "pytorch-ignite": "0.4.8", "einops": "0.4.1", "fire": "0.4.0", "timm": "0.6.7", - "torchvision": "0.11.1" + "torchvision": "0.14.1" }, "name": "Renal structures UNEST segmentation", "task": "Renal segmentation", diff --git a/models/spleen_deepedit_annotation/configs/metadata.json b/models/spleen_deepedit_annotation/configs/metadata.json index 115192fc..3afadb0d 100644 --- a/models/spleen_deepedit_annotation/configs/metadata.json +++ b/models/spleen_deepedit_annotation/configs/metadata.json @@ -1,7 +1,8 @@ { "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json", - "version": "0.5.2", + "version": "0.5.3", "changelog": { + "0.5.3": "update to use monai 1.3.0", "0.5.2": "update the checkpoint loader logic for inference", "0.5.1": "add option to validate at training start, and I/O param entries", "0.5.0": "enable finetune and early stop", @@ -29,7 +30,7 @@ "0.1.0": "complete the model package", "0.0.1": "initialize the model package structure" }, - "monai_version": "1.3.0rc5", + "monai_version": "1.3.0", "pytorch_version": "1.13.1", "numpy_version": "1.22.2", "optional_packages_version": { diff --git a/models/swin_unetr_btcv_segmentation/configs/evaluate.json b/models/swin_unetr_btcv_segmentation/configs/evaluate.json index 2b2ed19d..537d36c5 100644 --- a/models/swin_unetr_btcv_segmentation/configs/evaluate.json +++ b/models/swin_unetr_btcv_segmentation/configs/evaluate.json @@ -66,7 +66,7 @@ "metric_details": [ "val_mean_dice" ], - "batch_transform": "$monai.handlers.from_engine(['image_meta_dict'])", + "batch_transform": "$lambda x: [xx['image'].meta for xx in x]", "summary_ops": "*" } ], diff --git a/models/swin_unetr_btcv_segmentation/configs/inference.json b/models/swin_unetr_btcv_segmentation/configs/inference.json index b9c196d1..9980d60c 100644 --- a/models/swin_unetr_btcv_segmentation/configs/inference.json +++ b/models/swin_unetr_btcv_segmentation/configs/inference.json @@ -95,7 +95,6 @@ "keys": "pred", "transform": "@preprocessing", "orig_keys": "image", - "meta_key_postfix": "meta_dict", "nearest_interp": false, "to_tensor": true }, @@ -107,7 +106,6 @@ { "_target_": "SaveImaged", "keys": "pred", - "meta_keys": "pred_meta_dict", "output_dir": "@output_dir" } ] diff --git a/models/swin_unetr_btcv_segmentation/configs/metadata.json b/models/swin_unetr_btcv_segmentation/configs/metadata.json index 5c47077d..7895b092 100644 --- a/models/swin_unetr_btcv_segmentation/configs/metadata.json +++ b/models/swin_unetr_btcv_segmentation/configs/metadata.json @@ -1,7 +1,8 @@ { "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json", - "version": "0.5.0", + "version": "0.5.1", "changelog": { + "0.5.1": "remove meta_dict usage", "0.5.0": "fix the wrong GPU index issue of multi-node", "0.4.9": "remove error dollar symbol in readme", "0.4.8": "add RAM usage with CacheDataset", @@ -27,7 +28,7 @@ "0.1.0": "complete the model package", "0.0.1": "initialize the model package structure" }, - "monai_version": "1.2.0", + "monai_version": "1.3.0", "pytorch_version": "1.13.1", "numpy_version": "1.22.2", "optional_packages_version": { diff --git a/models/ventricular_short_axis_3label/configs/inference.json b/models/ventricular_short_axis_3label/configs/inference.json index 6eee6bfa..b818ef23 100644 --- a/models/ventricular_short_axis_3label/configs/inference.json +++ b/models/ventricular_short_axis_3label/configs/inference.json @@ -34,7 +34,8 @@ "transforms": [ { "_target_": "LoadImaged", - "keys": "image" + "keys": "image", + "image_only": false }, { "_target_": "EnsureChannelFirstd", diff --git a/models/ventricular_short_axis_3label/configs/metadata.json b/models/ventricular_short_axis_3label/configs/metadata.json index 9ed269b2..f700a801 100644 --- a/models/ventricular_short_axis_3label/configs/metadata.json +++ b/models/ventricular_short_axis_3label/configs/metadata.json @@ -1,14 +1,15 @@ { "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json", - "version": "0.3.2", + "version": "0.3.3", "changelog": { + "0.3.3": "update AddChanneld with EnsureChannelFirstd", "0.3.2": "add name tag", "0.3.1": "modify dataset key name", "0.3.0": "update license files", "0.2.0": "unify naming", "0.1.0": "Initial version" }, - "monai_version": "1.0.1", + "monai_version": "1.3.0", "pytorch_version": "1.13.0", "numpy_version": "1.21.2", "optional_packages_version": { diff --git a/models/ventricular_short_axis_3label/configs/train.json b/models/ventricular_short_axis_3label/configs/train.json index ad1c4bc4..2111e201 100644 --- a/models/ventricular_short_axis_3label/configs/train.json +++ b/models/ventricular_short_axis_3label/configs/train.json @@ -62,8 +62,9 @@ "keys": "image" }, { - "_target_": "AddChanneld", - "keys": "@both_keys" + "_target_": "EnsureChannelFirstd", + "keys": "@both_keys", + "channel_dim": "no_channel" }, { "_target_": "RandAxisFlipd", @@ -98,8 +99,7 @@ "translate_range": 50, "scale_range": 0.25, "padding_mode": "$monai.utils.GridSamplePadMode.ZEROS", - "mode": "$(monai.utils.GridSampleMode.BILINEAR,monai.utils.GridSampleMode.NEAREST)", - "as_tensor_output": false + "mode": "$(monai.utils.GridSampleMode.BILINEAR,monai.utils.GridSampleMode.NEAREST)" }, { "_target_": "RandSmoothFieldAdjustContrastd", @@ -167,8 +167,9 @@ "keys": "image" }, { - "_target_": "AddChanneld", - "keys": "@both_keys" + "_target_": "EnsureChannelFirstd", + "keys": "@both_keys", + "channel_dim": "no_channel" }, { "_target_": "EnsureTyped", diff --git a/models/wholeBody_ct_segmentation/configs/evaluate.json b/models/wholeBody_ct_segmentation/configs/evaluate.json index 0c6cc91c..b01fdcee 100644 --- a/models/wholeBody_ct_segmentation/configs/evaluate.json +++ b/models/wholeBody_ct_segmentation/configs/evaluate.json @@ -67,7 +67,7 @@ "metric_details": [ "val_mean_dice" ], - "batch_transform": "$monai.handlers.from_engine(['image_meta_dict'])", + "batch_transform": "$lambda x: [xx['image'].meta for xx in x]", "summary_ops": "*" } ], diff --git a/models/wholeBody_ct_segmentation/configs/inference.json b/models/wholeBody_ct_segmentation/configs/inference.json index 94ac74c7..dbecbafb 100644 --- a/models/wholeBody_ct_segmentation/configs/inference.json +++ b/models/wholeBody_ct_segmentation/configs/inference.json @@ -117,14 +117,12 @@ "keys": "pred", "transform": "@preprocessing", "orig_keys": "image", - "meta_key_postfix": "meta_dict", "nearest_interp": true, "to_tensor": true }, { "_target_": "SaveImaged", "keys": "pred", - "meta_keys": "pred_meta_dict", "output_dir": "@output_dir" } ] diff --git a/models/wholeBody_ct_segmentation/configs/metadata.json b/models/wholeBody_ct_segmentation/configs/metadata.json index 0a5d8e1a..b2e5303a 100644 --- a/models/wholeBody_ct_segmentation/configs/metadata.json +++ b/models/wholeBody_ct_segmentation/configs/metadata.json @@ -1,7 +1,8 @@ { "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json", - "version": "0.2.0", + "version": "0.2.1", "changelog": { + "0.2.1": "remove meta_dict usage", "0.2.0": "add support for TensorRT conversion and inference", "0.1.9": "fix the wrong GPU index issue of multi-node", "0.1.8": "Update evalaute doc, GPU usage details, and dataset preparation instructions", @@ -15,7 +16,7 @@ "0.1.0": "complete the model package", "0.0.1": "initialize the model package structure" }, - "monai_version": "1.2.0", + "monai_version": "1.3.0", "pytorch_version": "1.13.1", "numpy_version": "1.22.2", "optional_packages_version": {