CVPR2019 | Libra R-CNN 论文解读

对应了三个问题:

  •  采样的候选区域是否具有代表性?
  • 提取出的不同level的特征是怎么才能真正地充分利用?
  • 目前设计的损失函数能不能引导目标检测器更好地收敛?

    对应的三个改进

  • IoU-balanced Sampling
  • Balanced Feature Pyramid
  • Balanced L1 Loss
  • CVPR2019 | Libra R-CNN 论文解读_第1张图片

 

Balanced L1 Loss:

梯度:

CVPR2019 | Libra R-CNN 论文解读_第2张图片

代码实现:

def balanced_l1_loss(pred,
                     target,
                     beta=1.0,
                     alpha=0.5,
                     gamma=1.5,
                     reduction='mean'):
    assert beta > 0
    assert pred.size() == target.size() and target.numel() > 0

    diff = torch.abs(pred - target)
    b = np.e**(gamma / alpha) - 1
    loss = torch.where(
        diff < beta, alpha / b *
        (b * diff + 1) * torch.log(b * diff / beta + 1) - alpha * diff,
        gamma * diff + gamma / b - alpha * beta)

    return loss

和smoothL1 loss对比:

def smooth_l1_loss(pred, target, beta=1.0):
    assert beta > 0
    assert pred.size() == target.size() and target.numel() > 0
    diff = torch.abs(pred - target)
    loss = torch.where(diff < beta, 0.5 * diff * diff / beta,
                       diff - 0.5 * beta)
    return loss

 

你可能感兴趣的:(目标检测,目标检测文章)