[2020 CVPR] Resolution Adaptive Networks for Efficient Inference

Hyungseop Lee·2024년 7월 23일
0

https://openaccess.thecvf.com/content_CVPR_2020/papers/Yang_Resolution_Adaptive_Networks_for_Efficient_Inference_CVPR_2020_paper.pdf

Paper Info

  • Yang, Le, et al. "Resolution adaptive networks for efficient inference." Proceedings of the IEEE/CVF conference on computer vision and pattern recognition. 2020.

Abstract

  • Adaptive inference는 accuracy and computational cost 간의
    dynamic tradeoff를 달성하는 효과적인 mechanism이다.
    기존 연구는 주로 network depth 또는 width에서 architecture redundancy를 활용한다.
    이 논문에서는 input sample의 spatial redundancy에 중점을 두고, 새로운 Resolution Adaptive Network(RANet)을 제안한다.

  • 이는 large objects와 prototypical(전형적인) features를 포함한 "easy" inputs을 분류하는 데는 low-resolution representations이 충분하지만,
    공간적으로 detailed information이 필요한 "hard" sample도 있다는 직관에서 영감을 받았다.
    RANet에서는 input image를 먼저 low-resolution representations을 효율적으로 추출하는 lightweight sub-network로 routing하며,
    high prediction confidence를 가진 sample은 추가 process를 거치지 않고 network에서 early exit된다.
    한편, network의 high-resolution paths는 "hard" samples을 인식할 수 있는 capability를 유지
    한다.
    따라서 RANet은 high-resolution inputs을 inferring하는 데에 관련된 spatial redundancy를 효과적으로 줄일 수 있다.
    경험적으로, 우리는 제안된 RANet이 CIFAR-10, CIFAR-100 및 ImageNet dataset에서 언제든지 prediction setting과 budgeted(예산에 맞춘) batch classification setting에서 모두 효과적임을 입증했다.


1. Introduction

  • deep model의 inference speed를 높이기 위한 많은 노력들이 있었다.
    (예를 들어, lightweight network architecture design, network pruning, and weight quantization.)
    이 중에서 adaptive inference scheme은 각 input에 따라 network structure나 parameters를 동적으로 조절하여
    "easy" samples의 computational redundancy를 줄이는 것을 목표로 하며, 유망한 성능을 보여주고 있다.

  • 대부분의 adaptive inference 연구는 쉽게 recognizable features를 가진 image에 대해 network depth or width를 줄이는 데 중점을 둔다.
    다양한 sample의 intrinsic classification difficulty(내재적 분류 난이도)가 크게 다르다는 점이 밝혀졌다 :
    일부 sample은 fewer layers or channels로 classified가 될 수 있는 반면, 일부 sample들은 larger networks가 필요하다.
    이 사실을 활용하여 최근에는 많은 연구가 제안되었다.
    예를 들어,
    [23]의 model은 reinforcement learning strategies을 통해 학습된 policy으로 runtime 동안 convolutional kernels을 Pruning한다.
    [36]의 network는 각 conv layer 앞에 linear layer를 삽입하여 다음 conv operation을 동적으로 실행할지 여부를 binary decision으로 생성한다.
    Multi-Scale Dense Network(MSDNet)[11]은 일부 sample이 prediction confidence에 따라 auxiliary classifier에서 종료될 수 있도록 한다.

  • 이 논문에서는 adaptive inference를 새로운 관점에서 고찰했다.
    기존 연구들이 network structure에서 computational redundancy를 고려했던 반면,
    우리는 data sampl 내의 information redundancy를 활용하고자 한다.
    우리의 동기는 low-resolution representations이 "easy" samples을 분류하는 데 충분하지만,
    high-resolution feature map을 적용하여 details을 파악하는 것이 "hard" samples을 정확하게 인식하는 데 필요하다는 것이다.
    이는 [17]의 "coarse to fine processing"("거칠게부터 세밀하게 처리하는") efficient algorithm design와도 일치한다.
    signal frequency 관점에서, "easy" sample은 low-resolution features에 포함된 low-frequency information만으로도 올바르게 분류될 수 있다.
    high-frquency information은 low-resolution features만으로 정확하게 예측할 수 없을 때 보완적으로 사용된다.

  • 위의 직관을 바탕으로,
    우리는 deep CNNs에서 resolution adaptive learning을 수행하는 idea를 구현한 Resolution Adaptive Network(RANetwork) 을 제안한다.
    Figure 1은 RANet의 basic idea를 보여준다.
    RANet은 서로 다른 input resolution을 가진 sub-network들로 구성되어 있다.
    "easy" sample은 lowest spatial resolution의 feature map을 가진 sub-network에서 분류된다.
    이전 sub-network가 주어진 criterion(we use the prediction confidence from the softmax probability)을 달성하지 못할 경우, 더 높은 spatial resolution의 sub-network가 적용
    된다.
    이와 동시에, 이전 sub-network의 coarse coarse features는 현재 sub-network에서 재사용되고 fusion된다.
    RANet의 adaptive mechanism은 low-resolution representations으로 sample을 정확하게 예측할 수 있는 경우
    high-resolution에 불필요한 conv 연산을 수행하지 않음으로써 computational budget을 줄여, computational efficiency를 향상
    시킨다.


