Skip to content

Commit b3d851c

Browse files
authored
984 fixes notebook (#986)
Signed-off-by: Wenqi Li <wenqil@nvidia.com> Fixes #984 ### Checks <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [ ] Notebook runs automatically `./runner [-p <regex_pattern>]` Signed-off-by: Wenqi Li <wenqil@nvidia.com>
1 parent 564a3fb commit b3d851c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

3d_classification/densenet_training_array.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,10 @@
462462
"# For the other dimensions (channel, width, height), use\n",
463463
"# -1 to use 0 and img.shape[x]-1 for min and max, respectively\n",
464464
"depth_slice = img.shape[2] // 2\n",
465-
"occ_sens_b_box = [-1, -1, depth_slice, depth_slice, -1, -1, -1, -1]\n",
465+
"occ_sens_b_box = [depth_slice-1, depth_slice, -1, -1, -1, -1]\n",
466466
"\n",
467467
"occ_result, _ = occ_sens(x=img, b_box=occ_sens_b_box)\n",
468-
"occ_result = occ_result[..., label.argmax().item()]\n",
468+
"occ_result = occ_result[0, label.argmax().item()][None]\n",
469469
"\n",
470470
"fig, axes = plt.subplots(1, 2, figsize=(25, 15), facecolor=\"white\")\n",
471471
"\n",
@@ -513,7 +513,7 @@
513513
"name": "python",
514514
"nbconvert_exporter": "python",
515515
"pygments_lexer": "ipython3",
516-
"version": "3.8.13"
516+
"version": "3.8.12"
517517
}
518518
},
519519
"nbformat": 4,

modules/interpretability/class_lung_lesion.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"The goal is to demonstrate MONAI's class activation mapping functions for visualising the classification models.\n",
1212
"\n",
1313
"For the demo data:\n",
14-
"- Please see the `bbox_gen.py` script for generating the patch classification data from MSD task06_lung (available via `monai.apps.DecathlonDataset`).\n",
14+
"- Please see the `bbox_gen.py` script for generating the patch classification data from MSD task06_lung (available via `monai.apps.DecathlonDataset`);\n",
1515
"- Alternatively, the patch dataset (~130MB) is available for direct downloading at: https://drive.google.com/drive/folders/1pQdzdkkC9c2GOblLgpGlG3vxsSK9NtDx\n",
1616
"\n",
1717
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Project-MONAI/tutorials/blob/main/modules/interpretability/class_lung_lesion.ipynb)"
@@ -592,9 +592,9 @@
592592
"\n",
593593
"# For occlusion sensitivity, inference must be run many times. Hence, we can use a\n",
594594
"# bounding box to limit it to a 2D plane of interest (z=the_slice) where each of\n",
595-
"# the arguments are the min and max for each of the dimensions (in this case CHWD).\n",
595+
"# the arguments are the min and max for each of the spatial dimensions (in this case HWD).\n",
596596
"the_slice = train_ds[0][\"image\"].shape[-1] // 2\n",
597-
"occ_sens_b_box = [-1, -1, -1, -1, -1, -1, the_slice, the_slice]"
597+
"occ_sens_b_box = [-1, -1, -1, -1, the_slice-1, the_slice]"
598598
]
599599
},
600600
{
@@ -666,7 +666,7 @@
666666
"\n",
667667
" # run occlusion\n",
668668
" occ_result, _ = occ_sens(x=image, b_box=occ_sens_b_box)\n",
669-
" occ_result = occ_result[..., pred_label]\n",
669+
" occ_result = occ_result[0, pred_label][None, None, ..., -1]\n",
670670
"\n",
671671
" for row, (im, title) in enumerate(\n",
672672
" zip(\n",
@@ -762,7 +762,7 @@
762762
"name": "python",
763763
"nbconvert_exporter": "python",
764764
"pygments_lexer": "ipython3",
765-
"version": "3.9.7"
765+
"version": "3.8.12"
766766
}
767767
},
768768
"nbformat": 4,

0 commit comments

Comments
 (0)