Skip to content

Weights in alpha for FocalLoss #8601

@szuhow

Description

@szuhow

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions