Skip to content

Hi @benolmbrt, thanks for your reporting. #8098

@RY-97

Description

@RY-97
          Hi @benolmbrt, thanks for your reporting.

The behavior you're seeing with the DiceMetric is likely due to a misunderstanding of the ignore_empty parameter's functionality.
When the ignore_empty option is set to True, it's supposed to set a NaN value for cases where the ground truth is empty. However, this does not mean that a NaN will be returned for such classes when computing the metric. Instead, these cases are ignored during the calculation process.Thus, even if some classes are ignored (due to being absent in the ground truth when ignore_empty=True), the metric computation does not return NaN for these classes. Instead, it computes the metric over the non-ignored classes only.
If the DiceMetric were to return a NaN for an ignored class, this would also affect the computed average Dice score (since any mathematical operation with NaN results in NaN), rendering the metric not well-defined for batches that include at least one empty class in the ground truth.

I hope this helps and let me know if you have any other questions!
Thanks.

Originally posted by @KumoLiu in #7504 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions