Skip to content

1090-enhance-tutorials #1100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 47 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
9c96ccf
add fastmri_ssim script to reconstruction mri tutorial
binliunls Dec 9, 2022
4c67a1c
Merge branch 'Project-MONAI:main' into 1090-improve-tutorials
binliunls Dec 16, 2022
b15e3fe
fix typo, grammar and map device issues in reconstruction tutorial
binliunls Dec 16, 2022
617b15f
fix typo issue in the varnet_demo readme file
binliunls Dec 16, 2022
2819386
fix some typo and grammar issues in readme of detection tutorial
binliunls Dec 16, 2022
e231583
add some explanation, change the aschannelfirst transform and add a i…
binliunls Dec 16, 2022
8e56221
add a noncommercial declaration for the reconstruction tutorial
binliunls Dec 16, 2022
2e1e880
add license info to tutorials
binliunls Dec 17, 2022
b5487fb
Merge branch 'Project-MONAI:main' into 1090-improve-tutorials
binliunls Dec 24, 2022
c8ed920
update licenses info of 3d_segmentation
binliunls Dec 24, 2022
5430529
update licenses info of auto3dseg tutorial
binliunls Dec 24, 2022
8f4c330
update licenses info of deep atlas tutorial
binliunls Dec 24, 2022
29158f9
update licenses info of modules' 3 tutorials
binliunls Dec 24, 2022
410eb28
update licenses info of pathology and performance_profiling tutorials
binliunls Dec 24, 2022
8a6bb75
Merge branch 'Project-MONAI:main' into 1090-improve-tutorials
binliunls Jan 5, 2023
66ca2a1
Merge branch 'Project-MONAI:main' into 1090-improve-tutorials
binliunls Jan 13, 2023
face476
update paired_lung_ct with new output
binliunls Jan 13, 2023
1504529
update the license info for CAI
binliunls Jan 13, 2023
fee18e4
update license info in reconstruction tutorial
binliunls Jan 13, 2023
94a6288
update bundle_integrate_mlflow tutorial with the new contribution guide
binliunls Jan 13, 2023
93cbfb9
update tutorials with new license info
binliunls Jan 13, 2023
1c6ec89
fix typo in swin_unetr_brats21_segmentation_3d.ipynb
mingxin-zheng Jan 16, 2023
afd1f3f
Merge branch 'main' into 1090-improve-tutorials
mingxin-zheng Jan 16, 2023
5dfe1a8
make graphs local in swin_unetr_btcv_segmentation_3d
mingxin-zheng Jan 16, 2023
0a71023
make graphs local for unetr_btcv_segmentation_3d_lightening
mingxin-zheng Jan 16, 2023
9fe4b9f
auto3dseg typo correction
mingxin-zheng Jan 16, 2023
7aa64c6
correct auto3dseg nb formats
mingxin-zheng Jan 16, 2023
a5f46bf
fix missing imports
mingxin-zheng Jan 16, 2023
caf6c5e
add dataset license explanation for video_seg
mingxin-zheng Jan 16, 2023
fa971cc
update licences info.
binliunls Jan 16, 2023
d2f76c7
update tutorials according to contribution guideline
binliunls Jan 16, 2023
6d8ca08
fix formats
mingxin-zheng Jan 16, 2023
c109d29
Merge branch 'main' into 1090-improve-tutorials
mingxin-zheng Jan 16, 2023
a6c2da0
fix setup imports in 2d/3d_segmentation
mingxin-zheng Jan 16, 2023
e70a51c
delete redundant import info
binliunls Jan 17, 2023
39f58ad
Merge branch '1090-improve-tutorials' of https://github.com/binliunls…
binliunls Jan 17, 2023
e5168ac
merge the print_config cell with import cell
binliunls Jan 17, 2023
97eb76a
fix a typo issue in deep_atlas_tutorial
binliunls Jan 17, 2023
d1c2804
update inference notebook in unet demo according to contribution guid…
binliunls Jan 17, 2023
4705967
update inference notebook in varnet_demo according to contribution gu…
binliunls Jan 17, 2023
b566c94
remove the output count in unet_demo inference notebook
binliunls Jan 17, 2023
24cb5e2
move the print config funtion in CAI to the end of the import part.
binliunls Jan 17, 2023
d83db04
add setup imports subtitle for unetr_btcv_segmentation_3d tutorial
binliunls Jan 17, 2023
117d8d1
change the image link in the spleen_segmentation_3d tutorial from a h…
binliunls Jan 17, 2023
4015868
update according to guideline test
binliunls Jan 17, 2023
5c6df4b
update the experiment management tutorial's setup experiment part
binliunls Jan 17, 2023
d0e73f7
Merge branch 'main' into 1090-improve-tutorials
mingxin-zheng Jan 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
676 changes: 2 additions & 674 deletions 2d_classification/mednist_tutorial.ipynb

