이 논문에서 우리는 mobile model에 대한 다양한 task 뿐만 아니라 다른 model size spectrum에서도 state of the art performance를 보이는 new mobile architecture, MobileNetV2
를 소개할 것이다.
우리는 또한 SSDLite
라고 불리는 새로운 framework을 사용하여
mobile model에 object detection을 적용하는 효율적인 방법을 소개할 것이다.
추가적으로, 우리는 우리는 MobileDeepLabv3
라고 부르는
축소된 형태의 DeepLabv3를 통해 mobile semantic segmentation model을 만드는 방법을 설명할 것이다.
MobileDeepLabv3
은 inverted residual structure에 기초를 두고 있다.
inverted residual structure
는 얇은 bottlenectk layer 사이의 shortcut connection을 말한다.
(기존의 residual block은 wide -> narrow -> wide structure with the number of channel.)
(inverted residual block은 narrow -> wide -> narrow structure)
lightweight depthwise convolutions to filter features
as a source of non-linearity.Neural network는 많은 분야에서 발전이 이루어지고 있다.
하지만 현재의 state of the art network들은
many mobiles and embedded applications에 적용하기에
high computational resource가 필요하다.
이 논문에서는 mobile이나 resource constrained environments를 위해 잘 맞춰진 neural network architecture를 소개할 것이다.
우리의 Network는 same accuracy를 유지하면서
the number of operations and memory needed를 줄이며 state of the art로 나아간다.
Our main contribution is a novel layer module :
the inverted residual with linear bottleneck.
This module takes as an input a low-dimensional compressed representation which is first expanded to high-dimension and filtered with a lightweight depthwise convolution.
그 다음에 feature들은 linear convolution을 통해 원래의 low-dimensional representation으로 돌아간다.
정리 :
The inverted residual with linear bottleneck block은 low-dimensional coompressed representation으로 압축된 input을
high-dimension으로 확장시키고나서
lightweight depthwise convolution을 통해 filter연산을 수행하여
원래의 low-dimensional representation으로 되돌아간다.
The official implementation is available as part of TensorFlow-Slim model library in https://github.com/tensorflow/models/tree/master/research/slim/nets/mobilenet
이 convolutional module은 특히 mobile design에 대해 적절하다.
왜냐하면 이 module은 large intermidate tensor를 완전히 구현하지 않음으로써
inference 동안 the memory footprint(=memory 사용량)이 크게 줄어든다.
이를 통해 적은 양의 빠른 SW 제어 cache memory를 제공하는 많은 embedded HW 설계에서
main memory access 필요성이 줄어든다.
accuracy와 performance 사이에 최적의 balance를 위한 deep neural architecture에 대한 연구가
지난 몇 년간 활발히 이루어지고 있다.
manual architecture search와 improvement in training algorithm (AlexNet, VGGNet, GoogLeNet, ResNet) 뿐만 아니라
hyper parameter optimization method(Random search for hyper-parameter optimization, bayesian optimization, 등),
network pruning(12 ~ 17) and connectivity learning(18, 19) 에도 많은 발전이 있었다.
ShuffleNet 또는 introducing sparsity와 같이
internal convolution block의 connectivity structure를 변화시키는 것이 최근 활발히 연구되어지고 있다.
최근에 genetic algorithm과 reinforcement learning에 대한 architectural search를 포함하여
optimization method에 대한 새로운 방향들이 소개되어지고 있다.
하지만 한가지 단점으로, 결과적인 network가 매우 복잡해진다는 것이다.
이 논문에서,
우리는 neural network가 어떻게 작동하는지에 대한 better intuition을 개발하고
가능한 simplest network design 설계를 돕는 데에 사용하는 것을 목표로 한다.
Our network design is based on MobilNetV1.
우리의 network는 simplicity를 유지하고, accuracy를 향상시키는 동안에 어떠한 special operator들이 필요하지 않다.
Depthwise Separable Convolutions
은 많은 efficient neural network architecture(27, 28, 20)들의 핵심적인 building block이고,depthwise convolution
이라고 불리고,pointwise convolution
이라고 불리고,Standard convolution
takes an x x input tensor ,Depthwise Separable Convolution
:Standard convolutional layer
takes as input a X X feature map andDepthwise Separable convolution
depthwise convolution
:pointwise convolution
:개의 layer 로 구성되어 있는 deep neural network를 고려하자.
각 layer의 activation은 x x 를 갖는다.
이 section에서는 x x 라는 tensor의 property에 대해서 살펴볼 것이고,
이는 차원을 갖는 pixel이 x 개 있다고 생각할 수 있다.
real image에 대한 input set에 대해서,
우리는 이러한 set of layer activations이 "manifold of interest" (관심영역에 대한 manifold)를 형성한다고 말할 수 있다.
neural network에서 mainfolds of interest가 low-dimensional subspace로 embedded될 수 있다고 가정되어 왔다.
즉, 모든 독립적인 d-channel pixel을 볼 때,
encode되어 있는 정보는 어떠한 manifold 상에 위치하며, 그 정보들을 저차원의 subspace로 보낼 수 있다는 것이다.
(내 생각, 비유)
큰 도화지(manifold)에 작은(depth) 고양이를 그려서 구기고, 이를 펼치는 것보다
작은 도화지(manifold)에 큰(depth) 고양이를 그려서 구기고, 이를 펼치는 것이
고양이를 분류하는 데에 더욱 쉬울 것이다. (학습이 더 잘 될 것이다.)
bottleneck block
은 residual block과 비슷한데,Table 1
: The basic implementation structure.
ReLU6 :
For a block of size x .
expansion factor and kernel size with input channel and output channels,
the total number of multiply add required is
Table 3
:
We compare the needed sizes for each resolution
between MobileNetV1, MobileNetV2, ShuffleNet.
capacity
로 볼 수 있고,expressiveness
로 볼 수 있다.capacity
와 expressiveness
가 얽혀있던 traditional convolution block과는 대조된다.network의 expressiveness는 expansion layer에서 channel수를 얼만큼 늘려주느냐에 따라 결정되고,
capacity는 projection(pointwise layer)에서 channel수를 얼만큼 줄이느냐에 따라 결정된다.
따라서 실제로 expressiveness를 계산하는 것은 depthwise convolution에서 수행되고,
expansion, projection에서 capacity를 조절하는 역할을 하기 때문에
하나의 block에서 expressiveness와 capacity가 분리되어 있어서
따로따로 control할 수 있게 만들었다고 해석...
TensorFlow나 Caffe를 사용하는 일반적인 inference implementation은
directed acyclic compute hypergraph G를 만드는 것이다.
G는 operation을 나타내는 edge와 intermediate computation을 나타내는 node로 구성되어 있다.
Computation은 memory에 저장되어야 할 tensor들의 총 개수를 최소화하기 위해 schedule되어 진다.
은 nodes들이 연결되어 있는 intermediate tensor의 list이다.
는 tensor 의 size이다.
는 operation 동안에 내부 storage를 위해 필요한 memory의 총량이다.
일반적으로
그럴듯한 computation 조합인 을 탐색하고, 를 minimize하는 것을 찾는다.
residual connection과 같이 사소한 parallel structure만 있는 graph의 경우,
사소하지 않은 계산 순서(residual connection)가 하나뿐이므로
computation graph 에 대한 inference 단계에서 필요한 memory의 총량과 boundary를 단순화할 수 있다 .
다시 말하면,
memory의 총량은 모든 operation의 input과 output을 결합한 maximum total size로 단순화할 수 있다.
우리가 bottleneck residual block을 하나의 single operation으로 취급하기 때문에
memory의 총량은 bottleneck tensor의 size로 지정될 수 있다.
정리 :
intermediate representation의 channel 이 있을 때,
이라고 하면, 하나의 channel씩만 통과한다.
이는 cache miss로 인해 runtime performance가 안 좋다고 한다.
따라서 를 작게 하여 intermediate representation을 보다 적은 tensor로 나누어 연산을 진행해야 한다.
실험상 는 2~5가 좋다고 한다.
우리는 COCO dataset에 대한 Single Shot Detector(SSD)의 수정된 version으로
object detection에 대한 feature extractor로써 MobileNetV2와 MobileNetV1의 performance를 비교했다.
우리는 또한 YOLOv2와 original SSD를 비교했다.
SSDLite
:
이 논문에서,
우리는 mobile에 사용할 수 있는 SSD의 또 다른 버전을 소개한다.
우리는 모든 regular convolution을 separable convolutions(depthwise followed by 1x1 projection)으로 대체했다.
이 design은 훨씬 더 computationally efficient하다.
우리는 이 수정된 version을 SSDLite라고 한다.
regular SSD와 비교했을 때, SSDLite는 급격하게 parameter 수와 computational cost를 줄였다. (Table 5)
두 MobileNet model은 Open Source TensorFlow Object Detection API로 train되어졌다.
두 model의 input resolution은 320 x 320로 했다.
우리는 mAP(COCO challenge metrics), parameter 수, Multiply-Adds 수를 모두 benchmark하고 비교했다. (Table 6)주목할 만한 것은,
MobileNetV2 SSDLite가 YOLOv2보다 20배 더 efficient하고 10배 더 작다.
우리는 mobile semantic segmentation task를
MobileNetV1과 MobileNetV2 model을 feature extractor로 사용하여
DeepLabv3과 비교했다.
DeepLabv3은 atrous convolution을 적용했고,
계산된 feature map의 resolution을 control할 수 있는 강력한 tool이다.
DeepLabv3에서 사용된 개념인
(1) ASPP(Atrous Spatial Pyramid Pooling module)
(2) OS : output stride that controls the output resolution of the segmentation map.
과
(3) MF : Multi-scale and left-right Flipped inputs during test.
를 hyper parameter로 두고,
evaluation metric mIOU에 대한 inference 진행.
Ablation study
: 의학이나 심리학 연구에서, Ablation Study는 장기, 조직, 혹은 살아있는 유기체의 어떤 부분을 수술적인 제거 후에 이것이 없을때 해당 유기체의 행동을 관찰하는 것을 통해서 장기, 조직, 혹은 살아있는 유기체의 어떤 부분의 역할이나 기능을 실험해보는 방법linear bottleneck model이 non-linearity model보다 더 적은 성능을 보인다.
왜냐하면 activation들이 항상 linear regime에서 계산되어지기 때문이다.
하지만 Figure 6a에서 보여진 우리의 실험은 linear bottleneck이 performance를 향상시킨다고 보여준다.
non-linearity가 low-dimensional space에 대한 정보를 파괴한다는 것을 보여준다.
우리는 mobile model에 사용할 수 있는 매우 간단한 network architecture를 소개했다.
우리의 basic bilding unit은 여러가지 properties를 갖는다.
그것은 memory-efficient inference와 모든 neural frameworks에서 standard operation으로 사용되어지게 한다.
제안된 convolutional block은
bottleneck input으로 encode된 capacity와 expansion layer로 encode된 expressiveness가 분리되어지는 것을 허용하는 독특한 property를 갖는다.
이에 대해 탐구하는 것은 future research에서 중요한 방향이될 것이다.
"activation들이 subspace에 흩뿌려져 있는게 아니라 subspace에 모여있을 것이다."
3차원 공간 안에 2차원 공간이 무수히 많이 있듯이, activation이 형성한 manifold of interest의 subspace에 고양이에 대한 feature들이 모여있을 것이다.
이 또한 수학적 증명은 아니고 일종의 hypothesis이다..
depthwise로 차원 정보가 깨지고
projection을 해서 차원을 합치는 depthwise separable convolution은
기존의 convolution 연산의 manifold 변환과는 다르다..
이론상 MobileNet의 parameter가 10배 정도 줄었으니 10배 빨라야 하는데, 실제로 그렇지 않다.
NVIDIA에서 CNN을 위한 cuda programming 패키지인 dnn-utils를 제공하는데
depthwise convolution에 대한 optimization을 구현해놓지 않았기 때문에
이론상 runtime 시간과 실제의 runtime 시간의 차이가 있는 것이다..
연산량을 MAdds(Multiply Add)로 측정하는 논문, FLOPs(FLoating point Operations Per Second)로 측정하는 논문도 있고, ...,
그래서 논문을 볼 때 이러한 차이점들에 대해서 유의하여야 한다.
efficient network를 생각할 때, parameter size와 연산량을 분리하여 생각해야 한다.
단순하게 추상적으로 efficient network의 size가 작다고 표현하면 안된다.
efficient network를 설계할 때, parameter size를 줄일 것인지? 연산량을 줄일 것인지? 생각하고 그에 맞게 설계를 해야 한다.
그리고 뭐가 작아진 것인지도 정확히 파악해야 한다.