Skip to content

Commit 912235e

Browse files
committed
fix AttributeError: 'AsymmetricUnifiedFocalLoss' object has no attribute 'include_background'.
Signed-off-by: ytl0623 <[email protected]>
1 parent c3c2570 commit 912235e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

monai/losses/unified_focal_loss.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ def __init__(
208208
self.gamma = gamma
209209
self.delta = delta
210210
self.weight: float = weight
211+
self.include_background: bool = include_background
212+
self.use_softmax = use_softmax
211213
self.asy_focal_loss = AsymmetricFocalLoss(
212214
to_onehot_y=self.to_onehot_y,
213215
gamma=self.gamma,
@@ -222,8 +224,6 @@ def __init__(
222224
include_background=self.include_background,
223225
reduction=LossReduction.NONE,
224226
)
225-
self.include_background: bool = include_background
226-
self.use_softmax = use_softmax
227227

228228
# TODO: Implement this function to support multiple classes segmentation
229229
def forward(self, y_pred: torch.Tensor, y_true: torch.Tensor) -> torch.Tensor:

0 commit comments

Comments
 (0)