카테고리 없음

Review _ RepVGG

Hardy. 2021. 1. 26. 20:11
  • repvgg vs. resnet

https://arxiv.org/pdf/2101.03697.pdf - paper

https://github.com/DingXiaoH/RepVGG - source code

목적 ;

image feature extraction 에 따라 object detection 의 성능에 유의미한 영향을 끼칠 것이다. 라는 가설을 세워보고 이를 실험해보고자 최근에 나온 repVGG weight , transfer learning 방법론을 적용하려했으나 아직 미숙하여 결과는 아직입니다. 허나 대략적인 contribution 과 advantages 를 토대로 공유드리고자 합니다.

contribution

  1. VGG plain 모델만으로 기존 multi-braches model(Resnet과 같은 깊은 구조의 architecture) 에 반해 성능이 괜찮았습니다.
  2. 3x3 conv 와 ReLU로만 이루어져 있습니다. (inference)
  3. 앞서 언급한 내용들과 비슷하나 automatic search / manual refinement / compound scaling 과 같은 heavy design을 사용하지 않았습니다. (parameter tunning technique)
  • automatic search ; all convolutional networks in our search space are composed of convo-lutional layers (or “cells”) with identical structure but dif-ferent weights. Searching for the best convolutional archi-tectures is therefore reduced to searching for the best cellstructure. Searching for the best cell structure has two mainbenefits: it is much faster than searching for an entire net-work architecture and the cell itself is more likely to gener-alize to other problems. In our experiments, this approachsignificantly accelerates the search for the best architecturesusing CIFAR-10 by a factor of7×and learns architecturesthat successfully transfer to ImageNet.

architecture

 

Approach

① Structural Reparameterization 이라는 technique을 활용하여 training time / inference-time 을 각각 나눠서 학습 및 추론을 진행하였습니다.

  • Structural Reparameterization ; converting the architecture from one to another via trnasforming its parameters.

여기에서 활용한 Strucutral Reparameterization 은 기존에 DiracNet이란 모델에서도 사용했으나 repVGG 는 2가지 차이점이 있다고합니다.

  1. actual dataflow에 적용한 점.
  2. 성능 ; DiracNet < Resnet < repVGG

② Winograd convloution

highly optimized by some modern computing libraries

장 ; 2. 25 x 가까이 성능 향상됨

단 ; 필터 사이즈에 의존 , 필터 사이즈가 맞지 않으면 연산상 이득이 떨어짐.

Building RepVGG via Structural Re-param

Simple is Fast, Memory-economical, Flexible

Fast

Many recent multi-branch architectures havelower theoretical FLOPs than VGG but may not run faster.E.g., VGG-16 has8.4×FLOPs as EfficientNet-B3 [34] butruns1.8×faster on 1080Ti (Table. 4), which means the computational density of the former is15×as the latter.

 

Memory-economical

multi-branch 마다 매 연산이 더해지거나 concate 해야 하기에 메모리 적인 측면에서 memory - inefficient 함을 주장하였습니다.

 

Flexible

Restnet은 residual block로 이루어진 구조로 인해 flexible 가 떨어진 반면 본 제안 방법론으로는 훨씬 broad applicated 를 주장하고 있습니다.(모델의 단순함)

이 섹션에서는 multi-branch models 와 대비하여 single-branch models의 장점을 잘 나열해 놓았습니다. ex) channel pruning , prunning tircky 와의 performance 상관관계 등.

여기 까지 plain ConvNet 에 대한 다양한 강점을 주장하였으나 이 구조에도 치명적인 약점인 the poor performance 에 대해 어떻게 해결한가에 대한 이야기가 시작됩니다.

Training-time Multi-branch Architecture

이 방법론은 모순적이게도 Resnet의 구조인 residual block , shortcut branch 로부터 inspired 되었다고 합니다. 간단히 말씀드리자면 각 레이어의 output 인 y = x + f(x) 의 dimension 이 matching 되지 않았을 시 y = g(x) + f(x) 의 (where g(x) is a convolutional short cut implemented by a 1 x 1 conv) 구조를 하나의 implicit ensemble of numerous shallower models 라 하여 본 저자는 2^n models ensemble 로 해석하여 적용해보고자 하였습니다. 이러한 구조는 inference 시에는 drawback이지만 training stage 에서는 굉장한 beneficial 을 준다는 motive 를 토대로 최종적으로 아래 그림과 같이 training stage 에서 3x3 , 1x1 , identity block 총 3^n 의 ensemble 로 training 한 후 inference에서는 plain 모델을 사용하였다고 합니다.

 

Re-param for Plain Inference-time Model

이번 섹션에서는 앞선 trained block 을 어떻게 single 3x3 conv layer 로 바꿔 Inference 에 적용할지에 관한 내용입니다.

 

결론적으로는 각각의 output 을 BN layer 의 input으로 활용하여 도출된 파라미터들을 토대로 변환한다고 합니다.

Experiment

 

 

 

we desire the last layer to have richer features for the classifi-cation or other down-stream tasks

recap

  • training 시 plain 구조(kernel size 3x3) 를 활용하여 computing libraries 에 잘 맞는 kernel size를 활용하여 cost를 효율적으로 활용함.
  • training 시 residual learning 를 통한 shallow ensemble 을 활용하여 효율적인 학습.
  • Inference 시에는 앞선 구조들을 BN layer를 활용하여 plain 화 함. ( 4.2. Structural RE-parameterization is Key section 에서 Re-parameterization에 대해 실험을 하였음. )