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 Nov 11, 2024
1 parent f0bb2e5 commit c748e24
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
# ---

# %% [markdown]
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#     http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#     http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# %% [markdown]
Expand All @@ -48,7 +48,7 @@
#

# %% [markdown]
# ## Setup environment
# ## Setup environment

# %%
# !python -c "import monai" || pip install -q "monai-weekly[tqdm]"
Expand Down Expand Up @@ -194,6 +194,7 @@
# The `embedding_dimension` parameter controls the dimension of the latent dimension learned by the semantic encoder.
#


# %% jupyter={"outputs_hidden": false}
class Diffusion_AE(torch.nn.Module):
def __init__(self, embedding_dimension=64):
Expand Down Expand Up @@ -407,7 +408,7 @@ def forward(self, xt, x_cond, t):
)

# %% [markdown]
# Although not perfectly, the manipulated slices do not present a tumour (unlike the middle - "reconstructed" - ones), because we tweaked the latents to move away from the abnormality cluster:
# Although not perfectly, the manipulated slices do not present a tumour (unlike the middle - "reconstructed" - ones), because we tweaked the latents to move away from the abnormality cluster:

# %%
nb = 8
Expand All @@ -421,7 +422,7 @@ def forward(self, xt, x_cond, t):
plt.figure(figsize=(15, 5))
plt.imshow(grid.detach().cpu().numpy()[0], cmap="gray")
plt.axis("off")
plt.title(f"Original (top), Reconstruction (middle), Manipulated (bottom) s = {s}");
plt.title(f"Original (top), Reconstruction (middle), Manipulated (bottom) s = {s}")

# %%
if directory is None:
Expand Down

0 comments on commit c748e24

Please sign in to comment.