From 980642bcfa35df31aea2906dfd610c93605406cc Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Mon, 25 Sep 2023 20:32:48 +0800 Subject: [PATCH] Using `EnsureChannelFirst` in `endoscopic_tool_segmentation` (#510) Fixes https://github.com/Project-MONAI/MONAI/issues/7036. ### Description Using `EnsureChannelFirst` in `endoscopic_tool_segmentation`. ### 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 --- .../configs/inference.json | 12 +++++------- .../configs/metadata.json | 5 +++-- .../endoscopic_tool_segmentation/configs/train.json | 13 ++++++++----- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/models/endoscopic_tool_segmentation/configs/inference.json b/models/endoscopic_tool_segmentation/configs/inference.json index 93dc7927..0f140d04 100644 --- a/models/endoscopic_tool_segmentation/configs/inference.json +++ b/models/endoscopic_tool_segmentation/configs/inference.json @@ -24,15 +24,13 @@ "transforms": [ { "_target_": "LoadImaged", - "keys": [ - "image" - ] + "keys": "image", + "image_only": false }, { - "_target_": "AsChannelFirstd", - "keys": [ - "image" - ] + "_target_": "EnsureChannelFirstd", + "keys": "image", + "channel_dim": -1 }, { "_target_": "Resized", diff --git a/models/endoscopic_tool_segmentation/configs/metadata.json b/models/endoscopic_tool_segmentation/configs/metadata.json index c4b5af76..b70f30f7 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.4", + "version": "0.5.5", "changelog": { + "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", "0.5.2": "remove the CheckpointLoader from the train.json", @@ -25,7 +26,7 @@ "0.1.0": "complete the first version model package", "0.0.1": "initialize the model package structure" }, - "monai_version": "1.2.0", + "monai_version": "1.3.0rc1", "pytorch_version": "1.13.1", "numpy_version": "1.22.2", "optional_packages_version": { diff --git a/models/endoscopic_tool_segmentation/configs/train.json b/models/endoscopic_tool_segmentation/configs/train.json index 28a182d8..0bab96da 100644 --- a/models/endoscopic_tool_segmentation/configs/train.json +++ b/models/endoscopic_tool_segmentation/configs/train.json @@ -53,15 +53,18 @@ "keys": [ "image", "label" - ] + ], + "image_only": false }, { - "_target_": "AsChannelFirstd", - "keys": "image" + "_target_": "EnsureChannelFirstd", + "keys": "image", + "channel_dim": -1 }, { - "_target_": "AddChanneld", - "keys": "label" + "_target_": "EnsureChannelFirstd", + "keys": "label", + "channel_dim": "no_channel" }, { "_target_": "Resized",