EfficientDet: Scalable and Efficient Object Detection

파비야·2023년 5월 16일
1

논문리뷰

목록 보기
61/106

오늘 리뷰할 논문은 EfficientNet의 발전형이며 object detection에 사용되는 EfficientDet 논문이다.

아래 포스트를 먼저 보면 도움이 될 것이다.


Summary

논문의 목표는 넓은 스펙트럼의 resource constraint에서 higher accuracy와 better efficiency를 가진 scalable detection architecture을 만드는 것이다. 논문의 두 주요 과제는 efficient multi-scale feature fusion과 model scaling이다.

efficient multi-scale feature fusion의 경우, 기존 모델들은 FPN(feature pyramid network)의 여러 scale의 features를 합칠 때 단순히 sum했다. 그러나 서로 다른 input feature들이 다른 resolution에서 왔으므로 그들은 fused output feature에 불균등하게 기여한다. 이 문제를 해결하기 위해 논문은 weighted bi-directional feature pyramid network (BiFPN)를 제안한다. BiFPN은 learnable weights를 가지고 있어 서로 다른 input features의 중요도를 학습하고 top-down과 bottom-up multi-scale feature fusion을 적용한다.

model scaling의 경우 EfficientNet의 compound scaling method를 사용해 backbone, feature network, box/class prediction network 모두의 resolution/depth/width를 공동으로 scale up한다.

논문은 EfficientNet backbones와 BiFPN, compound scaling를 결합해 EfficientDet를 만든다. EfficientDet는 기존 object detectors보다 더 적은 FLOPs와 parameter를 사용하고 더 좋은 정확도를 보인다. EfficientDet-D7은 77M parameters와 410B FLOPs를 가지고 state-of-the-art 55.1 AP를 달성하며, 이는 previous best detector [45]보다 4 AP 높으면서 parameter가 2.7배 작고 FLOPs가 7.4배 적다.

이제 BiFPN에 대해 알아보자. Multi-scale feature fusion은 다양한 resolution에서의 features을 aggregate하는 것이다. Fig 2a는 전통적인 top-down FPN이다.

전통적인 FPN은 one-way information flow으로 인해 내재적인 제약이 있다. 이 문제를 해결하기 위해 PANet은 extra bottom-up path aggregation network를 추가한다. 이를 Cross-scale connections라고 부른다. NAS-FPN은 더 좋은 cross-scale feature network topology를 찾지만 너무 많은 GPU time을 필요로 하며 network도 이상하게 생겨서 해석하거나 수정하기 어렵다.

논문은 cross-scale connections에 몇 optimizations을 제안한다. 첫째로 하나의 input edge만 가진 nodes를 제거한다. node가 feature fusion 없이 하나의 input edge만 가진다면 여러 features를 합치는데 집중하는 feature network에 덜 기여할 것이기 때문이다. 이는 simplified bidirectional network를 만들 수 있게 한다. 둘째로 동일한 level에 있다면 original input에서 output node로 extra edge를 추가하여 많은 비용 없이도 더 많은 features를 합칠 수 있게 했다. 셋째로 하나의 top-down과 bottom-up path를 가진 PANet과 달리 각 bidirectional (top-down & bottom-up) path를 하나의 feature network layer로 취급해 같은 layer를 여러번 반복해 more high-level feature fusion을 가능하게 했다. 이 optimizations를 가진 새로운 feature network를 BiFPN이라고 명명했다.

다른 resolution에서의 features를 합칠 때 기존의 방법들은 그들을 같은 resolution으로 resize하여 합쳤다. 논문은 그들이 다른 resolution에서 왔기 때문에 output feature에 unequally contribute한다고 보았고 이를 해결하고자 각 input에 additional weight를 추가해 network가 각 input feature의 중요도를 학습할 수 있게 했다. 세 가지 weighted fusion approach를 고려한다.

  1. Unbounded fusion O=ΣiwiIiO = \Sigma_i w_i I_i

w는 scalar (per-feature)나 vector (per-channel)나 multi-dimensional tensor (per-pixel)가 될 수 있는 learnable weight이다. 이는 minimal computational cost로 comparable accuracy를 달성할 수 있지만 scalar weight이 unbounded이기 때문에 잠재적으로 training stability를 일으킬 수 있다. 따라서 각 weight의 값 범위를 bound하도록 weight normalization을 사용해야 한다.

  1. Softmax-based fusion O=ΣiewiΣjewjIiO = \Sigma_i {e^{w_i} \over \Sigma_j e^{w_j}} I_i

