본문 바로가기

지식 저장소

Imbalance Problems in Object Detection : 객체 검출 분야의 불균형 문제 A Review(2)

해당 논문은 part1~part3까지 포스팅될 예정입니다.

2020/11/02 - [지식 저장소] - Imbalance Problems in Object Detection : 객체 검출 분야의 불균형 문제 A Review(1)

2020/11/03 - [지식 저장소] - Imbalance Problems in Object Detection : 객체 검출 분야의 불균형 문제 A Review(3)

5 Imbalance 2 : Scale Imbalance

이번 장에서는 두가지의 불균형을 다룬다. Object /Box-Level Scale 불균형 문제와 Feature 불균형의 문제를 다룬다.

Fig. 7 : Imbalance in scales of the objects in common datasets : the distributions of BB width(a), height(b), and area(c). Values are with respect to the normalized image(i.e. relative to the image). For readabilith, the y axes are in log-scale
Fig. 8 : An illustration and comparison of the solutions for scale imbalance. "Predict" refers to the prediction performed by a detection network. The layered boxes correspond to convolutional layers. (a) No scale balancing method is employed. (b) Prediction is performed from backbone features at different levels (i.e. scales) (e.g. Feature Pyramid Networks). (d) The input image is scaled first and then processed. Each I corresponds to an image pyramidal feature (e.g. Image Pyramids) (e) Image and feature pyramids are combined. Rather than applying backbones, light networks are used in order to extract features from smaller images.

5.1 Object/Box-Level Scale Imbalance

Definition Scale 불균형은 객체의 사이즈 또는 input BBox에 의해 나타난다. Figure 7은 COCO 데이터셋의 scale불균형을 나타내는 그래프이다. 감지를 위해 특수 설계된 Backbone일 지라도, 이 것만으로 BBox의 scale의 다양성을 처리하기에는 충분하지 않다.

Solutions Figure 8 을 기준으로 (a)는 backbone의 predict를 그대로 사용하므로 BBox scale을 무시한다. 이를 해결하기 위해 (b)~(e) 까지 제안되어 왔다. (b)부터 backbone feature의 계층별 predict를 사용, feature pyramid 방법(FPN), image pyramid 방법, 마지막으로, image pyramid와 feature pyramid의 융합이다.

5.1.1 Methods Predicting from the Feature Hierarchy of Backbone Features

이 방법(b)은 backbone network의 결과에 의존적이다. 다양한 level의 정보를 사용하면서, 작은 객체의 정보를 앞단에서 가져오며, 작은 객체에 대해 강해진다. 이는 1-stage 모델중 SSD에 사용되며, 각각의 다른 feature map을 통해 결과를 얻는다. 2-stage 모델에서는 영역의 scale을 얻은 후 해당 영역마다의 분류 결과를 얻는다. Multi scale CNN(MSCNN) 에서 사용되었다.

5.1.2 Methods Based on Feature Pyramids

Fig. 9 : Feature-Level imbalance is illustrated on the FPN architecture

방법(b)는 feature 계층의 low level과 high level의 feature를 통합하지 않고 서로 다른 level을 독립적으로 사용한다. 그러나 정보의 abstractness(추상)은 layer별로 전부 다르므로, 단일 레이어에서 직접 예측한 것은 신뢰할 수 없다.

이를 해결하고자 **Feature Pyramid Network (FPN)**이 제안 되었고, 서로다른 scale을 결합시켜 prediction을 추출한다. FPN은 균형있게 결합하기 위해 (b)방법인 low level feature 에서 high level feature로 top-down 형태로 진행한 뒤 feature들을 결합한다. (결합을 위해 1x1 conv를 사용)

이러한 방법은 중간,소형 크기의 객체를 검출하는데에 성능을 향상 시켰다. 이 방법은 인기를 얻고, shadow detection, instance segmentation, panoptic segmentation 분야에서도 사용되었다.

그러나, FPN은 Backbone Network에서 얻은 feature들이 직접적으로 연결되어 feature 불균형 문제가 있다.

5.1.3 Methods Based on Image Pyramids

방법(d)는 image자체를 multi-scale로 주어 image pyramid를 들어 사용한다. 이 방법은 딥러닝이전의 영상처리 방법에서도 사용되던 방법이다. 이 방법은 딥러닝에서는 많아지는 계산량과 메모리 비용으로 인해 잘 사용되진 않았다.

