EfficientDet: Scalable and Efficient Object Detection === > 訓練模型時,準確度越高越好,但是在不同應用場景,也有不同的要求,常常需要在準確度與效率(模型inference速度)取得平衡。這邊文章主要介紹一個可以同時做到高效率及高準確度的模型,EfficientDet,顧名思義就是,Efficient net + Object Detetion。EfficientDet的重點有兩個,分別為1. BiFPN, 2. Compound scaling method。其中,EfficientDetD7在COCO測試資料集準確度有高達52.2AP,只用了326B FLOPS,參數量52M,效率及準確度都比其他model高。 >   ## FPN(Feature Pyramid Network) 這邊簡單介紹一下FPN,如果覺得太浪費時間可以直接跳過這一段。FPN是用來將features做結合的feature extractor,解決圖片資訊越來越少的問題。一張圖片經過多次的feature extraction,如果只是拿最後產生的feature map來做預測時,小物件會很難被預測出來。如下圖所示,FPN結合了bottom-up及top-down,bottom-up就是圖片左邊,convolutional network做feature extraction,top-down就是圖片右邊,將上一層的output與做完feature extraction做結合(因為做feature extraction前的資訊比較多,其實有點類似ResNet的residual的概念)  自從FPN被提出之後,相繼出現其他以FPN為基礎再做延伸的network,例如PANet、NAS-FPN。  ## BiFPN 由於FPN只有一個方向做feature fusion,所以像上面所提到的PANet,增加了bottom-up做更多的feature fusion,使high-level的feature保留更多low-level的訊息。後來Google提出NAS-FPN,希望藉助network,並學習更好的feature fusion架構,但是必須消耗更多計算資源來學習。這個章節主要介紹BiFPN如何優化feature fusion架構。 * ### Cross-Scale Connections 1. 刪除節點,減少參數量: 只有一個input並沒有做任何feature fusion的節點就將它移除,因為它對整體影響較小,這樣就可以簡化整個架構。  2. 如果input node與output node同一層,我們會在input node與output node之間做連結,增加feature fusion而且不會消耗更多計算。  3. 與PANet差異在於,PANet的top-down、bottom-up只做一次,而BiFPN做多次的feature fusion。 * ### Weighted Feature Fusion 文章中認為,不同input features的解析度不同,不同scale的feature對output有很大的影響 所以認為BiFPN中的feature fusion要有不同的weight, 而weight是network自己學習得到。所以有三種計算weight方法: **Unbounded fusion:** \begin{gather*}O = \sum_{i}w_i*I_i\displaystyle \end{gather*} **Softmax-based fusion:**\begin{gather*}O = \sum_{i}\dfrac{e^{w_i}}{\sum_{j}e^{w_j}}*I_i\displaystyle \end{gather*} **Fast normalized fusion:**\begin{gather*}O = \sum_{i}\dfrac{w_i}{\epsilon+\sum_{j}w_j}*I_i\displaystyle \end{gather*} 因為Unbounded fusion在計算時,weight沒有normolize,Softmax-based fusion要做exponential 所以較花計算時間,所以BiFPN是採用Fast normalized fusion。 ## EfficientDet 接下來要介紹的是EfficientNet + BiFPN的EfficientDet,以下是架構圖:  EfficientDet是採用one stage(one stage就是物件位置偵測和物件辨識同時進行,也就是一個神經網路能同時偵測物件位置也可以辨識物件,如同Google在2015年12月提出Single Shot Detector (SSD),Google在文章摘要第一句話就寫「We present a method for detecting objects in images using a single deep neural network.」,一個深度神經網路就可以做完所有的物件偵測。),將3~7層的features做BiFPN,然後在當作class network及box network的input,再產生object class及location。 * ## Compound Scaling 深度學習模型的複雜度與最終準確率有著密切的關係。一般來說,增加模型的複雜度(scale up),我們採用的方式不外乎增加模型深度(ResNet)、寬度(GoogLeNet)、或圖像輸入的尺寸,大部份會採取其中1~2種方法作為擴展模型的手段,但是,最終擴展的模型經常會過於複雜造成overfitting而使得其訓練成果無法達到理想的結果,因此,如何在這三種方法之中取捨,成了最大的難題。 常用擴大模型的方法: 1.模型橫向的擴展(width) 2.模型深度的擴展(depth) 3.圖片尺寸的擴增(resolution) 4.選取width, depth, resolution不同的組合,稱為compound scaling 不同的方法會導致不同程度的accuracy提升,因此,若能找到一個最佳的組合,透過不同比例方法搭配來擴展(此方法稱為compound scaling),便能得到比起單一scaling效率更好的模型。如下圖所示,以不同比例width, depth以及resolution搭配組合的compound scaling方法比起單一scaling方法更佳。  \begin{gather*}W_{bifpn}(BiFPN width) = 64 * (1.35^\phi) \displaystyle \end{gather*} \begin{gather*}D_{bifpn}(BiFPN depth) = 3 + \phi \displaystyle \end{gather*} \begin{gather*}D_{box}=D_{class} = 3 + [\phi / 3]\displaystyle \end{gather*} \begin{gather*}D_{box}=R_{input} = 512 + \phi * 128 \displaystyle \end{gather*}   ## Experiments 如下圖所示,EfficientDet與其他物件辨識方法做比較,EfficientDet-D0準確度與YOLOv3差不多,但是計算量卻比較少,FLOPs差了28倍。EfficientDet-D1準確度比RetinaNet-R101高,但是計算量卻比較少,FLOPs差了21倍。由實驗結果證明EfficientDet的效果確實比較好。  ## 參考文獻 [https://arxiv.org/pdf/1911.09070.pdf](https://) [https://medium.com/@jonathan_hui/understanding-feature-pyramid-networks-for-object-detection-fpn-45b227b9106c](https://) [https://chtseng.wordpress.com/2020/05/23/efficientdet%E9%AB%98%E6%95%88%E7%8E%87%E7%9A%84%E7%89%A9%E4%BB%B6%E5%81%B5%E6%B8%AC%E6%A8%A1%E5%9E%8B/](https://) [https://zhuanlan.zhihu.com/p/93346058](https://) ###### tags: `ML`
×
Sign in
Email
Password
Forgot password
or
Sign in via Google
Sign in via Facebook
Sign in via X(Twitter)
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
Continue with a different method
New to HackMD?
Sign up
By signing in, you agree to our
terms of service
.