BinaryPenaltyReducedFocalCrossEntropy
classkeras_cv.losses.BinaryPenaltyReducedFocalCrossEntropy(
alpha=2.0,
beta=4.0,
from_logits=False,
positive_threshold=0.99,
positive_weight=1.0,
negative_weight=1.0,
reduction="sum_over_batch_size",
name="binary_penalty_reduced_focal_cross_entropy",
)
Implements CenterNet modified Focal loss.
Compared with keras.losses.BinaryFocalCrossentropy
, this loss discounts
for negative labels that have value less than positive_threshold
, the
larger value the negative label is, the more discount to the final loss.
User can choose to divide the number of keypoints outside the loss
computation, or by passing in sample_weight
as 1.0/num_key_points.
Arguments
gamma
parameter in
keras.losses.BinaryFocalCrossentropy
.y_pred
is expected to be a logits tensor, defaults
to False
.Inputs: y_true: [batch_size, ...] float tensor y_pred: [batch_size, ...] float tensor with same shape as y_true.
References
alpha
and
beta
.