Skip to content
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

Addition of SPADE Network + tests and modification of SPADE normalisation #7775

Merged
merged 11 commits into from
Jun 3, 2024

Conversation

virginiafdez
Copy link
Contributor

  • spade_network, and SPADENet (VAE-GAN)
  • test_spade_vaegan (to test previously mentioned model) Modification of:
  • spade_diffusion_model_unet.py to change namings.
  • SPADE normalisation layer, to use get_norm_layer function instead of defining such layers directly.

Fixes # .

Description

A few sentences describing the changes proposed in this pull request.

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • [] Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.

virginiafdez added 4 commits May 16, 2024 10:34
- spade_network, and SPADENet (VAE-GAN)
- test_spade_vaegan (to test previously mentioned model)
Modification of:
- spade_diffusion_model_unet.py to change namings.
- SPADE normalisation layer, to use get_norm_layer function instead of defining such layers directly.
… before, an argument, but it wasn't being used, set instead to LeakyRelu. Now, activation is a parameter that is passed. It can't be None.

In addition, removal of the KLD loss object. Instead, if network is VAE, it outputs the mu and log variance in the forward so that the KLD can be calculated externally.
@ericspod ericspod requested a review from marksgraham May 17, 2024 12:32
@ericspod
Copy link
Member

The quick tests are failing for some weird issue with Matplotlib that may go away if they're rerun anyway, it isn't related to this PR. The DCO can be fixed as well by following the remediation instructions.

@marksgraham
Copy link
Contributor

This is the final piece of #7227

The need for the addition of the spade network here is my fault - I missed it out in the initial port, and @virginiafdez spotted it.

The matplotlib errors have been popping up on other PRs too, recently.

Will do a review in a moment. I can help with the mypy errors too

marksgraham and others added 4 commits May 17, 2024 14:42
Signed-off-by: Mark Graham <[email protected]>
Signed-off-by: Mark Graham <[email protected]>
I, virginiafdez <[email protected]>, hereby add my Signed-off-by to this commit: 5e3a3aa
I, virginiafdez <[email protected]>, hereby add my Signed-off-by to this commit: a4547fa
I, virginiafdez <[email protected]>, hereby add my Signed-off-by to this commit: c5834de
I, virginiafdez <[email protected]>, hereby add my Signed-off-by to this commit: 0261386

Signed-off-by: virginiafdez <[email protected]>
Copy link
Contributor

@marksgraham marksgraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

Copy link
Contributor

@KumoLiu KumoLiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, overall looks good to me.
Minor comments inline.

monai/networks/nets/spade_network.py Outdated Show resolved Hide resolved
monai/networks/nets/spade_network.py Show resolved Hide resolved
monai/networks/nets/spade_network.py Outdated Show resolved Hide resolved
tests/test_spade_vaegan.py Outdated Show resolved Hide resolved
tests/test_spade_vaegan.py Outdated Show resolved Hide resolved
monai/networks/nets/spade_network.py Show resolved Hide resolved
tests/test_spade_vaegan.py Outdated Show resolved Hide resolved
@KumoLiu KumoLiu requested a review from ericspod May 22, 2024 09:23
@dzenanz
Copy link
Contributor

dzenanz commented May 27, 2024

Perhaps rename this PR to SPADENet or SPADENet (VAE-GAN)? The current name, Addition of:, is quite non-descriptive.

@virginiafdez virginiafdez changed the title Addition of: Addition of SPADE Network + tests and modification of SPADE normalisation May 27, 2024
…e informative errors when z_dim is None and network is not GAN, addition of docstrings in forward method and __all__.

- Modification of flag is_gan in the Decoder, to change it to opposite flag is_vae, to make it match with the flag of the SPADE network.
- Modification of functionality on NOT is_vae mode. Initially, a random Gaussian noise vector was drawn and passed to an input Linear layer. Nonetheless, the original SPADE code starts from an interpolated version of the semantic map (deterministically) and passes it to a conv layer. self.fc is changed to a Conv layer when is_vae is False. Because mypy does not allow for self.fc to be Linear or Convolution under different attribute values, self.fc > self.conv_init when is_vae is False.
- Modification of tests to incorporate suggestions: name of the tests were unsuitable, there were missing scenarios for when is_vae = False.

Signed-off-by: virginiafdez <[email protected]>
monai/networks/nets/spade_network.py Outdated Show resolved Hide resolved
tests/test_spade_vaegan.py Show resolved Hide resolved
@KumoLiu
Copy link
Contributor

KumoLiu commented May 31, 2024

/build

@KumoLiu
Copy link
Contributor

KumoLiu commented Jun 3, 2024

/build

1 similar comment
@KumoLiu
Copy link
Contributor

KumoLiu commented Jun 3, 2024

/build

@KumoLiu KumoLiu merged commit 36511cc into Project-MONAI:gen-ai-dev Jun 3, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants