yamle.losses.segmentation module#
- class yamle.losses.segmentation.SoftIntersectionOverUnionLoss(factor=1.0, ignore_indices=[], **kwargs)[source]#
Bases:
BaseLossThis defines the soft intersection over union loss for semantic segmentation.
It assumes that the input shape is (batch_size, num_members, num_classes, height, width). No matter what the reduction it is always averaged over the num_members.
The input is assumed to be probabilities.
The loss can also be weighted by a weight tensor of shape (batch_size).
- Parameters:
- class yamle.losses.segmentation.FocalLoss(alpha=0.25, gamma=2.0, ignore_indices=[], *args, **kwargs)[source]#
Bases:
BaseLossThis defines the focal loss for semantic segmentation.
It assumes that the input shape is (batch_size, num_members, num_classes, height, width). No matter what the reduction it is always averaged over the num_members.
The input is assumed to be probabilities.
The loss can also be weighted by a weight tensor of shape (batch_size).
- Parameters: