Add MONAI loss configuration classes - #914
Open
txmed82 wants to merge 6 commits into
Open
Conversation
Collaborator
|
Hey @txmed82, thanks for the PR! I will have a look at it tomorrow |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev #914 +/- ##
==========================================
+ Coverage 97.96% 98.00% +0.04%
==========================================
Files 216 217 +1
Lines 10728 10850 +122
Branches 1056 1060 +4
==========================================
+ Hits 10510 10634 +124
+ Misses 119 118 -1
+ Partials 99 98 -1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
thibaultdvx
self-requested a review
July 21, 2026 11:26
thibaultdvx
marked this pull request as ready for review
July 21, 2026 13:47
thibaultdvx
approved these changes
Jul 21, 2026
thibaultdvx
left a comment
Collaborator
There was a problem hiding this comment.
LGTM! Thanks for the great work :)
| FocalLossConfig(gamma=3, alpha=0.25, use_softmax=True), | ||
| ], | ||
| ) | ||
| def test_monai_loss_non_default_round_trip(config): |
Collaborator
There was a problem hiding this comment.
Could you add a docstring to explain why this test is necessary?
thibaultdvx
approved these changes
Jul 21, 2026
Comment on lines
+40
to
+43
| - family-names: Son | ||
| given-names: Colin | ||
| website: https://github.com/txmed82 | ||
| orcid: https://orcid.org/0000-0002-1782-0537 |
Collaborator
There was a problem hiding this comment.
Hey @txmed82, could you please make sure that this information is correct. Feel free to add your email or affiliation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #907
Summary
Why
Raw MONAI losses already work in ClinicaDL, but their constructor parameters are not preserved in model configuration JSON. These config classes make common segmentation-loss choices reproducible and reloadable.
Validation
pytest tests/unittests/losses -q— 78 passedpytest tests/unittests/models/test_factory.py tests/unittests/models/test_supervised.py tests/unittests/models/test_reconstruction.py tests/unittests/metrics/test_loss.py -q— 5 passedmake -C docs html— succeeded with 7 pre-existing warningspipwere rerun after installing it, and both passed