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.
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.