Advertisement

Focal loss用于目标检测任务中结合ResNet模型进行特征金字塔构建

阅读量:

SOTA:state of the art

即在某一具体任务中当前表现最优的算法或模型

在获取模型之后,需通过设定损失函数来评估其在样本数据上的表现水平

交叉熵损失函数应用

Focal Loss在目标检测中的应用

复制代码
 import torch

    
 from torch.nn import functional as F
    
  
    
 def sigmoid_focal_loss(
    
     inputs:torch.Tensor,
    
     targets:torch.Tensor,
    
     alpha:float=-1,
    
     gamma:float=2,#调节因子的指数
    
     reduction:str='none',#默认为none,传入mean的话outputs会被求平均

全部评论 (0)

还没有任何评论哟~