그러나 최근에, 이미지 피라미드를 딥러닝에서 메모리 비용을 완화시키는 방법이 제안되었다. 그 방법은 다양한 크기의 이미지를 사용하여 훈련하지만 Input Box에 대해서만 다중 scale을 사용하여 GPU 메모리 비용을 완화 했다고한다. 또 Image pyramid를 설명하며, Scale-specific 방법(b) 은 데이터의 중요한 부분이 손실되는 경우가 많고, Multi scale방법은 데이터의 다양성이 보존되어 scale 불균형이 증가한다고 적혀있다.

5.1.4 Methods Combining Image and Feature Pyramids

Image pyramid 방법(d)는 일반적으로 feature pyramid 방법(c)보다 메모리와 시간 비용이 더 비효율적이다. 그러나 Image pyramid방법(d)이 성능적인 면에서 더 나아보인다. 이러한 이유로 두가지의 장점들을 가져와 결합시킨 방법이 제안되었다. Efficient Featurized Image Pyramids 는 5개의 image scale을 사용하고 그 중 4개는 light-weight network로 원본 image는 backbone 모델로 input된다.

light-weight 모델은 4개의 연속적인 conv layer로 설계되어있다. 이 network에서 추출된 feature들은 크기에 따라 적절한 level에서 backbone 모델의 feature와 결합되어 attention modules 이후에 최종 output을 만들기 전에 forward fusion module을 통해 high-level과 융합된다.

다음은 GAN을 이용한 방법이다. 2-stage모델에서 super-resolution 기법을 이용하여 small object에 대한 feature를 고해상도로 변경하여 prediction을 추출하는 방법이다. 이 역시 객체간의 scale imbalance를 해결하는 방법으로 소개된다.

마지막으로는 Scale Aware Trident Networks 를 이용한 접근법이다. 이 방법은 Feature pyramid와 image pyramid에 기반을 두는데, downsample 과정에서 생성되는 feature map을 사용하지 않고 dilate(확장)된 convolution만을 사용한다. dilate(확장) convolution의 확장 rate 1~3까지 주어 각 scale-specific feature map에 전달한다. (FPN방식 이용) 각 branch가 특정한 scale에 특화되도록 Box의 크기에 따라 적절하게 제공하여, 객체의 크기별로 receptive field를 주는 방식이다.

5.2 Feature-level Imbalance

Fig.10 : High-level diagrams of the methods designed for feature-level imbalance. (a) Path Aggregation Network. FPN is augmented by an additional bottom-up pathway to facilitate a shortcut of the low-level features to the final pyramidal feature maps. Red arrows represent the shortcuts. (b) Libra FPN. FPN pyramidal features are integrated and refined to learn a residual feature map. We illustrate the process originating from P2 feature map. Remaining feature maps (P3-P5) follow the same operations. (c) Scale Transferrable Detection Network. Pyramidal features are learned via pooling, identity mapping and scale transfer layers depending on the layer size. (d) Parallel FPN. Feature maps with difference scales are followed by spatial pyramid pooling. These feature maps are fed into the multi-scale context aggregation (MSCA) module. We show the input and outputs of MSCA module for P3 by red arrows. (e) Deep Feature Pyramid Reconfiguration. A set of residual features are learned via global attention and local reconfiguration modules. We illustrate the process originating from P2 feature map. Remaining feature maps (P3-P5) follow the same operations. (f) Zoom Out-And-In Network. A zoomin phase based on deconvolution (shown with red arrows) is adopted before stacking the layers of zoom-out and zoom-in phases. The weighting between them is determined by map attention decision module. (g) Multi-Level FPN. Backbone features from two different levels are fed into Thinned U-Shape Module (TUM) recursively to generate a sequence of pyramidal features, which are finally combined into one by acale-wise feature aggregation module. (h) NAS-FPN. The layers between backbone features and pyramidal features are learned via Neural Architecture Search.

Definition Backbone의 완성은 low-level과 high-level의 feature들이 균형있게되어 일관적인 prediction을 추출하는 것이다.Backbone에는 low-level 계층부터 high-level계층까지 여러 layer가 있고, 그 layer들의 feature들이 끼치는 영향은 전부 다르다는 것이다.

