Skip to content

Fix differentiability of generalized Dice loss#3619

Merged
wyli merged 4 commits into
Project-MONAI:devfrom
josafatburmeister:3618-differentiable-generalized-dice-loss
Jan 24, 2022
Merged

Fix differentiability of generalized Dice loss#3619
wyli merged 4 commits into
Project-MONAI:devfrom
josafatburmeister:3618-differentiable-generalized-dice-loss

Conversation

@josafatburmeister

@josafatburmeister josafatburmeister commented Jan 9, 2022

Copy link
Copy Markdown
Contributor

Signed-off-by: Josafat-Mattias Burmeister josafat-mattias.burmeister@student.hpi.de

Fixes #3618.

Description

Replaces the weight clamp code in the forward method of the GeneralizedDiceLoss module with an equivalent differentiable version.

Status

Ready

I was not able to run the tests locally as some tests that do not seem to be related to my changes failed. Since the tests passed in the CI pipeline, I marked this PR as ready.

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.
  • Documentation updated, tested make html command in the docs/ folder.

Signed-off-by: Josafat-Mattias Burmeister <josafat-mattias.burmeister@student.hpi.de>
Signed-off-by: Josafat-Mattias Burmeister <josafat-mattias.burmeister@student.hpi.de>
Comment thread monai/losses/dice.py Outdated
josafatburmeister and others added 2 commits January 9, 2022 21:13
@wyli wyli enabled auto-merge (squash) January 24, 2022 11:55
@wyli

wyli commented Jan 24, 2022

Copy link
Copy Markdown
Contributor

/build

1 similar comment
@wyli

wyli commented Jan 24, 2022

Copy link
Copy Markdown
Contributor

/build

@wyli wyli merged commit 6bb97bf into Project-MONAI:dev Jan 24, 2022
wyli added a commit that referenced this pull request Feb 9, 2022
* fix differentiability of generalized Dice loss

Signed-off-by: Josafat-Mattias Burmeister <josafat-mattias.burmeister@student.hpi.de>

* fix weight clamping for the case that  is True

Signed-off-by: Josafat-Mattias Burmeister <josafat-mattias.burmeister@student.hpi.de>

* add test case for batch mode

Co-authored-by: Wenqi Li <wenqil@nvidia.com>
wyli added a commit that referenced this pull request Feb 9, 2022
* fix differentiability of generalized Dice loss

Signed-off-by: Josafat-Mattias Burmeister <josafat-mattias.burmeister@student.hpi.de>

* fix weight clamping for the case that  is True

Signed-off-by: Josafat-Mattias Burmeister <josafat-mattias.burmeister@student.hpi.de>

* add test case for batch mode

Co-authored-by: Wenqi Li <wenqil@nvidia.com>
wyli added a commit that referenced this pull request Feb 9, 2022
* fix differentiability of generalized Dice loss

Signed-off-by: Josafat-Mattias Burmeister <josafat-mattias.burmeister@student.hpi.de>

* fix weight clamping for the case that  is True

Signed-off-by: Josafat-Mattias Burmeister <josafat-mattias.burmeister@student.hpi.de>

* add test case for batch mode

Co-authored-by: Wenqi Li <wenqil@nvidia.com>
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.

GeneralizedDiceLoss is not differentiable

2 participants