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

Add Hausdorff loss #6994

Merged
merged 9 commits into from
Sep 19, 2023
Merged

Add Hausdorff loss #6994

merged 9 commits into from
Sep 19, 2023

Conversation

imadtoubal
Copy link
Contributor

@imadtoubal imadtoubal commented Sep 17, 2023

Integrating an existing implementation publicly available on GitHub by Patryk Rygiel into the MONAI framework.

Fixes #6993.
Fixes #3481
Fixes #1039

Description

Hausdorff distance is widely used in evaluating medical image segmentation methods. Adding an objective/loss function directly to optimize this distance can be instrumental in optimizing this score [1].

Hausdorff Distance

An existing implementation is publicly available on GitHub by Patryk Rygiel, although it might take some engineering work to integrate within the MONAI framework.

I was able to train a 3D segmentation model successfully using MONAI's SwinUNETR with this implementation and I would like to contribute the code for this loss so that it's more widely available and easier to integrate with MONAI-based repositories.

References:
[1] Karimi, D., & Salcudean, S. E. (2019). Reducing the Hausdorff distance in medical image segmentation with convolutional neural networks. IEEE Transactions on medical imaging, 39(2), 499-513.

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.

Integrating an existing implementation publicly available on GitHub
by Patryk Rygiel into the MONAI framework.

Signed-off-by: Imad Toubal <imad.toubal@gmail.com>
Copy link
Member

@wyli wyli left a comment

Choose a reason for hiding this comment

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

thanks!

tests/test_hausdorff_loss.py Outdated Show resolved Hide resolved
tests/test_hausdorff_loss.py Show resolved Hide resolved
imadtoubal and others added 7 commits September 18, 2023 15:01
Signed-off-by: Imad Toubal <imad.toubal@gmail.com>
Add a `skipUnless` decorator to skip the
monai.utils.module.OptionalImportError: `from scipy.ndimage.morphology
import distance_transform_edt`

Signed-off-by: Imad Toubal <imad.toubal@gmail.com>
Signed-off-by: Imad Toubal <imad.toubal@gmail.com>
Signed-off-by: Imad Toubal <imad.toubal@gmail.com>
Signed-off-by: Imad Toubal <imad.toubal@gmail.com>
Signed-off-by: Imad Toubal <imad.toubal@gmail.com>
Co-authored-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
Signed-off-by: Wenqi Li <831580+wyli@users.noreply.github.com>
@wyli
Copy link
Member

wyli commented Sep 19, 2023

/build

@wyli wyli enabled auto-merge (squash) September 19, 2023 07:06
Copy link
Member

@wyli wyli left a comment

Choose a reason for hiding this comment

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

Thanks, it looks good to me, merging if all tests work fine.

@wyli wyli merged commit e5f9337 into Project-MONAI:dev Sep 19, 2023
30 of 35 checks passed
@imadtoubal imadtoubal deleted the 6993-hausdorff-loss branch September 19, 2023 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants