前言:

這篇文章會稍微介紹一下FoveaBox,然後跟FCOS做個比較,同樣都是Anchor box Free 的方法,兩篇文章的大致方向我覺得是類似的,只是操作的細節不一樣。所以這篇文章會邊寫FoveaBox,穿插著比較FCOS(FCOS可以參看我之前的那個)。

Ready2C:FCOS 閱讀記錄?

zhuanlan.zhihu.com
圖標

網路結構

先說說網路結構:

ref:FoveaBox network architecture

根據文章的說法,他的FPN應該是接在ResNet101後面,然後從 C_7 進行upsamling,最後使用的是 C_3,dots , C_7 生成 P_3,dots, P_7 。對比FCOS可以發現,FCOS使用的是ResNet50,也就是說,FCOS的 P_6, P_7 使用 P_5 downsampling生成的。

class+box subnets其實就是FCOS的Head,除了FCOS用來處理ambiguous sample的center-ness之外,他們並沒有什麼區別。

現在說說FoveaBox的一些細節:

補充一下:ground truth G=(x_1, y_1, x_2, y_2)

首先,對於每一個 P_l , where space l in [3,dots 7] ,計算一個文中說的basic area S_l ,其公式也很簡單,就是 S_{l}=4^{l} cdot S_{0} space 	ext{where } S_0 =16  ,因此,落在 P_l 的bounding box 的大小就落在 left[frac{S_{l}}{eta^{2}}, S_{l} cdot eta^{2}
ight] 的範圍內。Map的計算也很簡單:

egin{array}{l}{x_{1}^{prime}=frac{x_{1}}{2^{l}}, quad y_{1}^{prime}=frac{y_{1}}{2^{l}}} \ {x_{2}^{prime}=frac{x_{2}}{2^{l}}, quad y_{2}^{prime}=frac{y_{2}}{2^{l}}} \ {c_{x}=x_{1}^{prime}+0.5left(x_{2}^{prime}-x_{1}^{prime}
ight)} \ {c_{y}=y_{1}+0.5left(y_{2}-y_{1}^{prime}
ight)}end{array}

接著就是計算FoveaBox說到的positive sample:

egin{array}{l}{R^{p o s}=left(x_{1}^{prime prime}, y_{1}^{prime prime}, x_{2}^{prime prime}, y_{2}^{prime prime}
ight)} \ {x_{1}^{prime prime}=c_{x}^{prime}-0.5left(x_{2}^{prime}-x_{1}^{prime}
ight) sigma_{1}} \ {y_{1}^{prime prime}=c_{y}^{prime}-0.5left(y_{2}^{prime}-y_{1}^{prime}
ight) sigma_{1}} \ {x_{2}^{prime prime}=c_{x}^{prime}+0.5left(x_{2}^{prime}-x_{1}^{prime}
ight) sigma_{1}} \ {y_{2}^{prime prime}=c_{y}+0.5left(y_{2}^{prime}-y_{1}^{prime}
ight) sigma_{1}}end{array}

公式裏的 sigma _1	ext{是positive sample的數值, } sigma_2 	ext{則是negative的},作者設置的分別是0.4和0.3。上面所說的這部分,是途中class subnet的部分,loss function是很常見的Focal loss。同樣的,FCOS用的也是這個。用一個原文的圖,可能看的比較清楚:

ref: FoveaBox object detector

接下來是bounding box regression的部分:

  • 與FCOS類似,把feature map的坐標map到input image: left(2^{l}(x+0.5)-x_{1}
ight)
  • 然後計算projected coordinate和 Gleft(2^{l}(x+0.5)-x_{1}
ight) / z 	ext { where } z=sqrt{S_{l}}
  • 最後算一個log: log left(2^{l}(x+0.5)-x_{1}
ight) / z

完整的四個坐標的計算如下:

egin{aligned} t_{x_{1}} &=log frac{2^{l}(x+0.5)-x_{1}}{z} \ t_{y_{1}} &=log frac{2^{l}(y+0.5)-y_{1}}{z} \ t_{x_{2}} &=log frac{x_{2}-2^{l}(x+0.5)}{z} \ t_{y_{2}} &=log frac{y_{2}-2^{l}(y+0.5)}{z} end{aligned}

Loss function 是L1 norm。對比一下FCOS,FCOS計算的點到bounding box四個邊的距離,然後用的IoU loss。

總結

兩個方法都是anchor box free,實驗結果好像差的不是特別多。基於網路結構和實現的話,個人更喜歡FoveaBox。

FCOS已經公開的代碼,基於maskrcnn-benchmark實現,代碼還是比較好懂的。FoveaBox可能還得等等。

tianzhi0549/FCOS?

github.com
圖標

References:

[1]K. He, X. Zhang, S. Ren, and J. Sun, 「Deep Residual Learning for Image Recognition,」 in 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016, pp. 770–778.

[2]T.-Y. Lin, P. Dollar, R. Girshick, K. He, B. Hariharan, and S. Belongie, 「Feature Pyramid Networks for Object Detection,」 in 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017, vol. 2017-Janua, pp. 936–944.

[3]T.-Y. Lin, P. Goyal, R. Girshick, K. He, and P. Dollar, 「Focal Loss for Dense Object Detection,」 in 2017 IEEE International Conference on Computer Vision (ICCV), 2017, vol. 20, pp. 2999–3007. [4]T. Kong, F. Sun, H. Liu, Y. Jiang, and J. Shi, 「FoveaBox: Beyond Anchor-based Object Detector,」 2019.
推薦閱讀:
相關文章