当前位置:网站首页>Principle and implementation of focal loss

Principle and implementation of focal loss

2022-07-28 02:07:00 Falling gold

Catalog

principle

Without weight focal loss

  With weight focal loss


principle

No hurry, no change

Without weight focal loss

Simple implementation based on cross entropy , Look at this first when learning

def focal_loss(logits, labels, gamma=5, reduction="mean"):
    #  After testing ,reduction  Add it or not, the result is the same , But for insurance , Or add 
    ce_loss = F.cross_entropy(logits, labels, reduction="none") #  Cross entropy 
    log_pt 
原网站

版权声明
本文为[Falling gold]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/209/202207280023085223.html