From b7d389b444361e7bfa4e9326e7cc784d92bc261d Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Tue, 15 Oct 2024 18:58:25 +0800 Subject: [PATCH 01/12] add real time infer example Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- .../spleen_ct_segmentation_real_time/LICENSE | 201 ++++++++++++++++++ .../configs/inference.json | 165 ++++++++++++++ .../configs/logging.conf | 28 +++ .../configs/metadata.json | 75 +++++++ .../scripts/__init__.py | 0 .../scripts/inference.py | 106 +++++++++ 6 files changed, 575 insertions(+) create mode 100644 models/spleen_ct_segmentation_real_time/LICENSE create mode 100644 models/spleen_ct_segmentation_real_time/configs/inference.json create mode 100644 models/spleen_ct_segmentation_real_time/configs/logging.conf create mode 100644 models/spleen_ct_segmentation_real_time/configs/metadata.json create mode 100644 models/spleen_ct_segmentation_real_time/scripts/__init__.py create mode 100644 models/spleen_ct_segmentation_real_time/scripts/inference.py diff --git a/models/spleen_ct_segmentation_real_time/LICENSE b/models/spleen_ct_segmentation_real_time/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/models/spleen_ct_segmentation_real_time/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/models/spleen_ct_segmentation_real_time/configs/inference.json b/models/spleen_ct_segmentation_real_time/configs/inference.json new file mode 100644 index 00000000..f843dcf9 --- /dev/null +++ b/models/spleen_ct_segmentation_real_time/configs/inference.json @@ -0,0 +1,165 @@ +{ + "imports": [ + "$import glob", + "$import numpy", + "$import os" + ], + "bundle_root": ".", + "image_key": "image", + "output_dir": "$@bundle_root + '/eval'", + "output_ext": ".nii.gz", + "output_dtype": "$numpy.float32", + "output_postfix": "trans", + "separate_folder": true, + "load_pretrain": true, + "dataset_dir": "/workspace/data/Task09_Spleen", + "datalist": "$list(sorted(glob.glob(@dataset_dir + '/imagesTs/*.nii.gz')))", + "device": "$torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')", + "network_def": { + "_target_": "UNet", + "spatial_dims": 3, + "in_channels": 1, + "out_channels": 2, + "channels": [ + 16, + 32, + 64, + 128, + 256 + ], + "strides": [ + 2, + 2, + 2, + 2 + ], + "num_res_units": 2, + "norm": "batch" + }, + "network": "$@network_def.to(@device)", + "preprocessing": { + "_target_": "Compose", + "transforms": [ + { + "_target_": "LoadImaged", + "keys": "@image_key" + }, + { + "_target_": "EnsureChannelFirstd", + "keys": "@image_key" + }, + { + "_target_": "Orientationd", + "keys": "@image_key", + "axcodes": "RAS" + }, + { + "_target_": "Spacingd", + "keys": "@image_key", + "pixdim": [ + 1.5, + 1.5, + 2.0 + ], + "mode": "bilinear" + }, + { + "_target_": "ScaleIntensityRanged", + "keys": "@image_key", + "a_min": -57, + "a_max": 164, + "b_min": 0, + "b_max": 1, + "clip": true + }, + { + "_target_": "EnsureTyped", + "keys": "@image_key" + } + ] + }, + "dataset": { + "_target_": "Dataset", + "data": "$[{'image': i} for i in @datalist]", + "transform": "@preprocessing" + }, + "dataloader": { + "_target_": "DataLoader", + "dataset": "@dataset", + "batch_size": 1, + "shuffle": false, + "num_workers": 4 + }, + "inferer": { + "_target_": "SlidingWindowInferer", + "roi_size": [ + 96, + 96, + 96 + ], + "sw_batch_size": 4, + "overlap": 0.5 + }, + "postprocessing": { + "_target_": "Compose", + "transforms": [ + { + "_target_": "Activationsd", + "keys": "pred", + "softmax": true + }, + { + "_target_": "Invertd", + "keys": "pred", + "transform": "@preprocessing", + "orig_keys": "@image_key", + "nearest_interp": false, + "to_tensor": true + }, + { + "_target_": "AsDiscreted", + "keys": "pred", + "argmax": true + }, + { + "_target_": "SaveImaged", + "keys": "pred", + "output_dir": "@output_dir", + "output_ext": "@output_ext", + "output_dtype": "@output_dtype", + "output_postfix": "@output_postfix", + "separate_folder": "@separate_folder" + } + ] + }, + "handlers": [ + { + "_target_": "StatsHandler", + "iteration_log": false + } + ], + "evaluator": { + "_target_": "SupervisedEvaluator", + "device": "@device", + "val_data_loader": "@dataloader", + "network": "@network", + "inferer": "@inferer", + "postprocessing": "@postprocessing", + "val_handlers": "@handlers", + "amp": true + }, + "checkpointloader": { + "_target_": "CheckpointLoader", + "load_path": "$@bundle_root + '/models/model.pt'", + "load_dict": { + "model": "@network" + } + }, + "initialize": [ + "$monai.utils.set_determinism(seed=123)", + "$@checkpointloader(@evaluator) if @load_pretrain else None" + ], + "run": [ + "$@evaluator.run()" + ] +} diff --git a/models/spleen_ct_segmentation_real_time/configs/logging.conf b/models/spleen_ct_segmentation_real_time/configs/logging.conf new file mode 100644 index 00000000..2c95aa02 --- /dev/null +++ b/models/spleen_ct_segmentation_real_time/configs/logging.conf @@ -0,0 +1,28 @@ +[loggers] +keys=root + +[handlers] +keys=consoleHandler, fileHandler + +[formatters] +keys=fullFormatter + +[logger_root] +level=INFO +handlers=consoleHandler, fileHandler + +[handler_consoleHandler] +class=StreamHandler +level=INFO +formatter=fullFormatter +args=(sys.stdout,) + + +[handler_fileHandler] +class=FileHandler +level=DEBUG +formatter=fullFormatter +args=('./spleen1.log', 'a') + +[formatter_fullFormatter] +format=%(asctime)s - %(name)s - %(levelname)s - %(message)s diff --git a/models/spleen_ct_segmentation_real_time/configs/metadata.json b/models/spleen_ct_segmentation_real_time/configs/metadata.json new file mode 100644 index 00000000..7934e384 --- /dev/null +++ b/models/spleen_ct_segmentation_real_time/configs/metadata.json @@ -0,0 +1,75 @@ +{ + "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json", + "version": "0.0.1", + "changelog": { + "0.0.1": "add real time spleen segmentation model" + }, + "monai_version": "1.4.0", + "pytorch_version": "2.4.0", + "numpy_version": "1.24.4", + "optional_packages_version": { + "nibabel": "5.2.1", + "pytorch-ignite": "0.4.11" + }, + "name": "Spleen CT segmentation", + "task": "Decathlon spleen segmentation", + "description": "A real time inference model for spleen segmentation on CT images.", + "authors": "MONAI team", + "copyright": "Copyright (c) MONAI Consortium", + "data_source": "Task09_Spleen.tar from http://medicaldecathlon.com/", + "data_type": "nibabel", + "image_classes": "single channel data, intensity scaled to [0, 1]", + "label_classes": "single channel data, 1 is spleen, 0 is everything else", + "pred_classes": "2 channels OneHot data, channel 1 is spleen, channel 0 is background", + "intended_use": "This is an example, not to be used for diagnostic purposes", + "references": [ + "Xia, Yingda, et al. '3D Semi-Supervised Learning with Uncertainty-Aware Multi-View Co-Training. arXiv preprint arXiv:1811.12506 (2018). https://arxiv.org/abs/1811.12506.", + "Kerfoot E., Clough J., Oksuz I., Lee J., King A.P., Schnabel J.A. (2019) Left-Ventricle Quantification Using Residual U-Net. In: Pop M. et al. (eds) Statistical Atlases and Computational Models of the Heart. Atrial Segmentation and LV Quantification Challenges. STACOM 2018. Lecture Notes in Computer Science, vol 11395. Springer, Cham. https://doi.org/10.1007/978-3-030-12029-0_40" + ], + "network_data_format": { + "inputs": { + "image": { + "type": "image", + "format": "hounsfield", + "modality": "CT", + "num_channels": 1, + "spatial_shape": [ + 96, + 96, + 96 + ], + "dtype": "float32", + "value_range": [ + 0, + 1 + ], + "is_patch_data": true, + "channel_def": { + "0": "image" + } + } + }, + "outputs": { + "pred": { + "type": "image", + "format": "segmentation", + "num_channels": 2, + "spatial_shape": [ + 96, + 96, + 96 + ], + "dtype": "float32", + "value_range": [ + 0, + 1 + ], + "is_patch_data": true, + "channel_def": { + "0": "background", + "1": "spleen" + } + } + } + } +} diff --git a/models/spleen_ct_segmentation_real_time/scripts/__init__.py b/models/spleen_ct_segmentation_real_time/scripts/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/models/spleen_ct_segmentation_real_time/scripts/inference.py b/models/spleen_ct_segmentation_real_time/scripts/inference.py new file mode 100644 index 00000000..2323bca2 --- /dev/null +++ b/models/spleen_ct_segmentation_real_time/scripts/inference.py @@ -0,0 +1,106 @@ +# Copyright (c) MONAI Consortium +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import logging +import sys + +import torch + +from monai.apps import get_logger +from monai.bundle import BundleWorkflow +from monai.data import Dataset +from monai.inferers import SlidingWindowInferer +from monai.networks.nets import UNet +from monai.transforms import ( + Activationsd, + AsDiscreted, + Compose, + EnsureChannelFirstd, + ScaleIntensityd, + Orientationd, + Spacingd, + ScaleIntensityRanged +) +from monai.utils.enums import CommonKeys + + +class InferenceWorkflow(BundleWorkflow): + """ + Test class simulates the bundle workflow defined by Python script directly. + + Typical usage: + from monai.bundle import create_workflow + from monai.transforms import LoadImaged + + workflow = create_workflow("inference.InferenceWorkflow", dataset_dir="/workspace/Data/Task09_Spleen") + workflow.initialize() + input_loader = LoadImaged(keys="image") + workflow.dataflow.update(input_loader({"image": "/workspace/Data/Task09_Spleen/imagesTr/spleen_46.nii.gz"})) + workflow.run() + + # update dataflow + workflow.dataflow.clear() + workflow.dataflow.update({"image": "/workspace/Data/Task09_Spleen/imagesTr/spleen_38.nii.gz"}) + workflow.run() + + """ + + def __init__(self, dataset_dir: str = "./infer", bundle_root: str = "/workspace/Code/model-zoo/models/spleen_ct_segmentation_real_time_support"): + super().__init__(workflow="inference", properties_path="/workspace/Code/model-zoo/models/spleen_ct_segmentation_real_time_support/scripts/properties.json") + # set root log level to INFO and init a evaluation logger, will be used in `StatsHandler` + logging.basicConfig(stream=sys.stdout, level=logging.INFO) + get_logger("eval_log") + + self.dataset_dir = dataset_dir + self.bundle_root = bundle_root + self.dataflow = {} + self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu") + self.net = UNet( + spatial_dims=3, + in_channels=1, + out_channels=2, + channels=(16, 32, 64, 128), + strides=(2, 2, 2), + num_res_units=2, + ).to(self.device) + + self.preprocessing = Compose( + [ + EnsureChannelFirstd(keys=["image"]), + Orientationd(keys=["image"], axcodes="RAS"), + ScaleIntensityd(keys="image"), + Spacingd(keys=["image"], pixdim=(1.5, 1.5, 2.0), mode=("bilinear")), + ScaleIntensityRanged(keys="image", a_min=-57, a_max=164, b_min=0.0, b_max=1.0, clip=True), + ] + ) + def initialize(self): + + self.dataset = Dataset( + data=[self.dataflow], + transform=self.preprocessing, + ) + self.postprocessing = Compose( + [ + Activationsd(keys="pred", softmax=True), + AsDiscreted(keys="pred", argmax=True), + ] + ) + self.inferer = SlidingWindowInferer(roi_size=(96, 96, 96), sw_batch_size=1, overlap=0) + + def run(self): + data = self.dataset[0] + inputs = data[CommonKeys.IMAGE].unsqueeze(0).to(self.device) + # define sliding window size and batch size for windows inference + data[CommonKeys.PRED] = self.inferer(inputs, self.net) + self.dataflow.update({CommonKeys.PRED: self.postprocessing(data)[CommonKeys.PRED]}) + + def finalize(self): + pass From 880f09546e6b4bd24c30e87b2c83a98da80cf21c Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Tue, 15 Oct 2024 22:28:47 +0800 Subject: [PATCH 02/12] update to use PythonicWorkflow Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- .../scripts/inference.py | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/models/spleen_ct_segmentation_real_time/scripts/inference.py b/models/spleen_ct_segmentation_real_time/scripts/inference.py index 2323bca2..925b5ceb 100644 --- a/models/spleen_ct_segmentation_real_time/scripts/inference.py +++ b/models/spleen_ct_segmentation_real_time/scripts/inference.py @@ -15,7 +15,7 @@ import torch from monai.apps import get_logger -from monai.bundle import BundleWorkflow +from monai.bundle import PythonicWorkflow from monai.data import Dataset from monai.inferers import SlidingWindowInferer from monai.networks.nets import UNet @@ -32,7 +32,7 @@ from monai.utils.enums import CommonKeys -class InferenceWorkflow(BundleWorkflow): +class InferenceWorkflow(PythonicWorkflow): """ Test class simulates the bundle workflow defined by Python script directly. @@ -53,8 +53,8 @@ class InferenceWorkflow(BundleWorkflow): """ - def __init__(self, dataset_dir: str = "./infer", bundle_root: str = "/workspace/Code/model-zoo/models/spleen_ct_segmentation_real_time_support"): - super().__init__(workflow="inference", properties_path="/workspace/Code/model-zoo/models/spleen_ct_segmentation_real_time_support/scripts/properties.json") + def __init__(self, dataset_dir: str = "./infer", bundle_root: str = "/workspace/Code/model-zoo/models/spleen_ct_segmentation_real_time"): + super().__init__(workflow="inference", properties_path="/workspace/Code/model-zoo/models/spleen_ct_segmentation_real_time/scripts/properties.json") # set root log level to INFO and init a evaluation logger, will be used in `StatsHandler` logging.basicConfig(stream=sys.stdout, level=logging.INFO) get_logger("eval_log") @@ -62,7 +62,8 @@ def __init__(self, dataset_dir: str = "./infer", bundle_root: str = "/workspace/ self.dataset_dir = dataset_dir self.bundle_root = bundle_root self.dataflow = {} - self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu") + + def initialize(self): self.net = UNet( spatial_dims=3, in_channels=1, @@ -71,8 +72,7 @@ def __init__(self, dataset_dir: str = "./infer", bundle_root: str = "/workspace/ strides=(2, 2, 2), num_res_units=2, ).to(self.device) - - self.preprocessing = Compose( + preprocessing = Compose( [ EnsureChannelFirstd(keys=["image"]), Orientationd(keys=["image"], axcodes="RAS"), @@ -81,11 +81,9 @@ def __init__(self, dataset_dir: str = "./infer", bundle_root: str = "/workspace/ ScaleIntensityRanged(keys="image", a_min=-57, a_max=164, b_min=0.0, b_max=1.0, clip=True), ] ) - def initialize(self): - self.dataset = Dataset( data=[self.dataflow], - transform=self.preprocessing, + transform=preprocessing, ) self.postprocessing = Compose( [ @@ -104,3 +102,9 @@ def run(self): def finalize(self): pass + + def get_bundle_root(self): + return "." + + def get_device(self): + return torch.device("cuda" if torch.cuda.is_available() else "cpu") From 6b8c63880518df21e162c1ddfb187315b87c8f20 Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Tue, 15 Oct 2024 22:33:15 +0800 Subject: [PATCH 03/12] minor update Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- .../spleen_ct_segmentation_real_time/scripts/inference.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/models/spleen_ct_segmentation_real_time/scripts/inference.py b/models/spleen_ct_segmentation_real_time/scripts/inference.py index 925b5ceb..2fc76f79 100644 --- a/models/spleen_ct_segmentation_real_time/scripts/inference.py +++ b/models/spleen_ct_segmentation_real_time/scripts/inference.py @@ -53,14 +53,12 @@ class InferenceWorkflow(PythonicWorkflow): """ - def __init__(self, dataset_dir: str = "./infer", bundle_root: str = "/workspace/Code/model-zoo/models/spleen_ct_segmentation_real_time"): - super().__init__(workflow="inference", properties_path="/workspace/Code/model-zoo/models/spleen_ct_segmentation_real_time/scripts/properties.json") + def __init__(self, workflow_type: str = "inference", properties_path: str = "./properties.json"): + super().__init__(workflow_type=workflow_type, properties_path=properties_path) # set root log level to INFO and init a evaluation logger, will be used in `StatsHandler` logging.basicConfig(stream=sys.stdout, level=logging.INFO) get_logger("eval_log") - self.dataset_dir = dataset_dir - self.bundle_root = bundle_root self.dataflow = {} def initialize(self): From 0e1d13f20c04416bb571cbd2e05b1d6326a5a914 Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Tue, 15 Oct 2024 22:34:00 +0800 Subject: [PATCH 04/12] minor update Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- models/spleen_ct_segmentation_real_time/scripts/inference.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/spleen_ct_segmentation_real_time/scripts/inference.py b/models/spleen_ct_segmentation_real_time/scripts/inference.py index 2fc76f79..e00b3d7f 100644 --- a/models/spleen_ct_segmentation_real_time/scripts/inference.py +++ b/models/spleen_ct_segmentation_real_time/scripts/inference.py @@ -40,7 +40,7 @@ class InferenceWorkflow(PythonicWorkflow): from monai.bundle import create_workflow from monai.transforms import LoadImaged - workflow = create_workflow("inference.InferenceWorkflow", dataset_dir="/workspace/Data/Task09_Spleen") + workflow = create_workflow("inference.InferenceWorkflow") workflow.initialize() input_loader = LoadImaged(keys="image") workflow.dataflow.update(input_loader({"image": "/workspace/Data/Task09_Spleen/imagesTr/spleen_46.nii.gz"})) @@ -48,7 +48,7 @@ class InferenceWorkflow(PythonicWorkflow): # update dataflow workflow.dataflow.clear() - workflow.dataflow.update({"image": "/workspace/Data/Task09_Spleen/imagesTr/spleen_38.nii.gz"}) + workflow.dataflow.update(input_loader({"image": "/workspace/Data/Task09_Spleen/imagesTr/spleen_38.nii.gz"})) workflow.run() """ From 2b75338047d27e065aad2c959c75a1f2bde1ebee Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Tue, 15 Oct 2024 22:50:36 +0800 Subject: [PATCH 05/12] update Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- .../spleen_ct_segmentation_real_time/scripts/inference.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/models/spleen_ct_segmentation_real_time/scripts/inference.py b/models/spleen_ct_segmentation_real_time/scripts/inference.py index e00b3d7f..7ae61e1d 100644 --- a/models/spleen_ct_segmentation_real_time/scripts/inference.py +++ b/models/spleen_ct_segmentation_real_time/scripts/inference.py @@ -51,6 +51,8 @@ class InferenceWorkflow(PythonicWorkflow): workflow.dataflow.update(input_loader({"image": "/workspace/Data/Task09_Spleen/imagesTr/spleen_38.nii.gz"})) workflow.run() + # get output + output = workflow.dataflow[CommonKeys.PRED] """ def __init__(self, workflow_type: str = "inference", properties_path: str = "./properties.json"): @@ -94,8 +96,9 @@ def initialize(self): def run(self): data = self.dataset[0] inputs = data[CommonKeys.IMAGE].unsqueeze(0).to(self.device) - # define sliding window size and batch size for windows inference - data[CommonKeys.PRED] = self.inferer(inputs, self.net) + self.net.eval() + with torch.no_grad(): + data[CommonKeys.PRED] = self.inferer(inputs, self.net) self.dataflow.update({CommonKeys.PRED: self.postprocessing(data)[CommonKeys.PRED]}) def finalize(self): From 0af38a98e8bfe1ee01a1e68685d44b75810a476b Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Tue, 15 Oct 2024 23:27:35 +0800 Subject: [PATCH 06/12] update readme Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- .../docs/README.md | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 models/spleen_ct_segmentation_real_time/docs/README.md diff --git a/models/spleen_ct_segmentation_real_time/docs/README.md b/models/spleen_ct_segmentation_real_time/docs/README.md new file mode 100644 index 00000000..a4eef985 --- /dev/null +++ b/models/spleen_ct_segmentation_real_time/docs/README.md @@ -0,0 +1,103 @@ +# Model Overview +A pre-trained model for volumetric (3D) segmentation of the spleen from CT images. + +This model is trained using the runner-up [1] awarded pipeline of the "Medical Segmentation Decathlon Challenge 2018" using the UNet architecture [2] with 32 training images and 9 validation images. + +![model workflow](https://developer.download.nvidia.com/assets/Clara/Images/clara_pt_spleen_ct_segmentation_workflow.png) + +## Data +The training dataset is the Spleen Task from the Medical Segmentation Decathalon. Users can find more details on the datasets at http://medicaldecathlon.com/. + +- Target: Spleen +- Modality: CT +- Size: 61 3D volumes (41 Training + 20 Testing) +- Source: Memorial Sloan Kettering Cancer Center +- Challenge: Large-ranging foreground size + +## Training configuration +The segmentation of spleen region is formulated as the voxel-wise binary classification. Each voxel is predicted as either foreground (spleen) or background. And the model is optimized with gradient descent method minimizing Dice + cross entropy loss between the predicted mask and ground truth segmentation. + +The training was performed with the following: + +- GPU: at least 12GB of GPU memory +- Actual Model Input: 96 x 96 x 96 +- AMP: True +- Optimizer: Novograd +- Learning Rate: 0.002 +- Loss: DiceCELoss +- Dataset Manager: CacheDataset + +### Memory Consumption Warning + +If you face memory issues with CacheDataset, you can either switch to a regular Dataset class or lower the caching rate `cache_rate` in the configurations within range [0, 1] to minimize the System RAM requirements. + +### Input +One channel +- CT image + +### Output +Two channels +- Label 1: spleen +- Label 0: everything else + +### Typical Usage: Real-Time Inference Execution + +The following example demonstrates how to execute real-time inference using both Pythonic and config-based bundles with MONAI: + +``` +from monai.bundle import create_workflow +from monai.transforms import LoadImaged +from monai.data import CommonKeys # Ensure proper imports + +# Pythonic bundle workflow creation +workflow = create_workflow("inference.InferenceWorkflow") + +# Config-based workflow creation +workflow = create_workflow(config_file="./inference.json") + +# Initialize the workflow +workflow.initialize() + +# Load input data +input_loader = LoadImaged(keys="image") +workflow.dataflow.update(input_loader({"image": "/workspace/Data/Task09_Spleen/imagesTr/spleen_46.nii.gz"})) + +# Run the inference +workflow.run() + +# Update dataflow with new input +workflow.dataflow.clear() +workflow.dataflow.update(input_loader({"image": "/workspace/Data/Task09_Spleen/imagesTr/spleen_38.nii.gz"})) + +# Run the inference again +workflow.run() + +# Retrieve the output +output = workflow.dataflow[CommonKeys.PRED] +print(f"Inference Output: {output}") + +# Finalize the workflow +workflow.finalize() +``` + + + +# References +[1] Xia, Yingda, et al. "3D Semi-Supervised Learning with Uncertainty-Aware Multi-View Co-Training." arXiv preprint arXiv:1811.12506 (2018). https://arxiv.org/abs/1811.12506. + +[2] Kerfoot E., Clough J., Oksuz I., Lee J., King A.P., Schnabel J.A. (2019) Left-Ventricle Quantification Using Residual U-Net. In: Pop M. et al. (eds) Statistical Atlases and Computational Models of the Heart. Atrial Segmentation and LV Quantification Challenges. STACOM 2018. Lecture Notes in Computer Science, vol 11395. Springer, Cham. https://doi.org/10.1007/978-3-030-12029-0_40 + +# License +Copyright (c) MONAI Consortium + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. From c381dd6c70ceaa6f6cc58b322f3dee6760809ee7 Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Tue, 15 Oct 2024 23:29:16 +0800 Subject: [PATCH 07/12] remove docstring Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- .../scripts/inference.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/models/spleen_ct_segmentation_real_time/scripts/inference.py b/models/spleen_ct_segmentation_real_time/scripts/inference.py index 7ae61e1d..db9da309 100644 --- a/models/spleen_ct_segmentation_real_time/scripts/inference.py +++ b/models/spleen_ct_segmentation_real_time/scripts/inference.py @@ -35,24 +35,6 @@ class InferenceWorkflow(PythonicWorkflow): """ Test class simulates the bundle workflow defined by Python script directly. - - Typical usage: - from monai.bundle import create_workflow - from monai.transforms import LoadImaged - - workflow = create_workflow("inference.InferenceWorkflow") - workflow.initialize() - input_loader = LoadImaged(keys="image") - workflow.dataflow.update(input_loader({"image": "/workspace/Data/Task09_Spleen/imagesTr/spleen_46.nii.gz"})) - workflow.run() - - # update dataflow - workflow.dataflow.clear() - workflow.dataflow.update(input_loader({"image": "/workspace/Data/Task09_Spleen/imagesTr/spleen_38.nii.gz"})) - workflow.run() - - # get output - output = workflow.dataflow[CommonKeys.PRED] """ def __init__(self, workflow_type: str = "inference", properties_path: str = "./properties.json"): From 212668567f840ef1ea20a0b7505e2ca31246c569 Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Tue, 15 Oct 2024 23:30:09 +0800 Subject: [PATCH 08/12] minor update Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- models/spleen_ct_segmentation_real_time/docs/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/models/spleen_ct_segmentation_real_time/docs/README.md b/models/spleen_ct_segmentation_real_time/docs/README.md index a4eef985..ab91b512 100644 --- a/models/spleen_ct_segmentation_real_time/docs/README.md +++ b/models/spleen_ct_segmentation_real_time/docs/README.md @@ -80,8 +80,6 @@ print(f"Inference Output: {output}") workflow.finalize() ``` - - # References [1] Xia, Yingda, et al. "3D Semi-Supervised Learning with Uncertainty-Aware Multi-View Co-Training." arXiv preprint arXiv:1811.12506 (2018). https://arxiv.org/abs/1811.12506. From da20d2b95a9898f16526229871ba42fbc48edc34 Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Wed, 16 Oct 2024 22:58:30 +0800 Subject: [PATCH 09/12] update config Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- .../configs/inference.json | 120 ++++-------------- 1 file changed, 28 insertions(+), 92 deletions(-) diff --git a/models/spleen_ct_segmentation_real_time/configs/inference.json b/models/spleen_ct_segmentation_real_time/configs/inference.json index f843dcf9..c17393b8 100644 --- a/models/spleen_ct_segmentation_real_time/configs/inference.json +++ b/models/spleen_ct_segmentation_real_time/configs/inference.json @@ -1,31 +1,20 @@ { "imports": [ - "$import glob", - "$import numpy", - "$import os" + "$from collections import defaultdict" ], - "bundle_root": ".", - "image_key": "image", - "output_dir": "$@bundle_root + '/eval'", - "output_ext": ".nii.gz", - "output_dtype": "$numpy.float32", - "output_postfix": "trans", - "separate_folder": true, - "load_pretrain": true, - "dataset_dir": "/workspace/data/Task09_Spleen", - "datalist": "$list(sorted(glob.glob(@dataset_dir + '/imagesTs/*.nii.gz')))", - "device": "$torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')", + "bundle_root": "will override", + "device": "$torch.device('cpu')", "network_def": { "_target_": "UNet", "spatial_dims": 3, "in_channels": 1, "out_channels": 2, "channels": [ - 16, - 32, - 64, - 128, - 256 + 2, + 2, + 4, + 8, + 4 ], "strides": [ 2, @@ -37,50 +26,30 @@ "norm": "batch" }, "network": "$@network_def.to(@device)", + "dataflow": "$defaultdict()", "preprocessing": { "_target_": "Compose", "transforms": [ - { - "_target_": "LoadImaged", - "keys": "@image_key" - }, { "_target_": "EnsureChannelFirstd", - "keys": "@image_key" + "keys": "image" }, { - "_target_": "Orientationd", - "keys": "@image_key", - "axcodes": "RAS" + "_target_": "ScaleIntensityd", + "keys": "image" }, { - "_target_": "Spacingd", - "keys": "@image_key", - "pixdim": [ - 1.5, - 1.5, - 2.0 - ], - "mode": "bilinear" - }, - { - "_target_": "ScaleIntensityRanged", - "keys": "@image_key", - "a_min": -57, - "a_max": 164, - "b_min": 0, - "b_max": 1, - "clip": true - }, - { - "_target_": "EnsureTyped", - "keys": "@image_key" + "_target_": "RandRotated", + "_disabled_": true, + "keys": "image" } ] }, "dataset": { "_target_": "Dataset", - "data": "$[{'image': i} for i in @datalist]", + "data": [ + "@dataflow" + ], "transform": "@preprocessing" }, "dataloader": { @@ -88,17 +57,17 @@ "dataset": "@dataset", "batch_size": 1, "shuffle": false, - "num_workers": 4 + "num_workers": 0 }, "inferer": { "_target_": "SlidingWindowInferer", "roi_size": [ - 96, - 96, - 96 + 64, + 64, + 32 ], "sw_batch_size": 4, - "overlap": 0.5 + "overlap": 0.25 }, "postprocessing": { "_target_": "Compose", @@ -108,36 +77,13 @@ "keys": "pred", "softmax": true }, - { - "_target_": "Invertd", - "keys": "pred", - "transform": "@preprocessing", - "orig_keys": "@image_key", - "nearest_interp": false, - "to_tensor": true - }, { "_target_": "AsDiscreted", "keys": "pred", "argmax": true - }, - { - "_target_": "SaveImaged", - "keys": "pred", - "output_dir": "@output_dir", - "output_ext": "@output_ext", - "output_dtype": "@output_dtype", - "output_postfix": "@output_postfix", - "separate_folder": "@separate_folder" } ] }, - "handlers": [ - { - "_target_": "StatsHandler", - "iteration_log": false - } - ], "evaluator": { "_target_": "SupervisedEvaluator", "device": "@device", @@ -145,21 +91,11 @@ "network": "@network", "inferer": "@inferer", "postprocessing": "@postprocessing", - "val_handlers": "@handlers", - "amp": true + "amp": false, + "epoch_length": 1 }, - "checkpointloader": { - "_target_": "CheckpointLoader", - "load_path": "$@bundle_root + '/models/model.pt'", - "load_dict": { - "model": "@network" - } - }, - "initialize": [ - "$monai.utils.set_determinism(seed=123)", - "$@checkpointloader(@evaluator) if @load_pretrain else None" - ], "run": [ - "$@evaluator.run()" + "$@evaluator.run()", + "$@dataflow.update(@evaluator.state.output[0])" ] -} +} \ No newline at end of file From 0dcdff0e0704e041b842aab4557a571a95234771 Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:54:06 +0800 Subject: [PATCH 10/12] using config Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- .../configs/inference.json | 2 +- .../scripts/properties.json | 53 +++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 models/spleen_ct_segmentation_real_time/scripts/properties.json diff --git a/models/spleen_ct_segmentation_real_time/configs/inference.json b/models/spleen_ct_segmentation_real_time/configs/inference.json index c17393b8..16d953d3 100644 --- a/models/spleen_ct_segmentation_real_time/configs/inference.json +++ b/models/spleen_ct_segmentation_real_time/configs/inference.json @@ -98,4 +98,4 @@ "$@evaluator.run()", "$@dataflow.update(@evaluator.state.output[0])" ] -} \ No newline at end of file +} diff --git a/models/spleen_ct_segmentation_real_time/scripts/properties.json b/models/spleen_ct_segmentation_real_time/scripts/properties.json new file mode 100644 index 00000000..691b539c --- /dev/null +++ b/models/spleen_ct_segmentation_real_time/scripts/properties.json @@ -0,0 +1,53 @@ +{ + "train": { + "bundle_root": { + "description": "root path of the bundle.", + "required": true, + "id": "bundle_root" + }, + "device": { + "description": "target device to execute the bundle workflow.", + "required": true, + "id": "device" + }, + "dataflow": { + "description": "dataflow to execute the bundle workflow.", + "required": true, + "id": "dataflow" + } + }, + "infer": { + "bundle_root": { + "description": "root path of the bundle.", + "required": true, + "id": "bundle_root" + }, + "device": { + "description": "target device to execute the bundle workflow.", + "required": true, + "id": "device" + }, + "dataflow": { + "description": "dataflow to execute the bundle workflow.", + "required": true, + "id": "dataflow" + } + }, + "meta": { + "version": { + "description": "bundle version", + "required": true, + "id": "_meta_::version" + }, + "channel_def": { + "description": "channel definition for the prediction", + "required": false, + "id": "_meta_::network_data_format::outputs::pred::channel_def" + }, + "type": { + "description": "data type of the input image", + "required": true, + "id": "_meta_::network_data_format::outputs::pred::type" + } + } +} From e0287dbd6473ea8ca9c3153c9a89c17987d4194b Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Thu, 17 Oct 2024 16:06:02 +0800 Subject: [PATCH 11/12] add supported apps Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- .../spleen_ct_segmentation_real_time/configs/metadata.json | 6 +++++- .../spleen_ct_segmentation_real_time/scripts/inference.py | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/models/spleen_ct_segmentation_real_time/configs/metadata.json b/models/spleen_ct_segmentation_real_time/configs/metadata.json index 7934e384..96283a17 100644 --- a/models/spleen_ct_segmentation_real_time/configs/metadata.json +++ b/models/spleen_ct_segmentation_real_time/configs/metadata.json @@ -1,5 +1,5 @@ { - "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json", + "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20240725.json", "version": "0.0.1", "changelog": { "0.0.1": "add real time spleen segmentation model" @@ -26,6 +26,10 @@ "Xia, Yingda, et al. '3D Semi-Supervised Learning with Uncertainty-Aware Multi-View Co-Training. arXiv preprint arXiv:1811.12506 (2018). https://arxiv.org/abs/1811.12506.", "Kerfoot E., Clough J., Oksuz I., Lee J., King A.P., Schnabel J.A. (2019) Left-Ventricle Quantification Using Residual U-Net. In: Pop M. et al. (eds) Statistical Atlases and Computational Models of the Heart. Atrial Segmentation and LV Quantification Challenges. STACOM 2018. Lecture Notes in Computer Science, vol 11395. Springer, Cham. https://doi.org/10.1007/978-3-030-12029-0_40" ], + "supported_apps": { + "train": "monai", + "infer": "holoscan" + }, "network_data_format": { "inputs": { "image": { diff --git a/models/spleen_ct_segmentation_real_time/scripts/inference.py b/models/spleen_ct_segmentation_real_time/scripts/inference.py index db9da309..73ed3559 100644 --- a/models/spleen_ct_segmentation_real_time/scripts/inference.py +++ b/models/spleen_ct_segmentation_real_time/scripts/inference.py @@ -37,8 +37,8 @@ class InferenceWorkflow(PythonicWorkflow): Test class simulates the bundle workflow defined by Python script directly. """ - def __init__(self, workflow_type: str = "inference", properties_path: str = "./properties.json"): - super().__init__(workflow_type=workflow_type, properties_path=properties_path) + def __init__(self, workflow_type: str = "inference", config_file: str | None = None, properties_path: str = "./properties.json"): + super().__init__(workflow_type=workflow_type, properties_path=properties_path, config_file=config_file) # set root log level to INFO and init a evaluation logger, will be used in `StatsHandler` logging.basicConfig(stream=sys.stdout, level=logging.INFO) get_logger("eval_log") @@ -73,7 +73,7 @@ def initialize(self): AsDiscreted(keys="pred", argmax=True), ] ) - self.inferer = SlidingWindowInferer(roi_size=(96, 96, 96), sw_batch_size=1, overlap=0) + self.inferer = SlidingWindowInferer(roi_size=self.parser.roi_size, sw_batch_size=1, overlap=0) def run(self): data = self.dataset[0] From dd01ef75ce0de6956e855a75a1c6738937ac2875 Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Thu, 17 Oct 2024 20:09:46 +0800 Subject: [PATCH 12/12] remove properties Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- .../scripts/properties.json | 53 ------------------- 1 file changed, 53 deletions(-) delete mode 100644 models/spleen_ct_segmentation_real_time/scripts/properties.json diff --git a/models/spleen_ct_segmentation_real_time/scripts/properties.json b/models/spleen_ct_segmentation_real_time/scripts/properties.json deleted file mode 100644 index 691b539c..00000000 --- a/models/spleen_ct_segmentation_real_time/scripts/properties.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "train": { - "bundle_root": { - "description": "root path of the bundle.", - "required": true, - "id": "bundle_root" - }, - "device": { - "description": "target device to execute the bundle workflow.", - "required": true, - "id": "device" - }, - "dataflow": { - "description": "dataflow to execute the bundle workflow.", - "required": true, - "id": "dataflow" - } - }, - "infer": { - "bundle_root": { - "description": "root path of the bundle.", - "required": true, - "id": "bundle_root" - }, - "device": { - "description": "target device to execute the bundle workflow.", - "required": true, - "id": "device" - }, - "dataflow": { - "description": "dataflow to execute the bundle workflow.", - "required": true, - "id": "dataflow" - } - }, - "meta": { - "version": { - "description": "bundle version", - "required": true, - "id": "_meta_::version" - }, - "channel_def": { - "description": "channel definition for the prediction", - "required": false, - "id": "_meta_::network_data_format::outputs::pred::channel_def" - }, - "type": { - "description": "data type of the input image", - "required": true, - "id": "_meta_::network_data_format::outputs::pred::type" - } - } -}