Skip to content

Commit 7f5f74e

Browse files
authored
Fix typo in dice docs (#1181)
1 parent 84ef60c commit 7f5f74e

File tree

1 file changed

+2
-2
lines changed
  • segmentation_models_pytorch/losses

1 file changed

+2
-2
lines changed

segmentation_models_pytorch/losses/dice.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ def forward(self, y_pred: torch.Tensor, y_true: torch.Tensor) -> torch.Tensor:
115115
else:
116116
loss = 1.0 - scores
117117

118-
# Dice loss is undefined for non-empty classes
119-
# So we zero contribution of channel that does not have true pixels
118+
# Dice loss is undefined for empty images with no classes
119+
# So we set the contribution of any channel without true pixels to zero
120120
# NOTE: A better workaround would be to use loss term `mean(y_pred)`
121121
# for this case, however it will be a modified jaccard loss
122122

0 commit comments

Comments
 (0)