Focal_loss 实现
发布时间
阅读量:
阅读量
TensorFlow 1.13版本特性
def focal_loss(logits,onehot_labels, gamma=2.0, alpha=4.0):
"""
focal loss for multi-classification
FL(p_t)=-alpha(1-p_t)^{gamma}ln(p_t)
Notice: logits is probability after softmax
gradient is d(Fl)/d(p_t) not d(Fl)/d(x) as described in paper
d(Fl)/d(p_t) * [p_t(1-p_t)] = d(Fl)/d(x)
Lin, T.-Y., Goyal, P., Girshick, R., He, K., & Dollár, P. (2017).
Focal Loss for Dense Object Detection, 130(4), 485–491.
https://doi.org/10.1016/j.ajodo.2005.02.022
:param labels: g
全部评论 (0)
还没有任何评论哟~