2. Related work

Efficient inference for deep networks

  • network inference speed를 높이는 다양한 연구들이 있었다.
    그 중 하나로는 lightweight models을 desing하는 것이다. (MobileNet, ShuffleNet, CondenseNe 등)
    또 다른 line은 redundant network connections을 pruning하거나 weights를 quantizing하는 것이다.
    또한 deeper and/or wider teacher network의 outputs을 모방하는 small student network를 학습시키는 knowledge distillng도 제안되었다.
    앞선 방법들은 static model acceleration techniques들로 볼 수 있으며,
    network의 모든 input samples에 대해 일관적으로 inference한다.

  • 반면에,
    adaptive networks는 input complexity에 기반하여 input images를 classifying하는
    적절한 computational resources를 할당한다.
    최근 몇 년 동안 이 연구 방향은 그 장점 때문에 많은 주목을 받고 있다.
    가장 직관적인 구현 방식은 여러 model을 ensembling하여 일부 model을 cascading or mixing way로 선택적으로 실행하는 것이다.
    최근 연구에서는 inference 시 layers or blocks을 동적으로 skip하거나 동적으로 channel을 선택하는 select하는 방법도 제안되었다.
    또한 deep networks의 다양한 위치에 auxiliary predictor를 부착하여 "easy" examples을 조기에 종료할 수 있도록 하는 방법도 있다.
    이와 더불어, multi-branch structure를 가진 network branch의 일부를 동적으로 활성화하는 방법도 adaptive inference를 위한 대안으로 제시되었다.

    그러나 대부분의 이전 연구는 network의 architecture redundancy를 활용하여 adaptive network를 설계하는 데 중점을 두고 있다.
    최근 연구에서는 input image의 spatial redundancy가 입증([4])되었기 때문에,
    이 논문은 neural network의 structural redundancy와 input samples의 spatial redundancy를 모두 활용하는 새로운 adaptive learning model을 제안
    한다.

Multi-scale feature maps and spatial redundancy

  • single scale의 network에서의 downsampling은 network가 임의의 scale에서 object를 인식하는 능력을 제한할 수 있기 때문에,
    최근 연구에서는 network에서 multi scale feature map을 채택하여 동시에 coarse and fine features를 활용하는 방법을 제안한다.
    이는 image classification, object detection, semantic segmentation, pose estimation을 포함한 많은 vision task에서 network 성능을 크게 향상시킨다.
    게다가, multi-scale structure는 adaptive inference and memory-efficient network에서 유망한 능력을 보여준다.

  • deep neural networks를 통해 high-resolution feature map을 유지하는 것이 atypical(비정형) "hard" samples이나 pose estimation과 같은 특정 작업을 인식하는 데 필요하다고 밝혀졌지만,
    high-resolution features에 대해 자주 convolution을 수행하는 것은 resource-hungry(자원 소모적인) model을 초래한다.
    low-resolution input을 사용하여 모든 sample에 대해 lightweight networks가 적절한 error rate를 달성할 수 있다는 것도 관찰되었다.
    이러한 CNN의 spatial redundancy도 [4]에서 연구되었으며,
    network가 작은 scale로 feature map을 처리할 때 octave convolution을 통해 computational efficiency와 classification performance를 동시에 높힐 수 있었다.

  • 그러나, 기존의 이러한 연구 중 어떠한 것도 image의 spatial redundancy를 활용하여 adaptive model을 design하는 것을 고려하지 않았다.
    이 논문에서는 input samples의 대부분을 smaller scale로 처리할 수 있다는 직관에 근거하여
    resource-efficient image classification을 위해 RANet을 제안한다.


3. Method

  • 우선 adaptive inference idea부터 설명하고나서,
    RANet의 Overall architecture and the network details에 대해 설명하겠다.