Solutions FPN의 불균형을 해결하기 위해 top-down방식을 개선한 방법, 완전히 새로운 구조까지 여러 방법들이 제안된다. 해당 논문에서는 feature-level의 불균형을 완화시키기 위해 새로운 구조를 사용하는 것과 기존의 방법(피라미드나 백본feature이용)으로 두가지로 나누어 말한다.

5.2.1 Methods Using Pyramidal Features as a Basis

FPN을 그대로 이용하는 방법(a,b)중 PANet은 FPN에 두가지에 기여하였는데 그 내용은 다음과 같다.

  1. Bottom-up path augmentation 를 이용하여 짧은 단계를 가진 low-level의 featurer가 high-level에 도달할 수 있도록 pyramid기능을 확장한다. 이러한 방법은 초기 layer에 shortcut way가 생성되기 때문에 edge, instance parts 등 localization을 위한 정보가 증가한다고 한다.
  2. FPN과 PANet구조의 연결들이 모든 level, ROI pooling 을 혼합하여 만들어진 고정된 크기의 feature grid를 detector network에 전달할 수 있게 되었다. 이것을 Adaptive Feature Pooling 이라 한다.

그러나 PANet은 여전히 순차적인 경로를 통해 feature를 추출하므로, Libra FPN은 FPN계층의 모든 feature를 한번에 사용하여 Residual feature layer를 생성해 그것을 통해 학습하는 것을 목표로 한다. Residual feature layer는 두 단계로 처리한다.

  1. Integrate : 서로 다른 layer들의 모든 feature map의 크기를 rescaling 및 평균화를 하여 하나의 단일 맵으로 축소한다.
  2. Refine : 통한된 단일 맵은 conv layer 또는 non-local neural network를 통해 정제된다.

5.2.2 Methods Using Backbone Features as a Basis

이 방법(c~h)은 backbone feature에서 구조를 구축하고 다양한 'feature 통합 메커니즘'을 사용한다.

Scale-Transferrable Detection Network(STDN) 는 DenseNet 블록을 이용하여 backbone의 마지막 feature를 이용하여 pyramid를 생성한다. 하지만 해당 방법은 DenseNet 블록을 이용하여 통합하기 때문에 다른 backbone network를 사용하기 어렵다. 또, DenseNet 의 마지막 블록에서 low-level과 high-level feature의 균형을 조정하는 방법이 없으므로 좋은 방안이라고 보기 힘들다.

비슷한 방법으로 Parallel FPN 이 있다. 이 방법은 backbone의 마지막 layer만 사용하고, spatial pyramid pooling(SPP)을 활용하여 multiscale feature를 생성한다.

backbone의 마지막 layer만 사용하는 위 두 방법과는 달리 Deep Feature Pyramid Reconfiguration 은 여러 level의 layer를 결합하여 하나의 tensor처럼 사용한다. 그 다음 이 tensor를 통해 residual features를 얻는다. 이 residual features을 backbone이 학습하기 위해 두가지의 모듈이 사용된다.

  1. Global Attention Module : 서로 다른 feature map의 상호의존성을 학습하는 것을 목표로 한다.
  2. Local Configuration Module : global attention 이후의 feature를 backbone feature에 residual features가 더해져 output이 출력될 수 있도록 한다.

Zoom Out-and-In Network 또한 low-level과 high-level feature를 결합하는 방법이다. 이 방법에서는 deconvolution을 통해 feature map을 확대하는데, 확대된 feature map과, backbone에서 convolution을 통해 축소된 feature map을 각각 layer의 크기에 맞게 stacking한다. 이러한 방식 때문에 이름이 Zoom out Zoom in 인듯 하다. 하지만 이 방법 또한 Inception v2 기반으로 구축되어 다른 backbone에 적용하기 어렵다는 단점이 있다.

Multi-Level FPN 은 가장 low-level의 feature와 가장 high-level feature를 stacking 하여 재귀를 통해 pyramid 형태로 출력을 하며, 이 다양한 pyramidal feature들은 scale-wise 방식으로 하나의 feature pyramid를 생성한다. 이 방법은 thinned U-shape modules (TUM)이라는 방법이 적용되었는데, 이를 적용할때 마다, FPN의 불균형과 유사한 문제가 발생한다고 한다.

