Skip to content

Dice helper enhancement #6171

@wyli

Description

@wyli

One small comment here

if denorm <= 0:
return torch.tensor(1.0, device=y_o.device)
return (2.0 * torch.sum(torch.masked_select(y, y_pred))) / denorm

if we reach the last "return" statement, it seems to be guaranteed to be 0, so we don't need to calculate it

Originally posted by @myron in #6163 (comment)

docstring example could be improved as well to use either sigmoid or softmax

score, not_nans = DiceHelper(include_background=False, sigmoid=True, softmax=True)(y_pred, y)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions