目標檢測|CornerNet 數據預處理ground truth heatmaps

簡介

  • CornerNet 是最經典的Anchor-free方法,本博客主要介紹數據預處理中最核心步驟: ground truth heatmaps。

方法

在這裏插入圖片描述

  • 如上圖所示, 有三種顏色的圖形, 紅色框代表ground truth, 綠色框的角點在橙色圓圈裏面, gound truth heatmap就是通過高斯分佈函數生成, 以ground thuth 的兩個角點爲中心,半徑爲rr, 利用高斯分佈分數生成heatmap,其中,角點爲positive, 其餘地方爲negative。具體公式如下:
    guassions(x,y)=ex2+y22σ2 guassions(x, y) = e^{-\frac{x^2+y^2}{2 \sigma^2}}
    σ=13r\sigma = \frac{1}{3} r
  • 半徑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)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章