마지막 Neural Architecture Search FPN(NAS-FPN) 은 searching(검색)을 이용하여 backbone이 주는 feature중에 최고의 pyramidal feature의 구조를 찾는 것을 목표로 한다. 하지만 아직은 다른 definitions of search spaces가 NAS보다 좋은 성능을 보여주고 있어서, NAS로 FPN을 설계하려면 연구가 더 필요하다고 한다.

5.3 Comparative Summary

Feature pyramid, Image pyramid 또 그로 인해 발생하는 문제에 대한 해결 등 scale imbalance를 줄이면서 성능이 향상되어 왔다. scale imbalance 에서 시간과 성능을 trade-off 하는 방법 중 일반적인 방법으로 여러개의 lighter network를 이용한 multi scale의 이미지를 사용하는 것 이었다.

5.4 Open Issue

해당 글에서는 Open Issue에 대해 다루지 않으며, 논문에 제시된 Issue만 간단하게 언급하고 넘어간다.

5.4.1 Characteristics of Different Layers of Feature Hierarchies

Feature 계층의 서로 다른 layer가 가지는 특성을 분석하고 심도 깊은 솔루션을 제시해야 한다.

5.4.2 Image Pyramids in Deep Object Detectors

메모리 비용으로 인해 deep learning에서 이미지 피라미드를 이용하는 것이 어렵기 때문에 이를 해결하기 위한 솔루션이 필요하다.

6 Imbalance 3 : Spatial Imabalance

Definition 크기, 모양, 위치, 이미지, box, IOU 들은 공간 속성이다. 이러한 속성의 불균형은 훈련과 generalization의 성능에 영향을 끼친다. 예를 들어, 위치의 약간의 변화만으로도 localization loss가 급격하게 변경되어 적절한 loss function이 선택되지 못할 수 있다.

6.1 Imbalance in Regression Loss

Fig. 11: An illustration of imbalance in regression loss. Blue denotes the ground truth BB. There are three prediction boxes, marked with green, red and yellow colors. In the table on the right, L1 and L2 columns show the sum of L1 and L2 errors between the box corners of the associated prediction box and the ground-truth (blue) box. Note that the contribution of the yellow box to the L2 loss is more dominating than its effect on total L1 error. Also, the contribution of the green box is less for the L2 error

Definition 공간 불균형은 Regression loss와의 관련이 깊다. Figure 11 을 보면 Box들 이 그려졌을때, IOU에 대한 Loss를 계산하기 위해 L1과 L2를 사용하는 example을 보여주는데, L1이 L2보다 loss 변동폭이 적고 좀 더 balace한 오류를 보여준다.

Solutions Object detection 분야에서 regression loss는 2가지의 주요 주제로 진화해 왔는데, 첫번째는, L-norm-based(like L1,L2)함수와 IoU-based함수이다. 그에 대한 내용은 아래의 표와 같다.

Table 5 : A list of widely used loss functions for the BB regression task

해당 함수들의 수식과 자세한 내용은 논문을 직접 참조 하는 것이 좋겠다. 본 글에서는 생략.

6.2 IoU Distribution Imbalance

Fig. 12: The IoU distribution of the positive anchors for a converged RetinaNet with ResNet-50 on MS COCO before regression (a), and (b) the density of how the IoU values are affected by regression (IoUB: before regression, IoUA: after regression). For clarity, the density is plotted in log-scale. (c) A concise summary of how regression changes IoUs of anchors as a function of their starting IoUs (IoUB). Notice that while it is better not to regress the boxes in larger IoUs, regressor causes false positives more in lower IoUs

Definition IoU 분포 불균형은 box에 기울어진 IoU분포가 있을때 나타난다. (a)그림은 RetinaNet에서 anchor의 분포가 낮은 쪽으로 치우쳐져 있는 것을 확인할 수 있다. (b)그림은 anchor가 regression에게 받는 영향을 나타낸다. (c)그림은 (b)그림의 파란선과 빨간선을 기준으로 anchor의 비율을 나타낸다. 파란선을 기준으로는 0.5로 갈 수록 anchor의 수가 줄어드는 모습을, 빨간선을 기준으로는 False positive가 0.5-0.6 에서 5%밖에 차이안나는 것을 확인할 수 있다. 이것들로 하여금, input box의 IoU결과에 대한 regressor의 효과를 확인해야한다라고 한다.

