Skip to content

Weights in alpha for FocalLoss #8601

Closed

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.

Activity

  1. aymuos15 commented on Nov 3, 2025

    @aymuos15
    Contributor

    I would be interested in approaching this if it's open to implementation

  2. avithal commented on Dec 16, 2025

    @avithal

    if none takes it i can do it

  3. added a commit that references this issue on Feb 22, 2026
    40df2f6
  4. added 2 commits that reference this issue on Feb 24, 2026
    522802f
    61dc02e
  5. added a commit that references this issue on May 25, 2026
    6f28dd9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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