You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This tutorial shows how to use Auto3DSeg with KiTS 2023 dataset from the MICCAI 2023 challenge **[The 2023 Kidney and Kidney Tumor Segmentation Challenge (KiTS23)](https://kits-challenge.org/kits23/)**.
6
+
This tutorial shows how to use Auto3DSeg with KiTS 2023 dataset from the MICCAI 2023 challenge **[The 2023 Kidney and Kidney Tumor Segmentation Challenge (KiTS23)](https://kits-challenge.org/kits23/)**.
7
7
The example is based on the 1st place solution in the KiTS challenge [(NVAUTO team)](https://kits-challenge.org/kits23/#kits23-official-results):
8
8
9
9
Andriy Myronenko, Dong Yang, Yufan He and Daguang Xu: "Automated 3D Segmentation of Kidneys and Tumors in MICCAI KiTS 2023 Challenge". In MICCAI (2023). [arXiv](https://arxiv.org/abs/2310.04110)
10
10
11
11
12
12
## Task overview
13
13
14
-
The task is to segment kidneys, tumors and cysts from 3D CTs. The dataset contains 489 cases with resolutions ranging between 0.39x0.39x0.5 and 1x1x5 mm.
15
-
Please download the KiTS23 [dataset](https://kits-challenge.org/kits23/#) and place it in the "/data/kits23" folder to follow this tutorial.
14
+
The task is to segment kidneys, tumors and cysts from 3D CTs. The dataset contains 489 cases with resolutions ranging between 0.39x0.39x0.5 and 1x1x5 mm.
15
+
Please download the KiTS23 [dataset](https://kits-challenge.org/kits23/#) and place it in the "/data/kits23" folder to follow this tutorial.
16
16
17
17
## Auto3DSeg
18
18
19
-
With Auto3DSeg most segmentation parameters are automatically determined. In this tutorial, we start from a basic automated example, then show how different options can be adjusted if necessary. We use only the **SegResNet** algo here for simplicity, which is a training recipe based on the [segresnet](https://docs.monai.io/en/latest/networks.html#segresnetds).
19
+
With Auto3DSeg most segmentation parameters are automatically determined. In this tutorial, we start from a basic automated example, then show how different options can be adjusted if necessary. We use only the **SegResNet** algo here for simplicity, which is a training recipe based on the [segresnet](https://docs.monai.io/en/latest/networks.html#segresnetds).
20
20
21
21
22
22
### Running based on the input config (one-liner)
@@ -27,15 +27,15 @@ The Auto3DSeg can be run using a config **input.yaml**
27
27
python -m monai.apps.auto3dseg AutoRunner run --input=./input.yaml --algos=segresnet
28
28
```
29
29
30
-
This one line of code will run the full training workflow, including data analysis, multi-fold training, ensembling. The system will adjust parameters based on the data and your available GPU (or multi-GPU) hardware configuration.
31
-
Here we explicitly specified to use only segresnet algo, for other possible parameters of the AutoRunner please see the [monai docs](https://github.com/Project-MONAI/MONAI/blob/main/monai/apps/auto3dseg/auto_runner.py).
30
+
This one line of code will run the full training workflow, including data analysis, multi-fold training, ensembling. The system will adjust parameters based on the data and your available GPU (or multi-GPU) hardware configuration.
31
+
Here we explicitly specified to use only segresnet algo, for other possible parameters of the AutoRunner please see the [monai docs](https://github.com/Project-MONAI/MONAI/blob/main/monai/apps/auto3dseg/auto_runner.py).
32
32
33
33
The [input.yaml](./input.yaml) describes the dataset (KiTS23) task, and must include at least 3 mandatory fields: modality (CT), dataset location (here it's /data/kits23) and the dataset manifest json file [kits23_folds.json](./kits23_folds.json).
34
34
Other parameters can be also added to the input.yaml config. For KiTS23 dataset specifically, we include the "class_names" key to indicate label grouping for the 3 output classes that KiTS23 challenge requires (which is something specific for the KiTS task)
35
35
36
36
### Running from the code
37
37
38
-
If you prefer running from the code (which will allow more customizations), you can create a python file "example.py" and simply run it as
38
+
If you prefer running from the code (which will allow more customizations), you can create a python file "example.py" and simply run it as
augment_mode: ct_ax_1 # change the default augmentation transform sequence to an alternative (with only inplane/axial spatial rotations and scaling)
117
117
118
118
```
119
-
Here we added more optional options to manually fine-tune the performance. The full list of the available "self-explanatory" options can be found [here](https://github.com/Project-MONAI/research-contributions/blob/main/auto3dseg/algorithm_templates/segresnet/configs/hyper_parameters.yaml).
120
-
119
+
Here we added more optional options to manually fine-tune the performance. The full list of the available "self-explanatory" options can be found [here](https://github.com/Project-MONAI/research-contributions/blob/main/auto3dseg/algorithm_templates/segresnet/configs/hyper_parameters.yaml).
120
+
121
121
### Input.yaml options and AutoRunner options combined
122
122
123
123
In the previous sections, we showed how to manually provide various input config options related to **training**. In the same file, one can also add AutoRunner related options, consider the following input3.yaml config
@@ -126,28 +126,28 @@ In the previous sections, we showed how to manually provide various input config
126
126
127
127
# KiTS23 Auto3DSeg user input
128
128
129
-
modality: CT
130
-
dataroot: /data/kits23
131
-
datalist: kits23_folds.json
132
-
class_names:
129
+
modality: CT
130
+
dataroot: /data/kits23
131
+
datalist: kits23_folds.json
132
+
class_names:
133
133
- { name: kidney_and_mass, index: [1,2,3] }
134
134
- { name: mass, index: [2,3] }
135
135
- { name: tumor, index: [2] }
136
-
sigmoid: true
136
+
sigmoid: true
137
137
138
138
# additional options (OPTIONAL)
139
139
num_epochs: 600# manually set number of training epochs to 600 (otherwise it's determined automatically)
140
140
141
141
# additional AutoRunner options (OPTIONAL)
142
142
algos: segresnet
143
143
num_fold: 1
144
-
ensemble: false
144
+
ensemble: false
145
145
work_dir: tmp/tutorial_kits23
146
146
147
147
```
148
148
Here we indicated to use only "segresnet" algo, and only 1 fold training, skip ensembling (since we train 1 model anyway), and change the default working directory. We can run it as
149
149
```bash
150
-
python -m monai.apps.auto3dseg AutoRunner run --input=./input3.yaml
150
+
python -m monai.apps.auto3dseg AutoRunner run --input=./input3.yaml
151
151
```
152
152
One may prefer this format, if they want to put all options in a single file, instead of having training options vs AutoRunner options separatelly. The end results will be the same.
here the "work_dir", "dataroot", "num_epochs" options will override any defaults or any input.yaml provided options.
161
161
162
162
### KiTS 2023 specific options
163
-
163
+
164
164
All the configurations here include some KiTS 2023 specific options below
165
-
```yaml
166
-
class_names:
165
+
```yaml
166
+
class_names:
167
167
- { name: kidney_and_mass, index: [1,2,3] }
168
168
- { name: mass, index: [2,3] }
169
169
- { name: tumor, index: [2] }
170
-
sigmoid: true
170
+
sigmoid: true
171
171
172
172
```
173
-
In KiTS 2023 challenge, the task is to segment 3 specific subregions: a) the first one must include all labels (kidneys, tumors, cysts) b) the second one is a union of tumors and cysts b) the third one is a tumor only region.
174
-
Thus the "class_names" options indicates which label indices to merge together to create these 3 subregions. The "name" keys are used in Tensorboard for convenience (you can use your own names).
173
+
In KiTS 2023 challenge, the task is to segment 3 specific subregions: a) the first one must include all labels (kidneys, tumors, cysts) b) the second one is a union of tumors and cysts b) the third one is a tumor only region.
174
+
Thus the "class_names" options indicates which label indices to merge together to create these 3 subregions. The "name" keys are used in Tensorboard for convenience (you can use your own names).
175
175
Since, the 3 sub-regions are overlapping the segmentation task is a multi-label task, where each voxel can potentially be assigned to several regions. A common formulation of such task is to use the final network activation a "sigmoid", instead of the default "softmax" for mutually exclusive label classes. The config options "sigmoid: true" explicitly indicates that we are going to use the final sigmoid activation (for the multi-label segmentation). Strictly speaking it's not necessary to add this option here, the system will automatically figure it out after inspecting "class_names" having the overlapping indices.
176
176
177
-
Experimentally, you can remove these configs (class_names and sigmoid) completely to try a traditional segmentation (multi-class), to segment 3 mutually exclusive regions: a) kidneys without tumors or cysts b) tumors c) cysts. Generally, this is the default workflow for multi-organ segmentation (with non-overlaping classes). This sub-region grouping is just something specific for the KiTS 2023 challenge.
177
+
Experimentally, you can remove these configs (class_names and sigmoid) completely to try a traditional segmentation (multi-class), to segment 3 mutually exclusive regions: a) kidneys without tumors or cysts b) tumors c) cysts. Generally, this is the default workflow for multi-organ segmentation (with non-overlaping classes). This sub-region grouping is just something specific for the KiTS 2023 challenge.
Training this KiTS 2023 example on on 8 GPU V100 32GB DGX machine, one can expect to get an average Dice of 0.87-0.88 (for fold 0). The higher end of the accuracy range is obtained if you set the ROI size to larger (e.g. roi_size: [336, 336, 336]), but
208
-
this requires a large memory GPU device (such as Nvidia A100). Alternatively you can experiment with training longer, e.g. by setting num_epochs=1200.
208
+
this requires a large memory GPU device (such as Nvidia A100). Alternatively you can experiment with training longer, e.g. by setting num_epochs=1200.
209
209
210
210
## Differences with 1st place KiTS23 solution
211
211
212
-
The tutorial here is to demonstrate how to use Auto3DSeg in general, with various examples for KiTS23 dataset. It is based on the 1st place KiTS23 solution [1], with the main differences being in [1] the training was done in 2 stages: first the approximate Kidney region was detected (by training a model to segment the foreground), second an ensemble of models were trained to segment the 3 KiTS subregions using the "Kidney subregion" cropped CTs. In this tutorial, we train to segment KiTS subregions directly on the full CT for simplicity (which gives a slightly lower average dice, ~1\%). Another difference is that in [1], the ensemble of several models were trained which included both Segresnet and DiNTS models, whereas in this tutorial we focus only on Segresnet.
212
+
The tutorial here is to demonstrate how to use Auto3DSeg in general, with various examples for KiTS23 dataset. It is based on the 1st place KiTS23 solution [1], with the main differences being in [1] the training was done in 2 stages: first the approximate Kidney region was detected (by training a model to segment the foreground), second an ensemble of models were trained to segment the 3 KiTS subregions using the "Kidney subregion" cropped CTs. In this tutorial, we train to segment KiTS subregions directly on the full CT for simplicity (which gives a slightly lower average dice, ~1\%). Another difference is that in [1], the ensemble of several models were trained which included both Segresnet and DiNTS models, whereas in this tutorial we focus only on Segresnet.
213
213
214
214
## Data
215
215
@@ -223,4 +223,3 @@ The KiTS23 challenge dataset [2,3] can be downloaded from [here](https://kits-ch
223
223
[2] Heller, N., Isensee, F., Maier-Hein, K.H., Hou, X., Xie, C., Li, F., Nan, Y., Mu, G., Lin, Z., Han, M., et al.: The state of the art in kidney and kidney tumor segmentation in contrast-enhanced ct imaging: Results of the kits19 challenge. Medical Image Analysis 67, 101821 (2021)
224
224
225
225
[3] Heller, N., Wood, A., Isensee, F., Radsch, T., Tejpaul, R., Papanikolopoulos, N.,Weight, C.: The 2023 kidney and kidney tumor segmentation challenge, https://kits-challenge.org/kits23/
Copy file name to clipboardExpand all lines: auto3dseg/tasks/kits23/input.yaml
+3-4Lines changed: 3 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -11,17 +11,16 @@ class_names: # names for tensorboard, and label index gro
11
11
# OPTIONAL
12
12
# use final sigmoid activation (instead of the default softmax), since KiTS regions are overlapping (multi-label segmentation)
13
13
# this is optional to set, the system auto-detects overlapping labels automatically.
14
-
sigmoid: true
14
+
sigmoid: true
15
15
16
16
# the config below is optional, but it explicitly sets params as it was used during KiTS23 challenge
17
-
# otherwise, the defaults are used, auto_scale_allowed is True and the system will attempt to guess these settings according to the available GPU (e.g. make batch size larger)
17
+
# otherwise, the defaults are used, auto_scale_allowed is True and the system will attempt to guess these settings according to the available GPU (e.g. make batch size larger)
0 commit comments