retinaface 训练

 

负样本loss加强:

  neg = conf_t == zeros
        conf_t[neg] = 0
        if conf_p.shape[0]>0:
            loss_c = F.cross_entropy(conf_p, targets_weighted, reduction='sum')
        else:
            loss_c=zeros
            # loss_c=loss_c.sum()
        conf = F.softmax(conf_pred, dim=-1)
        pre_scores = conf.squeeze(0)[:, :, 1][conf_t == zeros]

        loss_c_neg = self.bce_loss(pre_scores, conf_t[conf_t == zeros].float())

 

  # neg_idx = neg.unsqueeze(neg.dim()).expand_as(loc_data)
        # loc_p = loc_data[neg_idx].view(-1, 4)
        # loc_t = loc_t[neg_idx].view(-1, 4)
        # loss_l_neg= 0.001*F.smooth_l1_loss(loc_p, loc_t, reduction='sum')

想关注最新技术和知识,请关注我的公众号,最新资讯会在这里与大家及时分享。

retinaface 训练_第1张图片

你可能感兴趣的:(深度学习)