You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, MONAI’s FocalLoss accepts alpha as a single scalar to balance background vs. foreground. This prevents specifying different weights for each class in multi-class segmentation, which is problematic for highly imbalanced datasets.
I would like FocalLoss to support alpha as a tensor or list of floats, allowing a separate weight for each class (e.g., [0.1, 0.3, 0.6] for a 3-class problem). Allowing per-class alpha directly would provide more precise control and better alignment with the original focal loss formulation.
Activity
aymuos15 commentedon Nov 3, 2025
I would be interested in approaching this if it's open to implementation
avithal commentedon Dec 16, 2025
if none takes it i can do it
Weights in alpha for FocalLoss (Project-MONAI#8665)
Weights in alpha for FocalLoss (Project-MONAI#8665)
Weights in alpha for FocalLoss (Project-MONAI#8665)
Weights in alpha for FocalLoss (Project-MONAI#8665)