sigmoid_focal_loss¶
dragon.losses.
sigmoid_focal_loss
(
inputs,
axis=- 1,
alpha=0.25,
gamma=2.0,
start_index=0,
reduction='valid',
**kwargs
)[source]¶Compute the focal loss of sigmoid cross entropy. [Lin et.al, 2017].
Examples:
x = dragon.constant([[0.5, 0.5], [0.3, 0.7]]) y = dragon.constant([1, 0]) print(dragon.losses.sigmoid_focal_loss([x, y])) # 0.3472295
- Parameters:
- inputs (Sequence[dragon.Tensor]) – The tensor
input
andtarget
. - axis (int, optional, default=-1) – The reduction axis, can be negative.
- alpha (float, optional, default=0.25) – The scale factor to the positive classes.
- gamma (float, optional, default=2.0) – The exponential decay factor on the easy examples.
- start_index (int, optional, default=0) – The start value of target.
- reduction ({'none', 'sum', 'mean', 'valid'}, optional) – The reduction method.
- inputs (Sequence[dragon.Tensor]) – The tensor
- Returns:
dragon.Tensor – The output tensor.