2021. 1. 16. 17:49ㆍComputer vision 논문 & 코드리뷰
논문 링크:arxiv.org/pdf/2004.07570.pdfarxiv.org/abs/2004.07570
Spatially Attentive Output Layer for Image Classification
Most convolutional neural networks (CNNs) for image classification use a global average pooling (GAP) followed by a fully-connected (FC) layer for output logits. However, this spatial aggregation procedure inherently restricts the utilization of location-s
arxiv.org
● introduction
SAOL은 보통 이미지용 대부분의 CNN classification에서 GAP, FC를 이용함으로써 나타나는 위치정보 소실이라는 문제를 해결하기 위해 새로운 output layer의 형태를 제안합니다.
ABN과 유사한 아이디어라고 할 수 있으나, attention branch에서 다시 뒤로 돌아가 attention map을 구해야하는 단점을 보완한 것이라고 볼 수 있습니다.
● SAOL
간단하게 말해, SAOL은 multi scale의 feature map들 (이전 featuremap들)을 resize하고 합쳐서 spatial logits을 구해준 후 (spatial) attention map과 곱해주어 weighted sum을 구해준 것입니다. 이를 통해 위치정보를 잃지 않고 classification을 수행할 수 있습니다.
-기존 GAP-FC의 output과 SAOL 비교
1. conventianal GAP-FC CNN classification output![]() |
SAOL은 1과 달리 last feature map을 통합하지 않고, 명백하게 각 spatial location에 output logits를 생성한 후, ![]() 이를 spatial attention mechanism을 통해 선택적으로 합쳐줍니다. |
2. SAOL![]() ![]() ![]() ![]() |
<attention map>
attentio map 생성에 대해 조금 더 자세히 설명하자면, 마지막 feature map을 input으로 넣어주고, 2개의 conv layer와 softmax를 적용해 줍니다. 동시에, 정확한 spatial logits를 위해서, 우리는 이전의 semantic segmentation위한 decoder 모듈에 의해 동기부여된, multi-scale spatial logits를 결합합니다.
< self-supervised loss >
이 논문에서는, cross entropy loss와 supervised loss(밑의 식)만으로도 충분한 performance를 보여주지만, 완전히 사용 가능한 location-specific output information와 더 좋은 classification 성능을 위해 두가지 novel spatial losses를 제안합니다. -> CutMix에 기반한 loss, self-supervised learning methods에 기반한 loss
cutmix 논문 : arxiv.org/abs/1905.04899
CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Features
Regional dropout strategies have been proposed to enhance the performance of convolutional neural network classifiers. They have proved to be effective for guiding the model to attend on less discriminative parts of objects (e.g. leg as opposed to head of
arxiv.org
cutmix를 간단히 설명하면,
1) img1과 img2를 Random Sampling을 합니다.
2) img2에서 Random fetch(전체에서 임의의 영역을 자른부분영역) 를 copy해서 img1의 같은 위치의 영역에 붙여줍니다.
(augmentation방법이라고 생각하면 될듯합니다)
실제 cutmix한 부분과 predict한 cutmix 부분의 차이를 줄이기 위한 loss를 Lss1이라고 할 수 있습니다. (binary cross entropy)(M이 binary mask : cutmix영역을 1, 나머지를 0으로 표현)
Lss2는 cutmix한 부분의 spatial logits와 crop한 이미지(cutmix한 영역)의 원본이미지의 spatial logits의 차이를 줄이기 위한 loss입니다.
(왼쪽 그림의 b를 참조하면 더 이해하기 쉽습니다.)
![]() |
KullbackLeibler divergence |
![]() |
![]() |
이러한 self-supervision은 특정 paste위치(cutmix위치)를 식별하거나, 동일한 spatial logits를 생산하기 위해 network를 regularize하므로 공간적으로 일관된 특징을 표현할 수 있게되고, 그에 의해 성능이 향상될 수 있습니다.
<Self-Distillation Loss>
기존의 CNN에 제안된 SAOL을 삽입할 수 있기 때문에, training에서 왼쪽에 나타낸 것과 같이 이전의 GAP-FC 기반 output layer와 SAOL을 모두 활용합니다.
이 논문에서는 SAOL에서 기존 출력 계층으로 knowledge transfer 을 제안합니다.
주어진 입력 영상으로부터 두 개의 출력 레이어에 의해 별도로 얻어진 two final output logits으로 self-distillation loss LSD를 고안합니다.
논문에서 베타값은 0.5로 설정했다.
※ test / inference에서는 GAP-FC output은 사용하지 않습니다(computation을 줄여야 하므로). 오직 training에서만 사용
최종 LOSS
'Computer vision 논문 & 코드리뷰' 카테고리의 다른 글
Pix2Pix code review 코드리뷰 (0) | 2021.04.08 |
---|---|
[Pix2Pix]Image-to-Image Translation with Conditional Adversarial Networks (0) | 2021.03.30 |
U-GAT-IT (0) | 2021.01.29 |
Attention Branch Network: Learning of Attention Mechanism for Visual Explanation(ABN, CVPR2019)요약 (0) | 2021.01.16 |
Class Activation Map(Learning Deep Features for Discriminative Localization) (CVPR2016) (0) | 2021.01.16 |