project-monai commited on
Commit
da22786
·
verified ·
1 Parent(s): cf6fd86

Upload spleen_ct_segmentation version 0.6.0

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ models/model.ts filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
configs/evaluate.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "validate#dataset#cache_rate": 0,
3
+ "validate#postprocessing": {
4
+ "_target_": "Compose",
5
+ "transforms": [
6
+ {
7
+ "_target_": "Activationsd",
8
+ "keys": "pred",
9
+ "softmax": true
10
+ },
11
+ {
12
+ "_target_": "Invertd",
13
+ "keys": [
14
+ "pred",
15
+ "label"
16
+ ],
17
+ "transform": "@validate#preprocessing",
18
+ "orig_keys": "image",
19
+ "nearest_interp": [
20
+ false,
21
+ true
22
+ ],
23
+ "to_tensor": true
24
+ },
25
+ {
26
+ "_target_": "AsDiscreted",
27
+ "keys": [
28
+ "pred",
29
+ "label"
30
+ ],
31
+ "argmax": [
32
+ true,
33
+ false
34
+ ],
35
+ "to_onehot": 2
36
+ },
37
+ {
38
+ "_target_": "SaveImaged",
39
+ "_disabled_": true,
40
+ "keys": "pred",
41
+ "output_dir": "@output_dir",
42
+ "resample": false,
43
+ "squeeze_end_dims": true
44
+ }
45
+ ]
46
+ },
47
+ "validate#handlers": [
48
+ {
49
+ "_target_": "CheckpointLoader",
50
+ "load_path": "$@ckpt_dir + '/model.pt'",
51
+ "load_dict": {
52
+ "model": "@network"
53
+ }
54
+ },
55
+ {
56
+ "_target_": "StatsHandler",
57
+ "iteration_log": false
58
+ },
59
+ {
60
+ "_target_": "MetricsSaver",
61
+ "save_dir": "@output_dir",
62
+ "metrics": [
63
+ "val_mean_dice",
64
+ "val_acc"
65
+ ],
66
+ "metric_details": [
67
+ "val_mean_dice"
68
+ ],
69
+ "batch_transform": "$lambda x: [xx['image'].meta for xx in x]",
70
+ "summary_ops": "*"
71
+ }
72
+ ],
73
+ "run": [
74
+ "$@validate#evaluator.run()"
75
+ ]
76
+ }
configs/inference.json ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "imports": [
3
+ "$import glob",
4
+ "$import numpy",
5
+ "$import os"
6
+ ],
7
+ "bundle_root": ".",
8
+ "image_key": "image",
9
+ "output_dir": "$@bundle_root + '/eval'",
10
+ "output_ext": ".nii.gz",
11
+ "output_dtype": "$numpy.float32",
12
+ "output_postfix": "trans",
13
+ "separate_folder": true,
14
+ "load_pretrain": true,
15
+ "dataset_dir": "/workspace/data/Task09_Spleen",
16
+ "datalist": "$list(sorted(glob.glob(@dataset_dir + '/imagesTs/*.nii.gz')))",
17
+ "device": "$torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')",
18
+ "network_def": {
19
+ "_target_": "UNet",
20
+ "spatial_dims": 3,
21
+ "in_channels": 1,
22
+ "out_channels": 2,
23
+ "channels": [
24
+ 16,
25
+ 32,
26
+ 64,
27
+ 128,
28
+ 256
29
+ ],
30
+ "strides": [
31
+ 2,
32
+ 2,
33
+ 2,
34
+ 2
35
+ ],
36
+ "num_res_units": 2,
37
+ "norm": "batch"
38
+ },
39
+ "network": "$@network_def.to(@device)",
40
+ "preprocessing": {
41
+ "_target_": "Compose",
42
+ "transforms": [
43
+ {
44
+ "_target_": "LoadImaged",
45
+ "keys": "@image_key"
46
+ },
47
+ {
48
+ "_target_": "EnsureChannelFirstd",
49
+ "keys": "@image_key"
50
+ },
51
+ {
52
+ "_target_": "Orientationd",
53
+ "keys": "@image_key",
54
+ "axcodes": "RAS"
55
+ },
56
+ {
57
+ "_target_": "Spacingd",
58
+ "keys": "@image_key",
59
+ "pixdim": [
60
+ 1.5,
61
+ 1.5,
62
+ 2.0
63
+ ],
64
+ "mode": "bilinear"
65
+ },
66
+ {
67
+ "_target_": "ScaleIntensityRanged",
68
+ "keys": "@image_key",
69
+ "a_min": -57,
70
+ "a_max": 164,
71
+ "b_min": 0,
72
+ "b_max": 1,
73
+ "clip": true
74
+ },
75
+ {
76
+ "_target_": "EnsureTyped",
77
+ "keys": "@image_key"
78
+ }
79
+ ]
80
+ },
81
+ "dataset": {
82
+ "_target_": "Dataset",
83
+ "data": "$[{'image': i} for i in @datalist]",
84
+ "transform": "@preprocessing"
85
+ },
86
+ "dataloader": {
87
+ "_target_": "DataLoader",
88
+ "dataset": "@dataset",
89
+ "batch_size": 1,
90
+ "shuffle": false,
91
+ "num_workers": 4
92
+ },
93
+ "inferer": {
94
+ "_target_": "SlidingWindowInferer",
95
+ "roi_size": [
96
+ 96,
97
+ 96,
98
+ 96
99
+ ],
100
+ "sw_batch_size": 4,
101
+ "overlap": 0.5
102
+ },
103
+ "postprocessing": {
104
+ "_target_": "Compose",
105
+ "transforms": [
106
+ {
107
+ "_target_": "Activationsd",
108
+ "keys": "pred",
109
+ "softmax": true
110
+ },
111
+ {
112
+ "_target_": "Invertd",
113
+ "keys": "pred",
114
+ "transform": "@preprocessing",
115
+ "orig_keys": "@image_key",
116
+ "nearest_interp": false,
117
+ "to_tensor": true
118
+ },
119
+ {
120
+ "_target_": "AsDiscreted",
121
+ "keys": "pred",
122
+ "argmax": true
123
+ },
124
+ {
125
+ "_target_": "SaveImaged",
126
+ "keys": "pred",
127
+ "output_dir": "@output_dir",
128
+ "output_ext": "@output_ext",
129
+ "output_dtype": "@output_dtype",
130
+ "output_postfix": "@output_postfix",
131
+ "separate_folder": "@separate_folder"
132
+ }
133
+ ]
134
+ },
135
+ "handlers": [
136
+ {
137
+ "_target_": "StatsHandler",
138
+ "iteration_log": false
139
+ }
140
+ ],
141
+ "evaluator": {
142
+ "_target_": "SupervisedEvaluator",
143
+ "device": "@device",
144
+ "val_data_loader": "@dataloader",
145
+ "network": "@network",
146
+ "inferer": "@inferer",
147
+ "postprocessing": "@postprocessing",
148
+ "val_handlers": "@handlers",
149
+ "amp": true
150
+ },
151
+ "checkpointloader": {
152
+ "_target_": "CheckpointLoader",
153
+ "load_path": "$@bundle_root + '/models/model.pt'",
154
+ "load_dict": {
155
+ "model": "@network"
156
+ }
157
+ },
158
+ "initialize": [
159
+ "$monai.utils.set_determinism(seed=123)",
160
+ "$@checkpointloader(@evaluator) if @load_pretrain else None"
161
+ ],
162
+ "run": [
163
164
+ ]
165
+ }
configs/inference_trt.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "imports": [
3
+ "$import glob",
4
+ "$import os",
5
+ "$import torch_tensorrt"
6
+ ],
7
+ "network_def": "$torch.jit.load(@bundle_root + '/models/model_trt.ts')",
8
+ "evaluator#amp": false,
9
+ "initialize": [
10
+ "$monai.utils.set_determinism(seed=123)"
11
+ ]
12
+ }
configs/logging.conf ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [loggers]
2
+ keys=root
3
+
4
+ [handlers]
5
+ keys=consoleHandler
6
+
7
+ [formatters]
8
+ keys=fullFormatter
9
+
10
+ [logger_root]
11
+ level=INFO
12
+ handlers=consoleHandler
13
+
14
+ [handler_consoleHandler]
15
+ class=StreamHandler
16
+ level=INFO
17
+ formatter=fullFormatter
18
+ args=(sys.stdout,)
19
+
20
+ [formatter_fullFormatter]
21
+ format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
configs/metadata.json ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20240725.json",
3
+ "version": "0.6.0",
4
+ "changelog": {
5
+ "0.6.0": "update to huggingface hosting",
6
+ "0.5.9": "use monai 1.4 and update large files",
7
+ "0.5.8": "update to use monai 1.3.2",
8
+ "0.5.7": "update to use monai 1.3.1",
9
+ "0.5.6": "add load_pretrain flag for infer",
10
+ "0.5.5": "add checkpoint loader for infer",
11
+ "0.5.4": "update to use monai 1.3.0",
12
+ "0.5.3": "fix the wrong GPU index issue of multi-node",
13
+ "0.5.2": "remove error dollar symbol in readme",
14
+ "0.5.1": "add RAM warning",
15
+ "0.5.0": "update the README file with the ONNX-TensorRT conversion",
16
+ "0.4.9": "update TensorRT descriptions",
17
+ "0.4.8": "update deterministic training results",
18
+ "0.4.7": "update the TensorRT part in the README file",
19
+ "0.4.6": "fix mgpu finalize issue",
20
+ "0.4.5": "enable deterministic training",
21
+ "0.4.4": "add the command of executing inference with TensorRT models",
22
+ "0.4.3": "fix figure and weights inconsistent error",
23
+ "0.4.2": "use torch 1.13.1",
24
+ "0.4.1": "update the readme file with TensorRT convert",
25
+ "0.4.0": "fix multi-gpu train config typo",
26
+ "0.3.9": "adapt to BundleWorkflow interface",
27
+ "0.3.8": "add name tag",
28
+ "0.3.7": "restructure readme to match updated template",
29
+ "0.3.6": "enhance readme with details of model training",
30
+ "0.3.5": "update to use monai 1.0.1",
31
+ "0.3.4": "enhance readme on commands example",
32
+ "0.3.3": "fix license Copyright error",
33
+ "0.3.2": "improve multi-gpu logging",
34
+ "0.3.1": "add multi-gpu evaluation config",
35
+ "0.3.0": "update license files",
36
+ "0.2.0": "unify naming",
37
+ "0.1.1": "disable image saving during evaluation",
38
+ "0.1.0": "complete the model package",
39
+ "0.0.1": "initialize the model package structure"
40
+ },
41
+ "monai_version": "1.4.0",
42
+ "pytorch_version": "2.4.0",
43
+ "numpy_version": "1.24.4",
44
+ "required_packages_version": {
45
+ "nibabel": "5.2.1",
46
+ "pytorch-ignite": "0.4.11",
47
+ "tensorboard": "2.17.0"
48
+ },
49
+ "supported_apps": {},
50
+ "name": "Spleen CT segmentation",
51
+ "task": "Decathlon spleen segmentation",
52
+ "description": "A pre-trained model for volumetric (3D) segmentation of the spleen from CT image",
53
+ "authors": "MONAI team",
54
+ "copyright": "Copyright (c) MONAI Consortium",
55
+ "data_source": "Task09_Spleen.tar from http://medicaldecathlon.com/",
56
+ "data_type": "nibabel",
57
+ "image_classes": "single channel data, intensity scaled to [0, 1]",
58
+ "label_classes": "single channel data, 1 is spleen, 0 is everything else",
59
+ "pred_classes": "2 channels OneHot data, channel 1 is spleen, channel 0 is background",
60
+ "eval_metrics": {
61
+ "mean_dice": 0.961
62
+ },
63
+ "intended_use": "This is an example, not to be used for diagnostic purposes",
64
+ "references": [
65
+ "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.",
66
+ "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"
67
+ ],
68
+ "network_data_format": {
69
+ "inputs": {
70
+ "image": {
71
+ "type": "image",
72
+ "format": "hounsfield",
73
+ "modality": "CT",
74
+ "num_channels": 1,
75
+ "spatial_shape": [
76
+ 96,
77
+ 96,
78
+ 96
79
+ ],
80
+ "dtype": "float32",
81
+ "value_range": [
82
+ 0,
83
+ 1
84
+ ],
85
+ "is_patch_data": true,
86
+ "channel_def": {
87
+ "0": "image"
88
+ }
89
+ }
90
+ },
91
+ "outputs": {
92
+ "pred": {
93
+ "type": "image",
94
+ "format": "segmentation",
95
+ "num_channels": 2,
96
+ "spatial_shape": [
97
+ 96,
98
+ 96,
99
+ 96
100
+ ],
101
+ "dtype": "float32",
102
+ "value_range": [
103
+ 0,
104
+ 1
105
+ ],
106
+ "is_patch_data": true,
107
+ "channel_def": {
108
+ "0": "background",
109
+ "1": "spleen"
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
configs/multi_gpu_evaluate.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "device": "$torch.device('cuda:' + os.environ['LOCAL_RANK'])",
3
+ "network": {
4
+ "_target_": "torch.nn.parallel.DistributedDataParallel",
5
+ "module": "$@network_def.to(@device)",
6
+ "device_ids": [
7
+ "@device"
8
+ ]
9
+ },
10
+ "validate#sampler": {
11
+ "_target_": "DistributedSampler",
12
+ "dataset": "@validate#dataset",
13
+ "even_divisible": false,
14
+ "shuffle": false
15
+ },
16
+ "validate#dataloader#sampler": "@validate#sampler",
17
+ "validate#handlers#1#_disabled_": "$dist.get_rank() > 0",
18
+ "initialize": [
19
+ "$import torch.distributed as dist",
20
+ "$dist.is_initialized() or dist.init_process_group(backend='nccl')",
21
+ "$torch.cuda.set_device(@device)",
22
+ "$import logging",
23
+ "$@validate#evaluator.logger.setLevel(logging.WARNING if dist.get_rank() > 0 else logging.INFO)"
24
+ ],
25
+ "run": [
26
+ "$@validate#evaluator.run()"
27
+ ],
28
+ "finalize": [
29
+ "$dist.is_initialized() and dist.destroy_process_group()"
30
+ ]
31
+ }
configs/multi_gpu_train.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "device": "$torch.device('cuda:' + os.environ['LOCAL_RANK'])",
3
+ "network": {
4
+ "_target_": "torch.nn.parallel.DistributedDataParallel",
5
+ "module": "$@network_def.to(@device)",
6
+ "device_ids": [
7
+ "@device"
8
+ ]
9
+ },
10
+ "train#sampler": {
11
+ "_target_": "DistributedSampler",
12
+ "dataset": "@train#dataset",
13
+ "even_divisible": true,
14
+ "shuffle": true
15
+ },
16
+ "train#dataloader#sampler": "@train#sampler",
17
+ "train#dataloader#shuffle": false,
18
+ "train#trainer#train_handlers": "$@train#handlers[: -2 if dist.get_rank() > 0 else None]",
19
+ "validate#sampler": {
20
+ "_target_": "DistributedSampler",
21
+ "dataset": "@validate#dataset",
22
+ "even_divisible": false,
23
+ "shuffle": false
24
+ },
25
+ "validate#dataloader#sampler": "@validate#sampler",
26
+ "validate#evaluator#val_handlers": "$None if dist.get_rank() > 0 else @validate#handlers",
27
+ "initialize": [
28
+ "$import torch.distributed as dist",
29
+ "$dist.is_initialized() or dist.init_process_group(backend='nccl')",
30
+ "$torch.cuda.set_device(@device)",
31
+ "$monai.utils.set_determinism(seed=123)",
32
+ "$import logging",
33
+ "$@train#trainer.logger.setLevel(logging.WARNING if dist.get_rank() > 0 else logging.INFO)",
34
+ "$@validate#evaluator.logger.setLevel(logging.WARNING if dist.get_rank() > 0 else logging.INFO)"
35
+ ],
36
+ "run": [
37
+ "$@train#trainer.run()"
38
+ ],
39
+ "finalize": [
40
+ "$dist.is_initialized() and dist.destroy_process_group()"
41
+ ]
42
+ }
configs/train.json ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "imports": [
3
+ "$import glob",
4
+ "$import os",
5
+ "$import ignite"
6
+ ],
7
+ "bundle_root": ".",
8
+ "ckpt_dir": "$@bundle_root + '/models'",
9
+ "output_dir": "$@bundle_root + '/eval'",
10
+ "dataset_dir": "/workspace/data/Task09_Spleen",
11
+ "images": "$list(sorted(glob.glob(@dataset_dir + '/imagesTr/*.nii.gz')))",
12
+ "labels": "$list(sorted(glob.glob(@dataset_dir + '/labelsTr/*.nii.gz')))",
13
+ "val_interval": 1,
14
+ "epochs": 800,
15
+ "device": "$torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')",
16
+ "network_def": {
17
+ "_target_": "UNet",
18
+ "spatial_dims": 3,
19
+ "in_channels": 1,
20
+ "out_channels": 2,
21
+ "channels": [
22
+ 16,
23
+ 32,
24
+ 64,
25
+ 128,
26
+ 256
27
+ ],
28
+ "strides": [
29
+ 2,
30
+ 2,
31
+ 2,
32
+ 2
33
+ ],
34
+ "num_res_units": 2,
35
+ "norm": "batch"
36
+ },
37
+ "network": "$@network_def.to(@device)",
38
+ "loss": {
39
+ "_target_": "DiceCELoss",
40
+ "include_background": true,
41
+ "to_onehot_y": true,
42
+ "softmax": true,
43
+ "squared_pred": true,
44
+ "batch": true,
45
+ "smooth_nr": 1e-05,
46
+ "smooth_dr": 1e-05,
47
+ "lambda_dice": 0.5,
48
+ "lambda_ce": 0.5
49
+ },
50
+ "optimizer": {
51
+ "_target_": "Novograd",
52
+ "params": "[email protected]()",
53
+ "lr": 0.002
54
+ },
55
+ "lr_scheduler": {
56
+ "_target_": "torch.optim.lr_scheduler.StepLR",
57
+ "optimizer": "@optimizer",
58
+ "step_size": 5000,
59
+ "gamma": 0.1
60
+ },
61
+ "train": {
62
+ "deterministic_transforms": [
63
+ {
64
+ "_target_": "LoadImaged",
65
+ "keys": [
66
+ "image",
67
+ "label"
68
+ ]
69
+ },
70
+ {
71
+ "_target_": "EnsureChannelFirstd",
72
+ "keys": [
73
+ "image",
74
+ "label"
75
+ ]
76
+ },
77
+ {
78
+ "_target_": "Orientationd",
79
+ "keys": [
80
+ "image",
81
+ "label"
82
+ ],
83
+ "axcodes": "RAS"
84
+ },
85
+ {
86
+ "_target_": "Spacingd",
87
+ "keys": [
88
+ "image",
89
+ "label"
90
+ ],
91
+ "pixdim": [
92
+ 1.5,
93
+ 1.5,
94
+ 2.0
95
+ ],
96
+ "mode": [
97
+ "bilinear",
98
+ "nearest"
99
+ ]
100
+ },
101
+ {
102
+ "_target_": "ScaleIntensityRanged",
103
+ "keys": "image",
104
+ "a_min": -57,
105
+ "a_max": 164,
106
+ "b_min": 0,
107
+ "b_max": 1,
108
+ "clip": true
109
+ },
110
+ {
111
+ "_target_": "EnsureTyped",
112
+ "keys": [
113
+ "image",
114
+ "label"
115
+ ]
116
+ }
117
+ ],
118
+ "random_transforms": [
119
+ {
120
+ "_target_": "RandCropByPosNegLabeld",
121
+ "keys": [
122
+ "image",
123
+ "label"
124
+ ],
125
+ "label_key": "label",
126
+ "spatial_size": [
127
+ 96,
128
+ 96,
129
+ 96
130
+ ],
131
+ "pos": 1,
132
+ "neg": 1,
133
+ "num_samples": 4,
134
+ "image_key": "image",
135
+ "image_threshold": 0
136
+ }
137
+ ],
138
+ "preprocessing": {
139
+ "_target_": "Compose",
140
+ "transforms": "$@train#deterministic_transforms + @train#random_transforms"
141
+ },
142
+ "dataset": {
143
+ "_target_": "CacheDataset",
144
+ "data": "$[{'image': i, 'label': l} for i, l in zip(@images[:-9], @labels[:-9])]",
145
+ "transform": "@train#preprocessing",
146
+ "cache_rate": 1.0,
147
+ "num_workers": 4
148
+ },
149
+ "dataloader": {
150
+ "_target_": "DataLoader",
151
+ "dataset": "@train#dataset",
152
+ "batch_size": 2,
153
+ "shuffle": true,
154
+ "num_workers": 4
155
+ },
156
+ "inferer": {
157
+ "_target_": "SimpleInferer"
158
+ },
159
+ "postprocessing": {
160
+ "_target_": "Compose",
161
+ "transforms": [
162
+ {
163
+ "_target_": "Activationsd",
164
+ "keys": "pred",
165
+ "softmax": true
166
+ },
167
+ {
168
+ "_target_": "AsDiscreted",
169
+ "keys": [
170
+ "pred",
171
+ "label"
172
+ ],
173
+ "argmax": [
174
+ true,
175
+ false
176
+ ],
177
+ "to_onehot": 2
178
+ }
179
+ ]
180
+ },
181
+ "handlers": [
182
+ {
183
+ "_target_": "LrScheduleHandler",
184
+ "lr_scheduler": "@lr_scheduler",
185
+ "print_lr": true
186
+ },
187
+ {
188
+ "_target_": "ValidationHandler",
189
+ "validator": "@validate#evaluator",
190
+ "epoch_level": true,
191
+ "interval": "@val_interval"
192
+ },
193
+ {
194
+ "_target_": "StatsHandler",
195
+ "tag_name": "train_loss",
196
+ "output_transform": "$monai.handlers.from_engine(['loss'], first=True)"
197
+ },
198
+ {
199
+ "_target_": "TensorBoardStatsHandler",
200
+ "log_dir": "@output_dir",
201
+ "tag_name": "train_loss",
202
+ "output_transform": "$monai.handlers.from_engine(['loss'], first=True)"
203
+ }
204
+ ],
205
+ "key_metric": {
206
+ "train_accuracy": {
207
+ "_target_": "ignite.metrics.Accuracy",
208
+ "output_transform": "$monai.handlers.from_engine(['pred', 'label'])"
209
+ }
210
+ },
211
+ "trainer": {
212
+ "_target_": "SupervisedTrainer",
213
+ "max_epochs": "@epochs",
214
+ "device": "@device",
215
+ "train_data_loader": "@train#dataloader",
216
+ "network": "@network",
217
+ "loss_function": "@loss",
218
+ "optimizer": "@optimizer",
219
+ "inferer": "@train#inferer",
220
+ "postprocessing": "@train#postprocessing",
221
+ "key_train_metric": "@train#key_metric",
222
+ "train_handlers": "@train#handlers",
223
+ "amp": true
224
+ }
225
+ },
226
+ "validate": {
227
+ "preprocessing": {
228
+ "_target_": "Compose",
229
+ "transforms": "%train#deterministic_transforms"
230
+ },
231
+ "dataset": {
232
+ "_target_": "CacheDataset",
233
+ "data": "$[{'image': i, 'label': l} for i, l in zip(@images[-9:], @labels[-9:])]",
234
+ "transform": "@validate#preprocessing",
235
+ "cache_rate": 1.0
236
+ },
237
+ "dataloader": {
238
+ "_target_": "DataLoader",
239
+ "dataset": "@validate#dataset",
240
+ "batch_size": 1,
241
+ "shuffle": false,
242
+ "num_workers": 4
243
+ },
244
+ "inferer": {
245
+ "_target_": "SlidingWindowInferer",
246
+ "roi_size": [
247
+ 96,
248
+ 96,
249
+ 96
250
+ ],
251
+ "sw_batch_size": 4,
252
+ "overlap": 0.5
253
+ },
254
+ "postprocessing": "%train#postprocessing",
255
+ "handlers": [
256
+ {
257
+ "_target_": "StatsHandler",
258
+ "iteration_log": false
259
+ },
260
+ {
261
+ "_target_": "TensorBoardStatsHandler",
262
+ "log_dir": "@output_dir",
263
+ "iteration_log": false
264
+ },
265
+ {
266
+ "_target_": "CheckpointSaver",
267
+ "save_dir": "@ckpt_dir",
268
+ "save_dict": {
269
+ "model": "@network"
270
+ },
271
+ "save_key_metric": true,
272
+ "key_metric_filename": "model.pt"
273
+ }
274
+ ],
275
+ "key_metric": {
276
+ "val_mean_dice": {
277
+ "_target_": "MeanDice",
278
+ "include_background": false,
279
+ "output_transform": "$monai.handlers.from_engine(['pred', 'label'])"
280
+ }
281
+ },
282
+ "additional_metrics": {
283
+ "val_accuracy": {
284
+ "_target_": "ignite.metrics.Accuracy",
285
+ "output_transform": "$monai.handlers.from_engine(['pred', 'label'])"
286
+ }
287
+ },
288
+ "evaluator": {
289
+ "_target_": "SupervisedEvaluator",
290
+ "device": "@device",
291
+ "val_data_loader": "@validate#dataloader",
292
+ "network": "@network",
293
+ "inferer": "@validate#inferer",
294
+ "postprocessing": "@validate#postprocessing",
295
+ "key_val_metric": "@validate#key_metric",
296
+ "additional_metrics": "@validate#additional_metrics",
297
+ "val_handlers": "@validate#handlers",
298
+ "amp": true
299
+ }
300
+ },
301
+ "initialize": [
302
+ "$monai.utils.set_determinism(seed=123)"
303
+ ],
304
+ "run": [
305
+ "$@train#trainer.run()"
306
+ ]
307
+ }
docs/README.md ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Model Overview
2
+ A pre-trained model for volumetric (3D) segmentation of the spleen from CT images.
3
+
4
+ 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.
5
+
6
+ ![model workflow](https://developer.download.nvidia.com/assets/Clara/Images/clara_pt_spleen_ct_segmentation_workflow.png)
7
+
8
+ ## Data
9
+ The training dataset is the Spleen Task from the Medical Segmentation Decathalon. Users can find more details on the datasets at http://medicaldecathlon.com/.
10
+
11
+ - Target: Spleen
12
+ - Modality: CT
13
+ - Size: 61 3D volumes (41 Training + 20 Testing)
14
+ - Source: Memorial Sloan Kettering Cancer Center
15
+ - Challenge: Large-ranging foreground size
16
+
17
+ ## Training configuration
18
+ 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.
19
+
20
+ The training was performed with the following:
21
+
22
+ - GPU: at least 12GB of GPU memory
23
+ - Actual Model Input: 96 x 96 x 96
24
+ - AMP: True
25
+ - Optimizer: Novograd
26
+ - Learning Rate: 0.002
27
+ - Loss: DiceCELoss
28
+ - Dataset Manager: CacheDataset
29
+
30
+ ### Memory Consumption Warning
31
+
32
+ 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.
33
+
34
+ ### Input
35
+ One channel
36
+ - CT image
37
+
38
+ ### Output
39
+ Two channels
40
+ - Label 1: spleen
41
+ - Label 0: everything else
42
+
43
+ ## Performance
44
+ Dice score is used for evaluating the performance of the model. This model achieves a mean dice score of 0.961.
45
+
46
+ #### Training Loss
47
+ ![A graph showing the training loss over 1260 epochs (10080 iterations).](https://developer.download.nvidia.com/assets/Clara/Images/monai_spleen_ct_segmentation_train.png)
48
+
49
+ #### Validation Dice
50
+ ![A graph showing the validation mean Dice over 1260 epochs.](https://developer.download.nvidia.com/assets/Clara/Images/monai_spleen_ct_segmentation_val.png)
51
+
52
+ #### TensorRT speedup
53
+ The `spleen_ct_segmentation` bundle supports acceleration with TensorRT through the ONNX-TensorRT method. The table below displays the speedup ratios observed on an A100 80G GPU.
54
+
55
+ | method | torch_fp32(ms) | torch_amp(ms) | trt_fp32(ms) | trt_fp16(ms) | speedup amp | speedup fp32 | speedup fp16 | amp vs fp16|
56
+ | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
57
+ | model computation | 6.46 | 4.48 | 2.52 | 1.96 | 1.44 | 2.56 | 3.30 | 2.29 |
58
+ | end2end | 1268.03 | 1152.40 | 1137.40 | 1114.25 | 1.10 | 1.11 | 1.14 | 1.03 |
59
+
60
+ Where:
61
+ - `model computation` means the speedup ratio of model's inference with a random input without preprocessing and postprocessing
62
+ - `end2end` means run the bundle end-to-end with the TensorRT based model.
63
+ - `torch_fp32` and `torch_amp` are for the PyTorch models with or without `amp` mode.
64
+ - `trt_fp32` and `trt_fp16` are for the TensorRT based models converted in corresponding precision.
65
+ - `speedup amp`, `speedup fp32` and `speedup fp16` are the speedup ratios of corresponding models versus the PyTorch float32 model
66
+ - `amp vs fp16` is the speedup ratio between the PyTorch amp model and the TensorRT float16 based model.
67
+
68
+ Currently, the only available method to accelerate this model is through ONNX-TensorRT. However, the Torch-TensorRT method is under development and will be available in the near future.
69
+
70
+ This result is benchmarked under:
71
+ - TensorRT: 8.5.3+cuda11.8
72
+ - Torch-TensorRT Version: 1.4.0
73
+ - CPU Architecture: x86-64
74
+ - OS: ubuntu 20.04
75
+ - Python version:3.8.10
76
+ - CUDA version: 12.1
77
+ - GPU models and configuration: A100 80G
78
+
79
+ ## MONAI Bundle Commands
80
+ In addition to the Pythonic APIs, a few command line interfaces (CLI) are provided to interact with the bundle. The CLI supports flexible use cases, such as overriding configs at runtime and predefining arguments in a file.
81
+
82
+ For more details usage instructions, visit the [MONAI Bundle Configuration Page](https://docs.monai.io/en/latest/config_syntax.html).
83
+
84
+ #### Execute training:
85
+
86
+ ```
87
+ python -m monai.bundle run --config_file configs/train.json
88
+ ```
89
+
90
+ Please note that if the default dataset path is not modified with the actual path in the bundle config files, you can also override it by using `--dataset_dir`:
91
+
92
+ ```
93
+ python -m monai.bundle run --config_file configs/train.json --dataset_dir <actual dataset path>
94
+ ```
95
+
96
+ #### Override the `train` config to execute multi-GPU training:
97
+
98
+ ```
99
+ torchrun --standalone --nnodes=1 --nproc_per_node=2 -m monai.bundle run --config_file "['configs/train.json','configs/multi_gpu_train.json']"
100
+ ```
101
+
102
+ Please note that the distributed training-related options depend on the actual running environment; thus, users may need to remove `--standalone`, modify `--nnodes`, or do some other necessary changes according to the machine used. For more details, please refer to [pytorch's official tutorial](https://pytorch.org/tutorials/intermediate/ddp_tutorial.html).
103
+
104
+ #### Override the `train` config to execute evaluation with the trained model:
105
+
106
+ ```
107
+ python -m monai.bundle run --config_file "['configs/train.json','configs/evaluate.json']"
108
+ ```
109
+
110
+ #### Override the `train` config and `evaluate` config to execute multi-GPU evaluation:
111
+
112
+ ```
113
+ torchrun --standalone --nnodes=1 --nproc_per_node=2 -m monai.bundle run --config_file "['configs/train.json','configs/evaluate.json','configs/multi_gpu_evaluate.json']"
114
+ ```
115
+
116
+ #### Execute inference:
117
+
118
+ ```
119
+ python -m monai.bundle run --config_file configs/inference.json
120
+ ```
121
+
122
+ #### Export checkpoint to TensorRT based models with fp32 or fp16 precision:
123
+
124
+ ```
125
+ python -m monai.bundle trt_export --net_id network_def --filepath models/model_trt.ts --ckpt_file models/model.pt --meta_file configs/metadata.json --config_file configs/inference.json --precision <fp32/fp16> --dynamic_batchsize "[1, 4, 8]" --use_onnx "True" --use_trace "True"
126
+ ```
127
+
128
+ #### Execute inference with the TensorRT model:
129
+
130
+ ```
131
+ python -m monai.bundle run --config_file "['configs/inference.json', 'configs/inference_trt.json']"
132
+ ```
133
+
134
+ # References
135
+ [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.
136
+
137
+ [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
138
+
139
+ # License
140
+ Copyright (c) MONAI Consortium
141
+
142
+ Licensed under the Apache License, Version 2.0 (the "License");
143
+ you may not use this file except in compliance with the License.
144
+ You may obtain a copy of the License at
145
+
146
+ http://www.apache.org/licenses/LICENSE-2.0
147
+
148
+ Unless required by applicable law or agreed to in writing, software
149
+ distributed under the License is distributed on an "AS IS" BASIS,
150
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
151
+ See the License for the specific language governing permissions and
152
+ limitations under the License.
docs/data_license.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ Third Party Licenses
2
+ -----------------------------------------------------------------------
3
+
4
+ /*********************************************************************/
5
+ i. Medical Segmentation Decathlon
6
+ http://medicaldecathlon.com/
models/model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:502c312893994ec071a85c4f2e7d83a43f7789969faa73dae62f1291177f50fe
3
+ size 19297197
models/model.ts ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d8d7b04a24b1a6016aa32c662913b907dab4fb91cd88a91cb7e0a8f11eeafec0
3
+ size 19412163