Solutions Cascade R-CNN은 최초로 IoU imbalance를 해결하였는데, 단일 IoU threshold에 단일 detector가 최적일 수 있고, regressor가 임계값에 overfitting시킬 수 있다는 것을 주장했다.그들은 IoU 임계값을 0.5~0.7을 사용하여 세개의 detector를 훈련했다. detector는 box를 새로 샘플링하지 않고, 이전 단계의 box를 사용함으로써, IoU 분포를 거의 균등한 상태로 만드는 것에 성공했다.

Faster R-CNN 은 무작위로 생성된 positive input box를 사용하여 IoU 분포의 균형을 맞추었다.

이외에 jittering을 주는 방법, pRoI generater 등 IoU분포가 균일할 때 최상의 성능을 얻을 수 있다는 것을 확인했다.

6.3 Object Location Imbalance

Fig. 13 : Distribution of the centers of the objects in the common datasets over the normalized image.

Definition 현재 물체 감지기는 조밀하게 샘플링된 anchor를 사용하기 때문에 이미지 전체의 object의 분포가 중요하다. 대부분의 방법에서 각 부분들이 동알한 중요도를 가지기 때문이다. 그러나 현실의 이미지는 균일한 분포를 가지지 못하는 것이 일반적이다.

위 그림을 보면 dataset들의 객체 위치가 대부분 중앙에 몰려있음을 알 수 있다.

Solutions anchor는 이미지에 따라 다르기 때문에 fully convolutional classifier와 다른 방식을 사용한다. anchor 크기에 따라 균형있게 만들기 위해 변형가능한 convolution을 이용하여 anchor-guided feature adaption를 제안한다. 즉, anchor방식이 아닌 free anchor방법은 IoU>0.5는 postive로 보고 ground truth와 매칭되게 anchor를 학습한다. 이런 방식으로 모인 anchor집합중 ground truth와 가장 적함한 anchor를 선정하여 학습된다.

6.4 Comparative Summary

공간 불균형은 object detector 분야에서 상당한 개선을 해왔다. 일반적으로, Regression loss 및 IoU 분포 불균형을 해결하면, regressor branch에서 개선되는 반면 anchor의 bias를 제거하면 classification또한 성능이 향상된다는 것을 알 수 있었다.

6.5 Open Issues

해당 글에서는 Open Issue에 대해 다루지 않으며, 논문에 제시된 Issue만 간단하게 언급하고 넘어간다.

6.5.1 A Regression Loss with Many Aspects

최근 연구는 서로 다른 관점과 측면으로 regression loss들을 제안해왔다. 이러한 것들의 장점들을 결합할 수 있는 단일 regression loss function이 필요하다.

6.5.2 Analyzing the Loss Functions

outliers와 inliers가 regression loss에 미치는 영향을 분석하려면 loss function과 input에 대한 기울기를 분석하는 것이 유용하다. 다양한 연구들이 이루어지고 있고, AP loss의 경우는 전체에 따라 값이 달라지므로 단일 입력에대한 Loss를 알기 어렵다는 것이 있다. 그러므로, Loss function이 example들에게 패널티를 주는 방식을 알기위한 적절한 분석방법이 필요하다.

6.5.3 Designing Better Anchors

최적의 Anchor를 찾는 것은 관심받고 있지 못하다. 자연에 있는 물체의 위치와 크기 불균형을 해결해야 한다.

6.5.4 Relative Spatial Distribution Imbalance

output Box와 ground truth의 IoU 분포는 불균형이고, 이는 성능에 영향을 미친다.

6.5.5 Imbalance in Overlapping BBs

Bounding box의 동적인 특성 때문에 sampling하는 동안 input 이미지에 대해 over sampling이나 under sampling이 될 수 있고, 그로 인한 불균형의 영향을 조사되지 않고 있다.

6.5.6 Analysis of the Orientation Imbalance

물체의 orientation 분포의 불균형의 영향을 조사해야한다.