Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Kerfoot <[email protected]>
  • Loading branch information
ericspod committed Sep 7, 2023
1 parent a8ce90a commit b00fa49
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
27 changes: 20 additions & 7 deletions bundle/03_mednist_classification_v2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "64bd2d8c-4799-4073-bc28-c3632589c525",
"id": "9b2bc6c7-f54c-436f-ab66-86a631fb75d8",
"metadata": {},
"source": [
"Copyright (c) MONAI Consortium \n",
Expand All @@ -14,8 +14,25 @@
"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",
"limitations under the License."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2f51a451-566f-4501-aeb8-f3cd5d1f7bf9",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"from monai.apps import MedNISTDataset"
]
},
{
"cell_type": "markdown",
"id": "2682936a-09ed-4703-af06-c59f755395ee",
"metadata": {},
"source": [
"# MedNIST Classification Bundle\n",
"\n",
"In this tutorial we'll revisit the bundle replicating [MONAI 101 notebook](https://github.com/Project-MONAI/tutorials/blob/main/2d_classification/monai_101.ipynb) and add more features representing best practice concepts. This will include evaluation and checkpoint saving techniques.\n",
Expand Down Expand Up @@ -773,8 +790,6 @@
}
],
"source": [
"from monai.apps import MedNISTDataset\n",
"\n",
"root_dir = \".\" # assuming MedNIST was downloaded to the current directory\n",
"num_images = 20\n",
"dataset = MedNISTDataset(root_dir=root_dir, section=\"test\", download=False)\n",
Expand Down Expand Up @@ -1033,8 +1048,6 @@
}
],
"source": [
"import numpy as np\n",
"\n",
"class_names = [\"AbdomenCT\", \"BreastMRI\", \"CXR\", \"ChestCT\", \"Hand\", \"HeadCT\"]\n",
"\n",
"for fn, idx in np.loadtxt(\"predictions.csv\", delimiter=\",\", dtype=str):\n",
Expand Down
4 changes: 2 additions & 2 deletions bundle/04_integrating_code.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@
"source": [
"%%writefile IntegrationBundle/scripts/dataloaders.py\n",
"\n",
"\n",
"import torch\n",
"import torchvision\n",
"\n",
Expand Down Expand Up @@ -350,7 +349,6 @@
"source": [
"%%writefile IntegrationBundle/configs/train.yaml\n",
"\n",
"\n",
"imports:\n",
"- $import torch\n",
"- $import scripts\n",
Expand Down Expand Up @@ -477,6 +475,7 @@
"\n",
"import torch\n",
"\n",
"\n",
"def test(net, testloader):\n",
" correct = 0\n",
" total = 0\n",
Expand Down Expand Up @@ -605,6 +604,7 @@
"import torch\n",
"from PIL import Image\n",
"\n",
"\n",
"def inference(net, transforms, filenames):\n",
" for fn in filenames:\n",
" with Image.open(fn) as im:\n",
Expand Down

0 comments on commit b00fa49

Please sign in to comment.