Large diffs are not rendered by default.

16 changes: 4 additions & 12 deletions 2d_registration/registration_mednist.ipynb

Large diffs are not rendered by default.

399 changes: 157 additions & 242 deletions 3d_registration/paired_lung_ct.ipynb

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions 3d_segmentation/brats_segmentation_3d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Copyright (c) MONAI Consortium \n",
"Licensed under the Apache License, Version 2.0 (the \"License\"); \n",
"you may not use this file except in compliance with the License. \n",
"You may obtain a copy of the License at \n",
"    http://www.apache.org/licenses/LICENSE-2.0 \n",
"Unless required by applicable law or agreed to in writing, software \n",
"distributed under the License is distributed on an \"AS IS\" BASIS, \n",
"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \n",
"See the License for the specific language governing permissions and \n",
"limitations under the License.\n",
"\n",
"# Brain tumor 3D segmentation with MONAI\n",
"\n",
"This tutorial shows how to construct a training workflow of multi-labels segmentation task.\n",
Expand Down Expand Up @@ -107,17 +118,6 @@
}
],
"source": [
"# Copyright 2020 MONAI Consortium\n",
"# Licensed under the Apache License, Version 2.0 (the \"License\");\n",
"# you may not use this file except in compliance with the License.\n",
"# You may obtain a copy of the License at\n",
"# http://www.apache.org/licenses/LICENSE-2.0\n",
"# Unless required by applicable law or agreed to in writing, software\n",
"# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
"# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
"# See the License for the specific language governing permissions and\n",
"# limitations under the License.\n",
"\n",
"import os\n",
"import shutil\n",
"import tempfile\n",
Expand Down
2 changes: 1 addition & 1 deletion 3d_segmentation/challenge_baseline/run_net.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# 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
Expand Down
2 changes: 1 addition & 1 deletion 3d_segmentation/ignite/unet_evaluation_array.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# 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
Expand Down
2 changes: 1 addition & 1 deletion 3d_segmentation/ignite/unet_evaluation_dict.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# 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
Expand Down
2 changes: 1 addition & 1 deletion 3d_segmentation/ignite/unet_training_array.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# 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
Expand Down
2 changes: 1 addition & 1 deletion 3d_segmentation/ignite/unet_training_dict.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 MONAI Consortium
# 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
Expand Down
128 changes: 63 additions & 65 deletions 3d_segmentation/spleen_segmentation_3d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Copyright (c) MONAI Consortium \n",
"Licensed under the Apache License, Version 2.0 (the \"License\"); \n",
"you may not use this file except in compliance with the License. \n",
"You may obtain a copy of the License at \n",
"    http://www.apache.org/licenses/LICENSE-2.0 \n",
"Unless required by applicable law or agreed to in writing, software \n",
"distributed under the License is distributed on an \"AS IS\" BASIS, \n",
"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \n",
"See the License for the specific language governing permissions and \n",
"limitations under the License.\n",
"\n",
"# Spleen 3D segmentation with MONAI\n",
"\n",
"This tutorial shows how to integrate MONAI into an existing PyTorch medical DL program.\n",
Expand All @@ -21,7 +32,7 @@
"\n",
"The Spleen dataset can be downloaded from http://medicaldecathlon.com/.\n",
"\n",
"![spleen](http://medicaldecathlon.com/img/spleen0.png)\n",
"![spleen](../figures/spleen0.png)\n",
"\n",
"Target: Spleen \n",
"Modality: CT \n",
Expand Down Expand Up @@ -50,13 +61,62 @@
"%matplotlib inline"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Setup imports"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/opt/conda/lib/python3.8/site-packages/tqdm/auto.py:22: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"MONAI version: 1.1.0+2.g97918e46\n",
"Numpy version: 1.22.2\n",
"Pytorch version: 1.13.0a0+d0d6b1f\n",
"MONAI flags: HAS_EXT = True, USE_COMPILED = False, USE_META_DICT = False\n",
"MONAI rev id: 97918e46e0d2700c050e678d72e3edb35afbd737\n",
"MONAI __file__: /opt/monai/monai/__init__.py\n",
"\n",
"Optional dependencies:\n",
"Pytorch Ignite version: 0.4.10\n",
"Nibabel version: 4.0.2\n",
"scikit-image version: 0.19.3\n",
"Pillow version: 9.0.1\n",
"Tensorboard version: 2.10.1\n",
"gdown version: 4.6.0\n",
"TorchVision version: 0.14.0a0\n",
"tqdm version: 4.64.1\n",
"lmdb version: 1.3.0\n",
"psutil version: 5.9.2\n",
"pandas version: 1.4.4\n",
"einops version: 0.6.0\n",
"transformers version: 4.21.3\n",
"mlflow version: 2.0.1\n",
"pynrrd version: 1.0.0\n",
"\n",
"For details about installing the optional dependencies, please visit:\n",
" https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies\n",
"\n"
]
}
],
"source": [
"from monai.utils import first, set_determinism\n",
"from monai.transforms import (\n",
Expand Down Expand Up @@ -87,69 +147,7 @@
"import tempfile\n",
"import shutil\n",
"import os\n",
"import glob"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Setup imports"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"MONAI version: 0.9.1\n",
"Numpy version: 1.22.4\n",
"Pytorch version: 1.13.0a0+340c412\n",
"MONAI flags: HAS_EXT = True, USE_COMPILED = False, USE_META_DICT = False\n",
"MONAI rev id: 356d2d2f41b473f588899d705bbc682308cee52c\n",
"MONAI __file__: /opt/monai/monai/__init__.py\n",
"\n",
"Optional dependencies:\n",
"Pytorch Ignite version: 0.4.9\n",
"Nibabel version: 4.0.1\n",
"scikit-image version: 0.19.3\n",
"Pillow version: 9.0.1\n",
"Tensorboard version: 2.9.1\n",
"gdown version: 4.5.1\n",
"TorchVision version: 0.13.0a0\n",
"tqdm version: 4.64.0\n",
"lmdb version: 1.3.0\n",
"psutil version: 5.9.1\n",
"pandas version: 1.3.5\n",
"einops version: 0.4.1\n",
"transformers version: 4.20.1\n",
"mlflow version: 1.27.0\n",
"pynrrd version: 0.4.3\n",
"\n",
"For details about installing the optional dependencies, please visit:\n",
" https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies\n",
"\n"
]
}
],
"source": [
"# Copyright 2020 MONAI Consortium\n",
"# Licensed under the Apache License, Version 2.0 (the \"License\");\n",
"# you may not use this file except in compliance with the License.\n",
"# You may obtain a copy of the License at\n",
"# http://www.apache.org/licenses/LICENSE-2.0\n",
"# Unless required by applicable law or agreed to in writing, software\n",
"# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
"# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
"# See the License for the specific language governing permissions and\n",
"# limitations under the License.\n",
"\n",
"import glob\n",
"\n",
"print_config()"
]
Expand Down
26 changes: 13 additions & 13 deletions 3d_segmentation/spleen_segmentation_3d_lightning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Copyright (c) MONAI Consortium \n",
"Licensed under the Apache License, Version 2.0 (the \"License\"); \n",
"you may not use this file except in compliance with the License. \n",
"You may obtain a copy of the License at \n",
"    http://www.apache.org/licenses/LICENSE-2.0 \n",
"Unless required by applicable law or agreed to in writing, software \n",
"distributed under the License is distributed on an \"AS IS\" BASIS, \n",
"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \n",
"See the License for the specific language governing permissions and \n",
"limitations under the License. \n",
"\n",
"# Spleen 3D segmentation with MONAI"
]
},
Expand Down Expand Up @@ -105,17 +116,6 @@
}
],
"source": [
"# Copyright 2020 MONAI Consortium\n",
"# Licensed under the Apache License, Version 2.0 (the \"License\");\n",
"# you may not use this file except in compliance with the License.\n",
"# You may obtain a copy of the License at\n",
"# http://www.apache.org/licenses/LICENSE-2.0\n",
"# Unless required by applicable law or agreed to in writing, software\n",
"# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
"# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
"# See the License for the specific language governing permissions and\n",
"# limitations under the License.\n",
"\n",
"import pytorch_lightning\n",
"from monai.utils import set_determinism\n",
"from monai.transforms import (\n",
Expand Down Expand Up @@ -683,7 +683,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.8.10 64-bit",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -697,7 +697,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.8.13"
},
"vscode": {
"interpreter": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"Licensed under the Apache License, Version 2.0 (the \"License\"); \n",
"you may not use this file except in compliance with the License. \n",
"You may obtain a copy of the License at \n",
" http://www.apache.org/licenses/LICENSE-2.0 \n",
"    http://www.apache.org/licenses/LICENSE-2.0 \n",
"Unless required by applicable law or agreed to in writing, software \n",
"distributed under the License is distributed on an \"AS IS\" BASIS, \n",
"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \n",
"See the License for the specific language governing permissions and \n",
"limitations under the License. \n",
"limitations under the License.\n",
"\n",
"# Spleen 3D segmentation with MONAI\n",
"\n",
Expand Down
48 changes: 36 additions & 12 deletions 3d_segmentation/swin_unetr_brats21_segmentation_3d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,30 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# 3D Brain Tumor Segmentation with Swin UNETR (BraTS 21 Challenge)\n",
"Copyright (c) MONAI Consortium \n",
"Licensed under the Apache License, Version 2.0 (the \"License\"); \n",
"you may not use this file except in compliance with the License. \n",
"You may obtain a copy of the License at \n",
"    http://www.apache.org/licenses/LICENSE-2.0 \n",
"Unless required by applicable law or agreed to in writing, software \n",
"distributed under the License is distributed on an \"AS IS\" BASIS, \n",
"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \n",
"See the License for the specific language governing permissions and \n",
"limitations under the License. \n",
"\n",
"# 3D Brain Tumor Segmentation with Swin UNETR (BraTS 21 Challenge)\n",
"\n",
"\n",
"This tutorial uses the [Swin UNETR](https://arxiv.org/pdf/2201.01266.pdf/) [1,2] model for the task of brain tumor segmentation using the [BraTS 21](http://braintumorsegmentation.org/) challenge dataset [3,4,5,6]. Swin UNETR ranked among top-performing models in BraTS 21 validation phase. The architecture of Swin UNETR is demonstrated as below\n",
"![image](https://lh3.googleusercontent.com/pw/AM-JKLXBhxHcB6fGG6OoWnx1-_uwhfg9J-5HamVpDbmUTc395EbkiIwA7p2y1piZz5-uz1J9dcOhHwrhT_mpPJzDqfvSEM_qFIieE0_FC_5i5YQLm23QJjkSyIydjQ4gSX3TdpibUgDXxaWJkfOHKMW7rJD-=w1388-h523-no?authuser=2)\n",
"\n",
"![swin_brats](../figures/swin_brats21.png)\n",
"\n",
"The following features are included in this tutorial:\n",
"1. Transforms for dictionary format data.\n",
"1. Define a new transform according to MONAI transform API.\n",
"1. Load Nifti image with metadata, load a list of images and stack them.\n",
"1. Randomly rotate across each axes for data augmentation.\n",
"1. Randomly adjust intensity for data augmentation.\n",
"1. Randomly adjust the intensity for data augmentation.\n",
"1. Cache IO and transforms to accelerate training and validation.\n",
"1. Swin UNETR model, Dice loss function, Mean Dice metric for brain tumor segmentation task.\n",
"\n",
Expand All @@ -33,15 +45,15 @@
"\n",
"https://www.synapse.org/#!Synapse:syn27046444/wiki/616992\n",
"\n",
"The json file containing training and validation sets (internal split) needs to be downloaded from this [link](https://drive.google.com/file/d/1i-BXYe-wZ8R9Vp3GXoajGyqaJ65Jybg1/view?usp=sharing) and placed in the same folder as the dataset. As discussed in the following, this tutorial uses fold 1 for training a Swin UNETR model on BraTS 21 challenge.\n",
"The JSON file containing training and validation sets (internal split) needs to be downloaded from this [link](https://drive.google.com/file/d/1i-BXYe-wZ8R9Vp3GXoajGyqaJ65Jybg1/view?usp=sharing) and placed in the same folder as the dataset. As discussed in the following, this tutorial uses fold 1 for training a Swin UNETR model on the BraTS 21 challenge.\n",
"\n",
"### Tumor Characteristics\n",
"\n",
"The sub-regions considered for evaluation in BraTS 21 challenge are the \"enhancing tumor\" (ET), the \"tumor core\" (TC), and the \"whole tumor\" (WT). The ET is described by areas that show hyper-intensity in T1Gd when compared to T1, but also when compared to “healthy” white matter in T1Gd. The TC describes the bulk of the tumor, which is what is typically resected. The TC entails the ET, as well as the necrotic (NCR) parts of the tumor. The appearance of NCR is typically hypo-intense in T1-Gd when compared to T1. The WT describes the complete extent of the disease, as it entails the TC and the peritumoral edematous/invaded tissue (ED), which is typically depicted by hyper-intense signal in FLAIR [[BraTS 21]](http://braintumorsegmentation.org/).\n",
"The sub-regions considered for evaluation in the BraTS 21 challenge are the \"enhancing tumor\" (ET), the \"tumor core\" (TC), and the \"whole tumor\" (WT). The ET is described by areas that show hyper-intensity in T1Gd when compared to T1, but also when compared to “healthy” white matter in T1Gd. The TC describes the bulk of the tumor, which is what is typically resected. The TC entails the ET, as well as the necrotic (NCR) parts of the tumor. The appearance of NCR is typically hypo-intense in T1-Gd when compared to T1. The WT describes the complete extent of the disease, as it entails the TC and the peritumoral edematous/invaded tissue (ED), which is typically depicted by the hyper-intense signal in FLAIR [[BraTS 21]](http://braintumorsegmentation.org/).\n",
"\n",
"The provided segmentation labels have values of 1 for NCR, 2 for ED, 4 for ET, and 0 for everything else.\n",
"\n",
"![image](https://lh3.googleusercontent.com/pw/AM-JKLWJu7l7W3UKfGiWRFkqC-F9FY26f_GH-81N2cp0sMhnDN5k0s709dTFGxkJv-QQN6poOSvaCJ9chP7_M9QrrjpyMvoZozs6eWCMCeBG97jpilq8jvZdqqevVs6jp-FpFKdHZxzXGXfnZdbvmgh8kN9O=w830-h399-no?authuser=2)\n",
"![image](../figures/fig_brats21.png)\n",
"\n",
"Figure from [Baid et al.](https://arxiv.org/pdf/2107.02314v1.pdf) [3]\n",
"\n",
Expand Down Expand Up @@ -74,22 +86,26 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Swin UNETR Model\n",
"## Swin UNETR Model\n",
"\n",
"The inputs to [Swin UNETR](https://arxiv.org/pdf/2201.01266.pdf/) are 3D multi-modal MRI images with 4 channels. The patch partition block creates non-overlapping patches of the input data and projects them into embedding tokens with resolution of 128x128x128. The projected tokens are then encoded by using a 3D [Swin Transformer](https://openaccess.thecvf.com/content/ICCV2021/papers/Liu_Swin_Transformer_Hierarchical_Vision_Transformer_Using_Shifted_Windows_ICCV_2021_paper.pdf/) in which the self-attention is computed within local windows. The interaction between different windows are obtained by using 3D window shifting as illustrated below. \n",
"The inputs to [Swin UNETR](https://arxiv.org/pdf/2201.01266.pdf) are 3D multi-modal MRI images with 4 channels.\n",
"The patch partition block creates non-overlapping patches of the input data and projects them into embedding tokens with a resolution of 128x128x128.\n",
"The projected tokens are then encoded by using a 3D [Swin Transformer](https://openaccess.thecvf.com/content/ICCV2021/papers/Liu_Swin_Transformer_Hierarchical_Vision_Transformer_Using_Shifted_Windows_ICCV_2021_paper.pdf) in which the self-attention is computed within local windows.\n",
"The interaction between different windows is obtained by using 3D window shifting as illustrated below. \n",
"\n",
"![image](https://lh3.googleusercontent.com/pw/AM-JKLULHyJ1YW_QWRgR2bViIOdnz9ppOpBWFpGhoxe-tmbXug0IdvV2WUUYH__EJt4iGwgD_aKm6GO4QbJZqkITr6_WXNuYRiugp-3Ir162J6XdCHv8xV2w2xIHQ7ZVWyx9ALqLG0LfmdcUQce5m8pWVfIS=w908-h379-no?authuser=2)\n",
"![image](../figures/shift_patch.png)\n",
"\n",
"The transformer-based encoder is connected to a CNN-decoder via skip connection at multiple resolutions. The segmentation output consists of 3 output channels corresponding to ET,WT and TC sub-regions and is computed by using a 1x1x1 convolutional layer followed by Sigmoid activation function.\n"
"The transformer-based encoder is connected to a CNN-decoder via skip connection at multiple resolutions.\n",
"The segmentation output consists of 3 output channels corresponding to ET, WT, and TC sub-regions and is computed by using a 1x1x1 convolutional layer followed by Sigmoid activation function.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
" # Download dataset and json file\n",
" ## Download dataset and json file\n",
"\n",
"- Register and download the official BraTS 21 dataset from the link below and place then into \"TrainingData\" in the dataset folder:\n",
"- Register and download the official BraTS 21 dataset from the link below and place them into \"TrainingData\" in the dataset folder:\n",
"\n",
" https://www.synapse.org/#!Synapse:syn27046444/wiki/616992\n",
" \n",
Expand Down Expand Up @@ -119,6 +135,14 @@
"%matplotlib inline"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Setup imports"
]
},
{
"cell_type": "code",
"execution_count": 2,
Expand Down
Loading