3.1. Adaptive Inference Setting

  • 우리는 adaptive inferenec model을 다양한 depths에 intermediate classifier가 붙어 있는
    KK개의 classifiers로 구성된 network로 설정했다.
    input image xx가 주어지면, kk-th classifier(k=1,...,K)(k = 1, ..., K)의 output은 다음과 같이 표현된다.
    θk\theta_kkk-th classifier에 해당하는 partial network의 parameter를 나타내며,
    각 element pck[0,1]p_c^k \in [0, 1]cc-th class에 대한 prediction confidence를 나타낸다.
    (여기서 θk\theta_k는 shared parameters를 갖는다.)

  • adaptive model은 sample의 complexity에 따라 적절한 computational resources를 동적으로 할당하여 inference한다.
    sample은 output이 특정 criterion(기준)을 만족하는 첫 번째 classifier에서 network를 종료하게 된다.
    이 논문에서는 the highest confidence of the softmax outputs을 우리의 deicision basis로 사용한다.
    이는 주어진 threshold ϵ\epsilon보다 큰 첫 번째 classifier의 largest softmax output이 final output이 된다는 것을 의미한다.
    threshold ϵ\epsilon은 test time에서 classification accuracy and computational cost 사이의 trade-off를 조절할 수 있다.

3.2. Overall Architecture

  • Figure 2는 제안된 RANet의 overall architecture를 보여준다.
    이 network는 Initial Layer와 여러 resolution에 해당하는 HH개의 subnetworks로 구성된다.
    각 sub-networks는 마지막 몇 개의 block에 여러 개의 classifier를 포함
    하고 있다.
    MSDNet과 유사하게, RANet은 multi-scale architecture와 dense connection을 채택한다.
    RANet과 MSDNet은 유사한 multi-scale structure를 갖고 있지만,
    자세한 architecture design과 computation graphs는 크게 다르다.
    가장 두드러진 차이점은 RANet이 먼저 low-resolution features를 추출해야 한다는 점이다.
    이는 high-resolution features를 먼저 추출하는 전통적인 deep CNNs(MSDNet, REsNet, DensNet, etc)의 design routine과는 다르다.
    MSDNet과 RANet의 차이점에 대한 자세한 내용은 section 3.4.에서 논의.

  • RANet의 basic idea는
    large scale features에 대해 convolution을 수행하는 데에 따른 high computational cost를 피하기 위해
    lowest spatial resolution의 feature map을 사용하는 방법으로,
    network가 먼저 첫 번째 sub-network를 사용하여 sample을 prediction한다.
    만약 첫 번째 sub-network가 sample에 대해 unreliable prediction을 한 경우,
    small scale intermediate features가 더 높은 resolution의 다음 sub-network로 fusion된다.
    이 절차는 한 sub-network가 confident prediction을 제공할 때까지 또는 last sub-network가 사용될 때까지 반복
    된다.
    Sub-network hh에 대응하는 base features in scale ssx0s,hx_0^{s,h} (s=1,2,...Ss=1,2,...S, h=1,2,...Hh=1,2,...H)로 denote된다.
    이제 밑에 있는 features x01,1x_0^{1,1}을 사용하여 Sub-network 1이 수행된다.
    만약 Sub-network 1이 high confidence를 얻는 데에 실패했으면,
    Sub-network 2가 사용되는데, 여기에는 더 larger scale features인 (x02,2)(x_0^{2,2})가 사용된다.
    SUb-network 1의 intermediate features는 Sub-network 2에 fusion된다.
    우리는 Sub-network 2가 confident prediction 만드는 것에 실패했다면 Sub-network 3에서 이 과정을 반복한다.

  • RANet은 일반적으로 input을 coarse(대략적인 것)에서 fine(세밀한 것)으로 처리하지만,
    RANet의 각 sub-network는 여전히 forward propagation 중에 feature를 downsampling하여 lowest resolution(s=1)에 도달하며,
    모든 classifier는 각 sub-network의 s=1s=1인 마지막 몇 block에만 부착된다.

  • 앞서 언급한 inference 절차는 image recognition에 대한 우리의 intuition과 일치한다.
    대표적인 feature를 가진 "easy" sample은 low-resolution representations만 제공되어도 높은 confidence를 갖고 올바르게 classified될 수 있다.
    atypical(비정형적) features를 가진 hard" sample은 high-resolution feature map에서 추출한 fine details와 함께 global information에 기반해서만 정확하게 인식될 수 있다.

3.3. Network Details

(skip)

3.3.1 Initial Layer

3.3.2 Sub-networks with Different Scales

SUb-network 1.

Sub-networks on larger-scale features

Transition layer.

Classifiers and loss function

3.4. Resolution and Depth Adaptation


4. Experiments

profile
Efficient Deep Learning

0개의 댓글