Skip to content

Commit

Permalink
245 Update tutorials with new API (part 2) (Project-MONAI#253)
Browse files Browse the repository at this point in the history
* update with new api

Signed-off-by: Yiheng Wang <vennw@nvidia.com>

* fix pep8 lr

Signed-off-by: Yiheng Wang <vennw@nvidia.com>

* fix format error

Signed-off-by: Yiheng Wang <vennw@nvidia.com>

* update with decollate

Signed-off-by: Yiheng Wang <vennw@nvidia.com>

* replace to use 0.6.0

Signed-off-by: Yiheng Wang <vennw@nvidia.com>

* update inverse example

Signed-off-by: Yiheng Wang <vennw@nvidia.com>

* update transfer mmar

Signed-off-by: Yiheng Wang <vennw@nvidia.com>

* update with new api for jupyter_utils.ipynb

Signed-off-by: Yiheng Wang <vennw@nvidia.com>

* fix pep8

Signed-off-by: Yiheng Wang <vennw@nvidia.com>
  • Loading branch information
yiheng-wang-nv authored Jul 12, 2021
1 parent 28630e7 commit 70ac974
Show file tree
Hide file tree
Showing 22 changed files with 425 additions and 433 deletions.
30 changes: 16 additions & 14 deletions modules/3d_image_transforms.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,26 @@
"name": "stdout",
"output_type": "stream",
"text": [
"MONAI version: 0.4.0+35.g6adbcde\n",
"Numpy version: 1.19.5\n",
"Pytorch version: 1.7.1\n",
"MONAI flags: HAS_EXT = False, USE_COMPILED = False\n",
"MONAI rev id: 6adbcdee45c16f18f5b713575af3410437177311\n",
"MONAI version: 0.6.0rc1+23.gc6793fd0\n",
"Numpy version: 1.20.3\n",
"Pytorch version: 1.9.0a0+c3d40fd\n",
"MONAI flags: HAS_EXT = True, USE_COMPILED = False\n",
"MONAI rev id: c6793fd0f316a448778d0047664aaf8c1895fe1c\n",
"\n",
"Optional dependencies:\n",
"Pytorch Ignite version: 0.4.2\n",
"Pytorch Ignite version: 0.4.5\n",
"Nibabel version: 3.2.1\n",
"scikit-image version: 0.18.1\n",
"Pillow version: 7.0.0\n",
"Tensorboard version: 2.4.0\n",
"gdown version: 3.12.2\n",
"TorchVision version: 0.8.2\n",
"scikit-image version: 0.15.0\n",
"Pillow version: 8.2.0\n",
"Tensorboard version: 2.5.0\n",
"gdown version: 3.13.0\n",
"TorchVision version: 0.10.0a0\n",
"ITK version: 5.1.2\n",
"tqdm version: 4.51.0\n",
"lmdb version: 1.0.0\n",
"tqdm version: 4.53.0\n",
"lmdb version: 1.2.1\n",
"psutil version: 5.8.0\n",
"pandas version: 1.1.4\n",
"einops version: 0.3.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",
Expand Down Expand Up @@ -800,7 +802,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
10 changes: 6 additions & 4 deletions modules/TorchIO_MONAI_PyTorch_Lightning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"source": [
"%%bash\n",
"pip install -q torchio==0.18.39\n",
"pip install -q \"monai[gdown]\"==0.5.2\n",
"pip install -q \"monai[gdown]\"==0.6.0\n",
"pip install -q pytorch-lightning==1.2.10\n",
"pip install -q pandas==1.1.5 seaborn==0.11.1"
]
Expand Down Expand Up @@ -500,8 +500,10 @@
" logits = model.net(inputs.to(model.device))\n",
" labels = logits.argmax(dim=1)\n",
" labels_one_hot = torch.nn.functional.one_hot(labels).permute(0, 4, 1, 2, 3)\n",
" dices, _ = get_dice(labels_one_hot.to(model.device), targets.to(model.device))\n",
" all_dices.append(dices.cpu())\n",
" get_dice(labels_one_hot.to(model.device), targets.to(model.device))\n",
" metric = get_dice.aggregate()\n",
" get_dice.reset()\n",
" all_dices.append(metric)\n",
"all_dices = torch.cat(all_dices)"
]
},
Expand Down Expand Up @@ -867,7 +869,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.10"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
30 changes: 16 additions & 14 deletions modules/autoencoder_mednist.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,26 @@
"name": "stdout",
"output_type": "stream",
"text": [
"MONAI version: 0.4.0+42.g58bc231.dirty\n",
"Numpy version: 1.19.5\n",
"Pytorch version: 1.7.1\n",
"MONAI flags: HAS_EXT = False, USE_COMPILED = False\n",
"MONAI rev id: 58bc231cb8a3eff6864cf857b2b4dc263d6738cc\n",
"MONAI version: 0.6.0rc1+23.gc6793fd0\n",
"Numpy version: 1.20.3\n",
"Pytorch version: 1.9.0a0+c3d40fd\n",
"MONAI flags: HAS_EXT = True, USE_COMPILED = False\n",
"MONAI rev id: c6793fd0f316a448778d0047664aaf8c1895fe1c\n",
"\n",
"Optional dependencies:\n",
"Pytorch Ignite version: 0.4.2\n",
"Pytorch Ignite version: 0.4.5\n",
"Nibabel version: 3.2.1\n",
"scikit-image version: 0.18.1\n",
"Pillow version: 8.1.0\n",
"Tensorboard version: 2.4.0\n",
"gdown version: 3.12.2\n",
"TorchVision version: 0.8.2\n",
"scikit-image version: 0.15.0\n",
"Pillow version: 8.2.0\n",
"Tensorboard version: 2.5.0\n",
"gdown version: 3.13.0\n",
"TorchVision version: 0.10.0a0\n",
"ITK version: 5.1.2\n",
"tqdm version: 4.51.0\n",
"lmdb version: 1.0.0\n",
"tqdm version: 4.53.0\n",
"lmdb version: 1.2.1\n",
"psutil version: 5.8.0\n",
"pandas version: 1.1.4\n",
"einops version: 0.3.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",
Expand Down Expand Up @@ -522,7 +524,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
23 changes: 12 additions & 11 deletions modules/csv_datasets.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
{
"cell_type": "code",
"execution_count": 61,
"execution_count": 1,
"metadata": {
"tags": []
},
Expand All @@ -46,25 +46,26 @@
"name": "stdout",
"output_type": "stream",
"text": [
"MONAI version: 0.4.0+507.g919c88e9\n",
"Numpy version: 1.21.0\n",
"Pytorch version: 1.9.0+cu102\n",
"MONAI flags: HAS_EXT = False, USE_COMPILED = False\n",
"MONAI rev id: 919c88e9f636b5f63d3fa8a3527789df15526c12\n",
"MONAI version: 0.6.0rc1+23.gc6793fd0\n",
"Numpy version: 1.20.3\n",
"Pytorch version: 1.9.0a0+c3d40fd\n",
"MONAI flags: HAS_EXT = True, USE_COMPILED = False\n",
"MONAI rev id: c6793fd0f316a448778d0047664aaf8c1895fe1c\n",
"\n",
"Optional dependencies:\n",
"Pytorch Ignite version: 0.4.4\n",
"Pytorch Ignite version: 0.4.5\n",
"Nibabel version: 3.2.1\n",
"scikit-image version: 0.15.0\n",
"Pillow version: 8.2.0\n",
"Tensorboard version: 1.15.0+nv\n",
"Tensorboard version: 2.5.0\n",
"gdown version: 3.13.0\n",
"TorchVision version: 0.9.0a0\n",
"TorchVision version: 0.10.0a0\n",
"ITK version: 5.1.2\n",
"tqdm version: 4.53.0\n",
"lmdb version: 1.1.1\n",
"lmdb version: 1.2.1\n",
"psutil version: 5.8.0\n",
"pandas version: 1.1.4\n",
"einops version: 0.3.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",
Expand Down Expand Up @@ -599,7 +600,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
29 changes: 15 additions & 14 deletions modules/image_dataset.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {
"execution": {
"iopub.execute_input": "2021-01-14T12:34:04.909819Z",
Expand All @@ -59,25 +59,26 @@
"name": "stdout",
"output_type": "stream",
"text": [
"MONAI version: 0.5.3+144.geec33b6d\n",
"Numpy version: 1.21.0\n",
"Pytorch version: 1.9.0\n",
"MONAI flags: HAS_EXT = False, USE_COMPILED = False\n",
"MONAI rev id: eec33b6ddb987dc6be24ec0ace41bb55cc38a661\n",
"MONAI version: 0.6.0rc1+23.gc6793fd0\n",
"Numpy version: 1.20.3\n",
"Pytorch version: 1.9.0a0+c3d40fd\n",
"MONAI flags: HAS_EXT = True, USE_COMPILED = False\n",
"MONAI rev id: c6793fd0f316a448778d0047664aaf8c1895fe1c\n",
"\n",
"Optional dependencies:\n",
"Pytorch Ignite version: 0.4.4\n",
"Pytorch Ignite version: 0.4.5\n",
"Nibabel version: 3.2.1\n",
"scikit-image version: 0.18.1\n",
"scikit-image version: 0.15.0\n",
"Pillow version: 8.2.0\n",
"Tensorboard version: 2.5.0\n",
"gdown version: 3.13.0\n",
"TorchVision version: 0.10.0\n",
"TorchVision version: 0.10.0a0\n",
"ITK version: 5.1.2\n",
"tqdm version: 4.61.1\n",
"tqdm version: 4.53.0\n",
"lmdb version: 1.2.1\n",
"psutil version: 5.8.0\n",
"pandas version: 1.2.5\n",
"pandas version: 1.1.4\n",
"einops version: 0.3.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",
Expand Down Expand Up @@ -123,7 +124,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -149,7 +150,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {
"execution": {
"iopub.execute_input": "2021-01-14T12:34:07.530773Z",
Expand Down Expand Up @@ -226,7 +227,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.10"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
28 changes: 15 additions & 13 deletions modules/integrate_3rd_party_transforms.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -102,24 +102,26 @@
"name": "stdout",
"output_type": "stream",
"text": [
"MONAI version: 0.4.0+35.g6adbcde\n",
"Numpy version: 1.19.5\n",
"Pytorch version: 1.7.1\n",
"MONAI flags: HAS_EXT = False, USE_COMPILED = False\n",
"MONAI rev id: 6adbcdee45c16f18f5b713575af3410437177311\n",
"MONAI version: 0.6.0rc1+23.gc6793fd0\n",
"Numpy version: 1.20.3\n",
"Pytorch version: 1.9.0a0+c3d40fd\n",
"MONAI flags: HAS_EXT = True, USE_COMPILED = False\n",
"MONAI rev id: c6793fd0f316a448778d0047664aaf8c1895fe1c\n",
"\n",
"Optional dependencies:\n",
"Pytorch Ignite version: 0.4.2\n",
"Pytorch Ignite version: 0.4.5\n",
"Nibabel version: 3.2.1\n",
"scikit-image version: 0.18.1\n",
"scikit-image version: 0.15.0\n",
"Pillow version: 7.0.0\n",
"Tensorboard version: 2.4.0\n",
"gdown version: 3.12.2\n",
"TorchVision version: 0.8.2\n",
"Tensorboard version: 2.5.0\n",
"gdown version: 3.13.0\n",
"TorchVision version: 0.10.0a0\n",
"ITK version: 5.1.2\n",
"tqdm version: 4.51.0\n",
"lmdb version: 1.0.0\n",
"tqdm version: 4.53.0\n",
"lmdb version: 1.2.1\n",
"psutil version: 5.8.0\n",
"pandas version: 1.1.4\n",
"einops version: 0.3.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",
Expand Down Expand Up @@ -484,7 +486,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 70ac974

Please sign in to comment.