Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 9, 2024
1 parent d6aec13 commit 8eec20d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 28 deletions.
37 changes: 19 additions & 18 deletions generation/2d_autoencoderkl/2d_autoencoderkl_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -272,20 +272,19 @@
"source": [
"image_size = 64\n",
"all_transforms = [\n",
" transforms.LoadImaged(keys=[\"image\"]),\n",
" transforms.EnsureChannelFirstd(keys=[\"image\"]),\n",
" transforms.ScaleIntensityRanged(keys=[\"image\"], a_min=0.0,\n",
" a_max=255.0, b_min=0.0, b_max=1.0, clip=True),\n",
" transforms.RandAffined(\n",
" keys=[\"image\"],\n",
" rotate_range=[(-np.pi / 36, np.pi / 36), (-np.pi / 36, np.pi / 36)],\n",
" translate_range=[(-1, 1), (-1, 1)],\n",
" scale_range=[(-0.05, 0.05), (-0.05, 0.05)],\n",
" spatial_size=[image_size, image_size],\n",
" padding_mode=\"zeros\",\n",
" prob=0.5,\n",
" ),\n",
" ]"
" transforms.LoadImaged(keys=[\"image\"]),\n",
" transforms.EnsureChannelFirstd(keys=[\"image\"]),\n",
" transforms.ScaleIntensityRanged(keys=[\"image\"], a_min=0.0, a_max=255.0, b_min=0.0, b_max=1.0, clip=True),\n",
" transforms.RandAffined(\n",
" keys=[\"image\"],\n",
" rotate_range=[(-np.pi / 36, np.pi / 36), (-np.pi / 36, np.pi / 36)],\n",
" translate_range=[(-1, 1), (-1, 1)],\n",
" scale_range=[(-0.05, 0.05), (-0.05, 0.05)],\n",
" spatial_size=[image_size, image_size],\n",
" padding_mode=\"zeros\",\n",
" prob=0.5,\n",
" ),\n",
"]"
]
},
{
Expand Down Expand Up @@ -552,10 +551,12 @@
" epoch_disc_loss_list.append(disc_epoch_loss / len(train_loader))\n",
"\n",
" if epoch % print_every == 0:\n",
" msgs = [f\"epoch {epoch:d}/{max_epochs:d}:\",\n",
" f\"recons loss: {epoch_recon_loss_list[-1]:4f},\"\n",
" f\"gen_loss: {epoch_gen_loss_list[-1]:4f},\"\n",
" f\"disc_loss: {epoch_disc_loss_list[-1]:4f}\"]\n",
" msgs = [\n",
" f\"epoch {epoch:d}/{max_epochs:d}:\",\n",
" f\"recons loss: {epoch_recon_loss_list[-1]:4f},\"\n",
" f\"gen_loss: {epoch_gen_loss_list[-1]:4f},\"\n",
" f\"disc_loss: {epoch_disc_loss_list[-1]:4f}\",\n",
" ]\n",
" print(\"\".join(msgs))\n",
"\n",
" if (epoch + 1) % val_interval == 0:\n",
Expand Down
20 changes: 10 additions & 10 deletions generation/3d_autoencoderkl/3d_autoencoderkl_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,16 @@
"outputs": [],
"source": [
"all_transforms = [\n",
" transforms.LoadImaged(keys=[\"image\"]),\n",
" transforms.EnsureChannelFirstd(keys=[\"image\"]),\n",
" transforms.Lambdad(keys=\"image\", func=lambda x: x[channel, :, :, :]),\n",
" transforms.EnsureChannelFirstd(keys=[\"image\"], channel_dim=\"no_channel\"),\n",
" transforms.EnsureTyped(keys=[\"image\"]),\n",
" transforms.Orientationd(keys=[\"image\"], axcodes=\"RAS\"),\n",
" transforms.Spacingd(keys=[\"image\"], pixdim=(2.4, 2.4, 2.2), mode=(\"bilinear\")),\n",
" transforms.CenterSpatialCropd(keys=[\"image\"], roi_size=(96, 96, 64)),\n",
" transforms.ScaleIntensityRangePercentilesd(keys=\"image\", lower=0, upper=99.5, b_min=0, b_max=1),\n",
" ]"
" transforms.LoadImaged(keys=[\"image\"]),\n",
" transforms.EnsureChannelFirstd(keys=[\"image\"]),\n",
" transforms.Lambdad(keys=\"image\", func=lambda x: x[channel, :, :, :]),\n",
" transforms.EnsureChannelFirstd(keys=[\"image\"], channel_dim=\"no_channel\"),\n",
" transforms.EnsureTyped(keys=[\"image\"]),\n",
" transforms.Orientationd(keys=[\"image\"], axcodes=\"RAS\"),\n",
" transforms.Spacingd(keys=[\"image\"], pixdim=(2.4, 2.4, 2.2), mode=(\"bilinear\")),\n",
" transforms.CenterSpatialCropd(keys=[\"image\"], roi_size=(96, 96, 64)),\n",
" transforms.ScaleIntensityRangePercentilesd(keys=\"image\", lower=0, upper=99.5, b_min=0, b_max=1),\n",
"]"
]
},
{
Expand Down

0 comments on commit 8eec20d

Please sign in to comment.