目标检测|CornerNet 数据预处理ground truth heatmaps

简介

  • CornerNet 是最经典的Anchor-free方法,本博客主要介绍数据预处理中最核心步骤: ground truth heatmaps。

方法

  • 如上图所示, 有三种颜色的图形, 红色框代表ground truth, 绿色框的角点在橙色圆圈里面, gound truth heatmap就是通过高斯分布函数生成, 以ground thuth 的两个角点为中心,半径为 r r r, 利用高斯分布分数生成heatmap,其中,角点为positive, 其余地方为negative。具体公式如下:
    g u a s s i o n s ( x , y ) = e − x 2 + y 2 2 σ 2 guassions(x, y) = e^{-\frac{x^2+y^2}{2 \sigma^2}} guassions(x,y)=e2σ2x2+y2
    σ = 1 3 r \sigma = \frac{1}{3} r σ=31r
  • 半径r的确定比较复杂, 其中要确保两个小圆区域内所有角点的组合生成的框(绿色)和ground truth的iou要大于一个值(默认0.3) ,半径具体生成可以论文作者的issues.主要是利用解方程和极限情况求解。
  • 生成半径代码
def gaussian_radius(det_size, min_overlap=0.7):
  height, width = det_size

  a1  = 1
  b1  = (height + width)
  c1  = width * height * (1 - min_overlap) / (1 + min_overlap)
  sq1 = np.sqrt(b1 ** 2 - 4 * a1 * c1)
  r1  = (b1 + sq1) / 2

  a2  = 4
  b2  = 2 * (height + width)
  c2  = (1 - min_overlap) * width * height
  sq2 = np.sqrt(b2 ** 2 - 4 * a2 * c2)
  r2  = (b2 + sq2) / 2

  a3  = 4 * min_overlap
  b3  = -2 * min_overlap * (height + width)
  c3  = (min_overlap - 1) * width * height
  sq3 = np.sqrt(b3 ** 2 - 4 * a3 * c3)
  r3  = (b3 + sq3) / 2
  return min(r1, r2, r3)

你可能感兴趣的:(Object,detector,目标检测)