This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 143
Adding mutually exclusive label check to load_labels_from_dataset_source #454
Merged
dumbledad
merged 3 commits into
main
from
timregan/339-mutually-exclusive-segmentation-labels
May 19, 2021
Merged
Adding mutually exclusive label check to load_labels_from_dataset_source #454
dumbledad
merged 3 commits into
main
from
timregan/339-mutually-exclusive-segmentation-labels
May 19, 2021
Conversation
This file contains 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
7e6f6aa
to
5f08f5d
Compare
ant0nsc
suggested changes
May 14, 2021
ce0c5b3
to
cf72125
Compare
ant0nsc
suggested changes
May 19, 2021
cf72125
to
3ba6955
Compare
ant0nsc
reviewed
May 19, 2021
ant0nsc
reviewed
May 19, 2021
ant0nsc
approved these changes
May 19, 2021
Shruthi42
approved these changes
May 19, 2021
# for free
to subscribe to this conversation on GitHub.
Already have an account?
#.
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.
Issue
Closes #339
Overview
We need to check that labels are mutually exclusive early, when the labels are loaded from the data source.
Details
load_labels_from_dataset_source
builds up the ground truth tensor from individual binary masks. It sets the background mask correctly, but does not check if each pixel is really only in 1 class. If that assumption is violated, model training may later fail when computing the FocalLoss, and when it fails later the error message does not explain the reason well. So we need to check that the labels are mutually exclusive early, when the labels are loaded from the data source.Some loss functions (e.g. SoftDice) may cope with overlapping labels so we provide a flag for users to turn off the check, but by default if the labels are not mutually exclusive we now throw a
ValueError
with a suitably explanatory message.Checklist
Run PyCharm's code cleanup tools on your Python files.(I'm using VS Code)Added/Changed/Removed/... in the "Upcoming" section.
and if needed a motivation why that change was required.