Skip to content

update 3d seg demo #326

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 1 commit into from
Aug 31, 2021
Merged
Changes from all commits
Commits
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
12 changes: 3 additions & 9 deletions 3d_segmentation/spleen_segmentation_3d_lightning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"source": [
"!python -c \"import monai\" || pip install -q \"monai-weekly[nibabel]\"\n",
"!python -c \"import matplotlib\" || pip install -q matplotlib\n",
"!pip install -q pytorch-lightning==0.9.0\n",
"!pip install -q pytorch-lightning==1.4.0\n",
"%matplotlib inline"
]
},
Expand Down Expand Up @@ -145,8 +145,6 @@
"from monai.apps import download_and_extract\n",
"import torch\n",
"import pytorch_lightning\n",
"from pytorch_lightning.callbacks.model_checkpoint \\\n",
" import ModelCheckpoint\n",
"import matplotlib.pyplot as plt\n",
"import tempfile\n",
"import shutil\n",
Expand Down Expand Up @@ -424,17 +422,13 @@
"tb_logger = pytorch_lightning.loggers.TensorBoardLogger(\n",
" save_dir=log_dir\n",
")\n",
"checkpoint_callback = ModelCheckpoint(\n",
" filepath=os.path.join(\n",
" log_dir, \"{epoch}-{val_loss:.2f}-{val_dice:.2f}\")\n",
")\n",
"\n",
"# initialise Lightning's trainer.\n",
"trainer = pytorch_lightning.Trainer(\n",
" gpus=[0],\n",
" max_epochs=600,\n",
" logger=tb_logger,\n",
" checkpoint_callback=checkpoint_callback,\n",
" checkpoint_callback=True,\n",
" num_sanity_val_steps=1,\n",
")\n",
"\n",
Expand Down Expand Up @@ -710,7 +704,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.7.10"
}
},
"nbformat": 4,
Expand Down