앞선 아이디어대로 각 weight에 softmax를 적용해서 0~1 범위의 값을 가지게 한다. 그러나 이후 나올 ablation study에 따르면 extra softmax가 GPU에 상당한 slowdown을 유발하므로 extra latency cost를 최소화하기 위해 fast fusion approach를 제안한다.

  1. Fast normalized fusion O=Σiwiϵ+ΣjwjIiO = \Sigma_i {w_i \over \epsilon + \Sigma_j w_j} I_i

각 w_i 이후 ReLU를 적용해 wi0w_i \ge 0가 보장되고 ϵ=0.0001\epsilon = 0.0001은 numerical instability를 피하기 위한 작은 값이다. 각 normalized weight의 값은 0~1 사이로 떨어지며 softmax 연산이 없어서 더 효율적이다.

final BiFPN은 bidirectional crossscale connections과 fast normalized fusion을 통합한다. 추가로 efficiency를 위해 feature fusion에 depthwise separable convolution [7, 37]를 사용했고 각 convolution 이후에 batch normalization과 activation을 추가했다.

이제 EfficientDet에 대해 알아보자. one-stage detectors paradigm을 따랐으며 ImageNet-pretrained EfficientNets를 backbone network로 사용했다. BiFPN은 feature network로 작동해 backbone network에서 level 3-7 features {P3, P4, P5, P6, P7}를 가져와 top-down과 bottom-up bidirectional feature fusion을 반복적으로 적용한다. fused features는 class와 box network에 먹여 object class와 bounding box prediction을 생성한다. class와 box network weights는 all levels of feature에 걸쳐(across) 공유된다.

resource 제한에 따라 scaling하기 위해 EfficientNet처럼 compound scaling method를 쓰지만 object detectors는 image classification model보다 더 많은 scaling dimension을 가지기 때문에 모든 dimensions에 대한 grid search는 expensive하므로 대신 heuristic-based scaling approach를 사용한다.

Backbone network의 경우 EfficientNet과 동일한 width/depth scaling coefficients를 사용한다. BiFPN의 경우 depth (#layers)는 linearly 증가, width (#channels)는 exponentially 증가했다. 몇 개 값들에 대해 grid search를 해서 다음 식과 같이 scaling factor를 정했다.

Box/class prediction network의 경우 width가 항상 BiFPN과 같도록 고정했고 depth는 다음 식과 같이 linearly 증가시켰다.

Input image resolution의 경우 BiFPN에서 feature level 3-7이 사용되기 때문에 input resolution이 27=1282^7 = 128로 나누어떨어져야 하므로 다음 식과 같이 resolution을 증가시켰다.

식 1, 2, 3을 따라 EfficientDet을 D0 (φ = 0)부터 D7 (φ = 7)까지 개발했으며 D7x는 D7과 같은 BiFPN과 head를 가지지만 D7의 resolution이 더 크고 D7x는 larger backbone network과 하나 더 많은 feature level (P3에서 P8)을 사용한다.

object detection 실험은 COCO 2017 detection datasets를 사용했다. 설명은 생략한다.

semantic segmentation 실험도 한다. 설명은 생략한다.

COCO validation set을 가지고 몇 가지 ablation study도 진행한다. 첫째로 Backbone과 BiFPN이 얼마나 accuracy와 efficiency에 기여하는지 disentangle해본 결과 둘 다 crucial함을 할 수 있었다. 둘째로 Fig 2의 여러 cross-scale connections를 사용해 비교했다. 셋째로 softmax와 fast normalized fusion을 비교했다. 넷째로 compound scaling을 다른 single dimension scaling과 비교했다. 자세한 설명은 생략한다.

Strengths

  1. 여러 resolution의 feature을 합쳐 사용하는 FPN의 특징을 유지하면서도 효율적인 fusion 방식과 cross-scale connections를 사용해 accuracy와 efficiency를 잘 조율했다.
  2. EfficientNet처럼 compound scaling을 통해 주어진 resource 내에서 모델 크기를 효율적으로 scale up할 수 있다.

EfficientDet이 YOLOv3보다 28배 적고 RetinaNet보다 30배 적은 FLOPs를 사용해 비슷한 accuracy를 얻는다는 점이 신기했다. YOLOv3도 유명한 모델인데 연산량이 월등히 작으니 괜히 모델 이름에 efficient가 붙는 게 아니구나 싶었다.

profile
학과최약체

0개의 댓글