diff --git a/generation/2d_autoencoderkl/2d_autoencoderkl_tutorial.ipynb b/generation/2d_autoencoderkl/2d_autoencoderkl_tutorial.ipynb index ea9eb217d..cf47a232a 100644 --- a/generation/2d_autoencoderkl/2d_autoencoderkl_tutorial.ipynb +++ b/generation/2d_autoencoderkl/2d_autoencoderkl_tutorial.ipynb @@ -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", + "]" ] }, { @@ -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", diff --git a/generation/3d_autoencoderkl/3d_autoencoderkl_tutorial.ipynb b/generation/3d_autoencoderkl/3d_autoencoderkl_tutorial.ipynb index 316d2a7d6..0187bb9df 100644 --- a/generation/3d_autoencoderkl/3d_autoencoderkl_tutorial.ipynb +++ b/generation/3d_autoencoderkl/3d_autoencoderkl_tutorial.ipynb @@ -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", + "]" ] }, {