Skip to content

Commit

Permalink
update: add setup and intro
Browse files Browse the repository at this point in the history
  • Loading branch information
soumik12345 committed Jan 16, 2024
1 parent 860ed8e commit 61f295d
Showing 1 changed file with 56 additions and 2 deletions.
58 changes: 56 additions & 2 deletions colabs/monai/3d_brain_tumor_segmentation.ipynb
Original file line number Diff line number Diff line change
@@ -1,12 +1,47 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Brain tumor 3D segmentation with MONAI and Weights & Biases\n",
"\n",
"This tutorial shows how to construct a training workflow of multi-labels segmentation task using [MONAI](https://github.com/Project-MONAI/MONAI) and use experiment tracking and data visualization features of [Weights & Biases](https://wandb.ai/site). The tutorial contains the following features:\n",
"\n",
"1. Initialize a Weights & Biases run and synchrozize all configs associated with the run for reproducibility.\n",
"2. MONAI transform API:\n",
" 1. MONAI Transforms for dictionary format data.\n",
" 2. How to define a new transform according to MONAI transform API.\n",
" 3. How to randomly adjust intensity for data augmentation.\n",
"3. Data Loading and Visualization:\n",
" 1. Load Nifti image with metadata, load a list of images and stack them.\n",
" 2. Cache IO and transforms to accelerate training and validation.\n",
" 3. Visualize the data using `wandb.Table` and interactive segmentation overlay on Weights & Biases.\n",
"4. Training a 3D `SegResNet` model\n",
" 1. Using the `networks`, `losses`, and `metrics` APIs from MONAI.\n",
" 2. Training the 3D `SegResNet` model using a PyTorch training loop.\n",
" 3. Track the training experiment using Weights & Biases.\n",
" 4. Log and version model checkpoints as model artifacts on Weights & Biases.\n",
"5. Visualize and compare the predictions on the validation dataset using `wandb.Table` and interactive segmentation overlay on Weights & Biases."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Setup and Installation\n",
"\n",
"First, let us install the latest version of both MONAI and Weights and Biases."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pip install -q \"monai-weekly[nibabel, tqdm]\" wandb"
"!python -c \"import monai\" || pip install -q -U \"monai[nibabel, tqdm]\"\n",
"!python -c \"import wandb\" || pip install -q -U wandb"
]
},
{
Expand All @@ -24,6 +59,7 @@
"from monai.apps import DecathlonDataset\n",
"from monai.data import DataLoader, decollate_batch\n",
"from monai.losses import DiceLoss\n",
"from monai.config import print_config\n",
"from monai.inferers import sliding_window_inference\n",
"from monai.metrics import DiceMetric\n",
"from monai.networks.nets import SegResNet\n",
Expand All @@ -45,7 +81,25 @@
")\n",
"from monai.utils import set_determinism\n",
"\n",
"import torch"
"import torch\n",
"\n",
"print_config()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We will then authenticate this colab instance to use W&B."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"wandb.login()"
]
},
{
Expand Down

0 comments on commit 61f295d

Please sign in to comment.