Spatially Attentive Output Layer for Image Classification

04/16/2020 ∙ by Ildoo Kim, et al. ∙ Kakao Corp. 0

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-specific information at the output layer, although this spatial information can be beneficial for classification. In this paper, we propose a novel spatial output layer on top of the existing convolutional feature maps to explicitly exploit the location-specific output information. In specific, given the spatial feature maps, we replace the previous GAP-FC layer with a spatially attentive output layer (SAOL) by employing a attention mask on spatial logits. The proposed location-specific attention selectively aggregates spatial logits within a target region, which leads to not only the performance improvement but also spatially interpretable outputs. Moreover, the proposed SAOL also permits to fully exploit location-specific self-supervision as well as self-distillation to enhance the generalization ability during training. The proposed SAOL with self-supervision and self-distillation can be easily plugged into existing CNNs. Experimental results on various classification tasks with representative architectures show consistent performance improvements by SAOL at almost the same computational cost.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 8

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Figure 1: Comparison between (a) the conventional GAP-FC based output layer and (b) the proposed output layer, SAOL. SAOL separately obtains Spatial Attention Map and Spatial Logits (classification outputs for each spatial location). Then, Spatial Logits are weighted averaged by the Spatial Attention Map for the final output.

Deep convolutional neural networks (CNNs) have made great progress in various computer vision tasks including image classification

[krizhevsky2012imagenet, resnet_cvpr], object detection [RCNN, FasterRCNN, feature-pyramid-net], and semantic segmentation [FCN, DeepLab]. In particular, there have been lots of researches on modifying convolutional blocks and their connections such as depthwise separable convolution [chollet2017xception], deformable ConvNet [dai2017deformable], ResNet [resnet_cvpr], and NASNet [zoph2018learning]

to improve feature representations. However, in contrast to well-developed convolutional architectures for (multi-scale) spatial feature extraction, the output module to generate the classification logits from the feature maps has been almost unchanged from a standard module that is composed of a global average pooling (GAP) layer and fully-connected (FC) layers. Even though it has shown that CNNs with this feature aggregation can retain its localization ability to some extent

[NIN, zoph2015iclr, CAM], in principle, these CNNs have a restriction in full exploitation of benefits from an explicit localization of output logits for image classification.

Recently, the use of localized class-specific responses has drawn increasing attention for image classification, which allows taking the following three main advantages: (1) it can help to interpret the decision making of a CNN through visual explanation [CAM, selvaraju2017gradcam, gradcam++]; (2) a spatial attention mechanism can be used for performance improvement by focusing only on the regions that are semantically relevant to the considered labels [saumya2018iclr, cbam, fei2017cvpr, abn]; and (3) it enables to make use of auxiliary self-supervised losses or tasks based on spatial transformations, which leads to enhanced generalization ability [tellme, gidaris2018unsupervised-rotation, xiaolin2018cvpr, hao2019cvpr, tao2019, lezi2019iccv].

However, most of the previous methods have obtained spatial logits or attention maps via conventional class activation mapping techniques such as class activation mapping (CAM) [CAM] and gradient-weighted class activation mapping (Grad-CAM) [selvaraju2017gradcam]. They have still utilized the GAP for image-level prediction and thus only located a small part of a target object [tellme] or attended inseparable regions across classes [lezi2019iccv]. While this inaccurate attention mapping hinders its use to improve the classification accuracy, it also has limited an application of self-supervision concerning spatial labeling to maintaining attention consistency under simple spatial transformations such as rotation and flipping [hao2019cvpr] or naive attention cropping and dropping [tao2019].

Accordingly, we propose to produce explicit and more precise spatial logits and attention maps as well as to apply useful self-supervision by employing a new output module, called Spatially Attentive Output Layer (SAOL). In specific, from the feature maps, we separately obtain the spatial logits (location-specific class responses) and the spatial attention map. Then, the attention weights are used for a weighted sum of the spatial logits to produce the classification result. Figure 1 shows an overall structure of the proposed output layer in comparison to the conventional one.

The proposed output process can be considered as a weighted average pooling over the spatial logits to focus selectively on the target class region. For more accurate spatial logits, we aggregate multi-scale spatial logits inspired by decoder modules used for semantic segmentation [FCN, ronneberger2015unet, chen2018encoder]. Note that SAOL can generate spatially interpretable attention outputs directly and target object locations during forward propagation without any post-processing. Besides, the computational cost and the number of parameters of the proposed SAOL are almost the same as the previous GAP-FC based output layer.

Furthermore, we apply two novel location-specific self-supervised losses based on CutMix [yun2019cutmix] to improve the generalization ability. We remark that different from CutMix, which mixes the ground truth image labels proportionally to the area of the combined input patches, the proposed self-supervision utilizes cut and paste of the self-annotated spatial labels according to the mixed inputs. The proposed losses make our spatial logits and attention map more complete and accurate. We also explore a self-distillation by attaching the conventional GAP-FC as well as SAOL and distilling SAOL logits to GAP-FC. This technique can improve performances of the exiting CNNs without changing their architectures at test time.

We conduct extensive experiments on CIFAR-10/100 [cifar]

and ImageNet

[imagenet] classification tasks with various state-of-the-art CNNs and observe that the proposed SAOL with self-supervision and self-distillation consistently improves the performances as well as generates more accurate localization results of the target objects.

Our main contributions can be summarized as follows:

  • [topsep=2pt]

  • The SAOL on top of the existing CNNs is newly proposed to improve image classification performances through spatial attention mechanism on the explicit location-specific class responses.

  • In SAOL, the normalized spatial attention map is separately obtained to perform a weighted average aggregation over the elaborated spatial logits, which makes it possible to produce interpretable attention outputs and object localization results by forward propagation.

  • Novel location-specific self-supervised losses and a self-distillation loss are applied to enhance the generalization ability for SAOL in image-level supervised learning.

  • On both of image classification tasks and Weakly Supervised Object Localization (WSOL) tasks with various benchmark datasets and network architectures, the proposed SAOL with self-supervision consistently improves the performances. Additionally, ablation experiments show the benefits from the more accurate spatial attention as well as the more sophisticated location-specific self-supervision.

2 Related Work

Figure 2: The detailed structure of the proposed SAOL. It produces the spatial attention map and spatial logits, separately. Note that we use additional self-annotated spatial labels to leverage our architecture further. We can also train the conventional GAP-FC based output layer jointly, using self-distillation.

Class activation mapping. Class activation mapping methods have been popularly used (1) for visualizing spatial class activations to interpret decision making of the final classification output, (2) for incorporating an auxiliary regularization based on it to boost classification performances, or (3) for performing WSOL. Specifically, CAM [CAM] can obtain an activation map for each class by linearly combining the last convolutional feature maps with the weights associated with that class at the last FC layer. However, CAM needs to replace the FC layer with convolution and GAP to produce the final classification output. On the other hand, Guided Back-propagation [jost2015iclr], Deconvolution [zeiler2014eccv], and Grad-CAM [selvaraju2017gradcam] was proposed for generating class-wise attention maps by using gradients in back-propagation without requiring architectural changes. Grad-CAM++ [gradcam++] modified Grad-CAM to localize multiple instances of the same class more accurately using higher-order derivatives. These methods still adapted the GAP for image-level prediction, which often leads to highlighting only on a discriminative but uncompleted part of a target object.

Attention mechanism. Several works have been recently explored the use of attention mechanism for image classification and WSOL [saumya2018iclr, cbam, fei2017cvpr, abn]. Residual Attention Network [fei2017cvpr] modified ResNet [resnet_cvpr] by stacking multiple soft attention modules that gradually refine the feature maps. Jetley et al. [saumya2018iclr] proposed a trainable module for generating attention weights to focus on different feature regions relevant to the task of classification at hand. Woo et al. [cbam] introduced a convolutional block attention module that sequentially applies channel and spatial attention modules to refine intermediate feature maps. Attention Branch Network (ABN) [abn] designed a separate attention branch based on CAM to generate attention weights and used them to focus on important feature regions. While all of these attention methods refine intermediate feature maps, we apply the attention mechanism on the output layer to directly improve spatial output logits. Girdhar et al. [girdhar2017attentionalpooling] introduced a more closely related method based on spatial attention for pooling spatial logits on action recognition tasks. Still, they used simple linear mappings only from the last feature map.

CutMix and attention-guided self-supervision. As an efficient and powerful data augmentation method, CutMix [yun2019cutmix] was recently developed, and it significantly outperforms over previous data augmentation methods such as Cutout [devries2017cutout] and Mixup [zhang2017mixup]. Yet, CutMix cannot guarantee that a randomly cropped patch always has a part of the corresponding target object with the same proportion used for label-mixing. Several recent works derived auxiliary self-supervised losses using attention maps. For example, Guo et al. [hao2019cvpr] proposed to enhance attention consistency under simple spatial transformations, and Hu et al. [tao2019] applied the attention cropping and dropping to data augmentation. Li et al. [tellme] proposed guided attention inference networks that explore self-guided supervision to optimize the attention maps. Especially, they applied an attention mining technique with image cropping to make complete maps; However, these maps are obtained based on Grad-CAM. Zhang et al. [xiaolin2018cvpr] introduced adversarial learning to leverage complementary object regions found by CAM to discover entire objects. Wang et al. [lezi2019iccv] presented new learning objectives for enhancing attention separability and attention consistency across layers. Different from these attention-guided self-supervised learning methods, we design a more sophisticated location-specific self-supervision leveraging CutMix.

3 Methods

In this section, we describe the proposed output layer architecture named SAOL and location-specific self-supervised losses and self-distillation loss in detail.

3.1 Spatially Attentive Output Layer

Let and

denote an input image and its one-hot encoded ground truth label, respectively. For CNN-based image classification, an input

is first fed into successive convolution blocks , where intermediate feature maps at the block is computed by . Here, , , and are the height, width, and number of channels at the block. Then, the final normalized output logits

, which can be considered as an output probability distribution over

classes, are obtained by an output layer such that . In specific, the conventional GAP-FC based output layer can be formulated as

(1)

where

denotes the spatially aggregated feature vector by GAP, and

is the weight matrix of the output FC layer. Here, , where is the element of the feature map at the last block. Instead of this aggregation on the last feature map, our method produces output logits explicitly on each spatial location and then aggregates them selectively through the spatial attention mechanism.

Specifically, the proposed SAOL, , first produces Spatial Attention Map, , and Spatial Logits, , separately. Here, it is noted that we set and by default. The attention values are normalized via softmax across the spatial positions while we take softmax on the spatial logits across classes: and . Then, we generate the final output logits by a spatially weighted sum of the spatial logits as follows:

(2)

where is the output logit of the class. These attention weights indicate the relative importance of each spatial position regarding the classification result.

The architecture in SAOL is described in detail in Figure 2. First, to obtain the spatial attention map , we feed the last convolutional feature maps into two-layered convolutions followed by the softmax function. At the same time, for the sake of the precise spatial logits, we combine multi-scale spatial logits, motivated by previous decoder modules for semantic segmentation [FCN, ronneberger2015unet, chen2018encoder]. In specific, at each of the selected blocks, the feature maps are mapped to the intermediate spatial logits through convolutions after resized to the output spatial resolution. Then, a set of the intermediate spatial logits are concatenated and re-mapped to the final spatial logits by another convolution layer and the softmax function. Note that in contrast to CAM [CAM] and Grad-CAM [selvaraju2017gradcam], this SAOL can directly generate spatially interpretable attention outputs or target object locations using and in a feed-forward manner. This makes it possible to use location-specific regularizers during training, as presented in the next subsection.

3.2 Self-Supervised Losses

Figure 3: The proposed two self-supervisions based on CutMix for SAOL: (a) and (b) .

The proposed SAOL performs well when trained even only with the general cross-entropy loss as our supervised loss such that 111We let and denote the final output logits from the GAP-FC based output layer and those from SAOL, respectively.. However, in order to fully utilize location-specific output information to boost the classification performance, we add two novel spatial losses inspired by CutMix [yun2019cutmix] and self-supervised learning methods [gidaris2018unsupervised-rotation, lee2019rethinking].

CutMix generates a new training sample by mixing a certain sample and a random patch extracted from an another sample as follows:

(3)

where denotes a binary mask for cropping and pasting a rectangle region, and

is a combination ratio sampled using the beta distribution. This label-mixing strategy implies that a cut region should have the meaning as much as the size of the cropped area in the context of its label. However, this assumption would often be incorrect since a randomly cropped patch can fail to capture a part of the corresponding target object, especially when the target object is small.

Specifically, we use two additional self-annotated spatial labels and self-supervised losses, as illustrated in Figure 3. Given a CutMix-ed input image, the first self-supervised loss uses as an additional ground truth label after resizing to . We add an auxiliary layer similar to the attention layer to predict . Since is the binary mask, the binary cross-entropy loss is used as

(4)

The second self-supervised loss we propose is to match the spatial logits in the pasted region of the mixed input with the spatial logits in the cut region of the original data as follows:

(5)

where

represents the Kullback–Leibler divergence

222It is actually the average Kullback–Leibler divergence over spatial positions., and denotes the spatial logits of . Since these self-supervisions regularize the network either to identify the specific pasted location or to produce the same spatial logits in the pasted region, these can lead to spatially consistent feature representations and accordingly, improved performances. Note that we update the network through the gradients only from .

3.3 Self-Distillation Loss

Since one can insert the proposed SAOL in the existing CNNs, we utilize both the previous GAP-FC based output layer and SAOL, as shown in Figure 2, during training. Specifically, we come up with knowledge transfer from SAOL to the existing output layer. For this, we devise a self-distillation loss with the two final output logits separately obtained by the two output layers from a given input image, as follows:

(6)

where is the relative weight between the two loss terms, which was similarly used in other self-distillation methods [zhang2019self-distill, lee2019rethinking]. We set . At test-time, we take only one of the two output modules to produce the classification result. If we select the GAP-FC based output layer, we can improve the classification performances of the exiting CNNs without computational tax at test time, although it is negligible.

In the end, the final loss that we use during training is defined as

(7)

where further improvement may be possible using different ratios of losses.

4 Experiments

We evaluate our SAOL with self-supervision and self-distillation compared to the previous methods. We first study the effects of our proposed method on several classification tasks in Section 4.1. Then, to conduct a quantitative evaluation for the obtained attention map, WSOL experiments were performed in Section 4.2.

All experiments were implemented in PyTorch

[paszke2017automatic], by modifying the official CutMix source code333https://github.com/clovaai/CutMix-PyTorch. For a fair comparison, we tried not to change the hyper-parameters from baselines such as CutMix [yun2019cutmix] and ABN [abn]. We simultaneously trained both of SAOL and the GAP-FC based output layer via the proposed self-distillation loss in an end-to-end manner. At test time, we obtained the classification results by either SAOL or the GAP-FC based output layer.

4.1 Image Classification Tasks

4.1.1 CIFAR-10, CIFAR-100 Classification

Baseline Ours
Model GAP-FC SAOL self-distilled GAP-FC
Wide-ResNet 40-2 [wide-resnet] 94.80 95.33 (+0.53) 95.31 (+0.51)
Wide-ResNet 40-2 + CutMix [yun2019cutmix] 96.11 96.44 (+0.33) 96.44 (+0.33)
Wide-ResNet 28-10 [wide-resnet] 95.83 96.44 (+0.61) 96.42 (+0.59)
Wide-ResNet 28-10 + CutMix [yun2019cutmix] 97.08 97.37 (+0.29) 97.36 (+0.28)
ResNet-110 [resnet_cvpr] 93.57* 95.18 (+1.61) 95.06 (+1.49)
ResNet-110 + CutMix [yun2019cutmix] 95.77 96.21 (+0.44) 96.17 (+0.40)
DenseNet-100 [densenet] 95.49* 95.31 (-0.18) 95.35 (-0.14)
DenseNet-100 + CutMix [yun2019cutmix] 95.83 96.27 (+0.44) 96.19 (+0.36)
PyramidNet200 + ShakeDrop [shakedrop] 97.13 97.33 (+0.20) 97.31 (+0.18)
PyramidNet200 + ShakeDrop + CutMix [yun2019cutmix] 97.57 97.93 (+0.36) 97.92 (+0.35)
Table 1: Classification Top-1 accuracies (%) on CIFAR-10. Results from the original papers are denoted as *.
Baseline Ours
Model GAP-FC SAOL self-distilled GAP-FC
Wide-ResNet 40-2 [wide-resnet] 74.73 76.50 (+1.77) 76.18 (+1.45)
Wide-ResNet 40-2 + CutMix [yun2019cutmix] 78.21 79.53 (+1.32) 79.04 (+0.83)
Wide-ResNet 28-10 [wide-resnet] 80.13 80.89 (+0.76) 81.16 (+1.03)
Wide-ResNet 28-10 + CutMix [yun2019cutmix] 82.41 83.71 (+1.30) 83.71 (+1.30)
ResNet-110 [resnet_cvpr] 75.86* 77.15 (+1.29) 77.23 (+1.37)
ResNet-110 + CutMix [yun2019cutmix] 77.94 78.02 (+0.08) 77.94 (+0.00)
DenseNet-100 [densenet] 77.73* 76.84 (-0.89) 76.25 (-1.48)
DenseNet-100 + CutMix [yun2019cutmix] 78.55 79.25 (+0.70) 78.90 (+0.35)
PyramidNet200 + ShakeDrop [shakedrop] 84.43 84.72 (+0.29) 84.95 (+0.52)
PyramidNet200 + ShakeDrop + CutMix [yun2019cutmix] 86.19 86.95 (+0.76) 87.03 (+0.84)
Table 2: Classification Top-1 accuracies (%) on CIFAR-100. Results from the original papers are denoted as *.

The first performance evaluation for image classification is carried out on CIFAR-10 and CIFAR-100 benchmark [cifar], one of the most extensively studied classification tasks. We used the same hyper-parameters for Wide-ResNet [wide-resnet] from AutoAugment [cubuk2018autoaugment]. ResNet and DenseNet models were trained with the same settings for ABN [abn] to compare each other. For PyramidNet200 (widening factor ), we used the same hyper-parameters used in CutMix [yun2019cutmix], except for the learning rate and its decay schedule. We used 0.1 as the initial learning rate for cosine annealing schedule [cosine-anneal]. While our baselines did not obtain much better results with this slight change, the proposed SAOL achieved noticeable performance improvements. Every experiment was performed five times to report its average performance.

Table 2 and Table 2 compare the baseline and the proposed method on CIFAR-10 and CIFAR-100, respectively. The proposed SAOL outperformed the baseline consistently across all models except DenseNet-100. In addition, in most cases for CIFAR-10, SAOL gave clear improvements over self-distilled GAP-FC. However, our self-distilled GAP-FC was also consistently better than the baseline. This means that even without spatial supervision such as object localization label, SAOL can learn spatial attention appropriately and eventually performs better than averaging features. This consistent improvement was also retained when we additionally used CutMix during training.

We also compare SAOL with recently proposed ABN [abn]. There are similarities between the two methods in respect of using the attention map. However, SAOL uses the attention map to aggregate spatial output logits. In contrast, ABN makes use of the attention mechanism only on the last feature maps and adapts the previous GAP-FC layer. For ResNet-110 and DenseNet-100, we trained models with the same hyper-parameters used in ABN. ResNet-110 and DenseNet-100 with ABN achieved the accuracies of 95.09%, 95.83% on CIFAR-10 and 77.19%, 78.37% on CIFAR-100, respectively. These results indicate that models with SAOL perform much better than models with ABN. We emphasize that ABN also requires more computations. To be specific, ResNet-110 with ABN requires 5.7 GFLOPs, while ResNet-110 with SAOL only requires 2.1 GFLOPs. As the original ResNet-110 computes as much as 1.7 GFLOPs, not only SAOL is more effective and efficient than ABN, but also it provides a way to keep the amount of computation intact through self-distillation.

4.1.2 ImageNet Classification

Baseline Ours
Model GAP-FC SAOL self-distilled GAP-FC
ResNet-50 [resnet_cvpr] 76.32 / 92.95* 77.11 / 93.59 76.66 / 93.25
ResNet-50 + CutMix [yun2019cutmix] 78.60 / 94.10* 78.85 / 94.24 78.09 / 94.00
ResNet-101 [resnet_cvpr] 78.13 / 93.71* 78.59 / 94.25 78.22 / 93.82
ResNet-101 + CutMix [yun2019cutmix] 79.83 / 94.76* 80.49 / 94.96 80.24 / 94.84
ResNext-101 [resnext] 78.82 / 94.43* 79.23 / 95.03 79.23 / 94.97
ResNext-101 + CutMix [yun2019cutmix] 80.53 / 94.97* 81.01 / 95.15 80.81 / 95.03
ResNet-200 [resnet_cvpr] 78.50 / 94.20 79.31 / 94.54 78.92 / 94.37
ResNet-200 + CutMix [yun2019cutmix] 80.70 / 95.20 80.82 / 95.19 80.73 / 95.21
Table 3: ImageNet classification Top-1 / Top-5 accuracies (%). Results from the original papers are denoted as *.

We also evaluate SAOL on ILSVRC 2012 classification benchmark (ImageNet) [imagenet] which consists of 1.2 million natural images for training and 50,000 images for validation of 1,000 classes. We used the same hyper-parameters with CutMix [yun2019cutmix]. For faster training, we just changed the batch size to 4,096 with a linearly re-scaled learning rate and a gradual warm-up schedule, as mentioned in [facebook1hour]. We also replaced all convolutions in SAOL with depthwise-separable convolutions [howard2017mobilenets] to reduce computations. We found that in many situations, this convolution change made a marginal difference in performances.

Table 3 shows performances with diverse architectures. We quoted results from the CutMix paper except for ResNet-200, which was not tested by CutMix. We trained all models with the same hyper-parameters for a fair comparison. Our results indicate that models with SAOL outperformed the models with GAP-FC consistently. For example, ResNet-101 architecture trained with CutMix regularization scored 79.83% of top-1 accuracy, which is improved from 78.13% without CutMix. For both cases, SAOL further improves the model by 0.46% and 0.66% without and with CutMix, respectively. We remark that adding our SAOL requires 6% more computations only (from 7.8 GFLOPs to 8.3 GFLOPs), which is efficient compared to the previous methods. As shown in Figure 4, SAOL performed better than both of Residual Attention Network [fei2017cvpr] and ABN [abn], especially even with much smaller computational cost.

Figure 4:

Comparison of different attention models on ImageNet. Attention layers are added on the same ResNet-200 backbone. Our model (SAOL) outperforms previous methods

[abn, fei2017cvpr] using negligible computational overhead.

4.1.3 Ablation Study

In this section, we conduct ablation experiments for many factors in SAOL to measure their contributions towards our outperforming results.

Effectiveness of Multi-level Feature Aggregation for Spatial Logits. SAOL uses features not only from the last convolution block but from multiple intermediate blocks for producing the spatial logits. In detection and segmentation tasks, majority of works [chen2018encoder][ronneberger2015unet][DeepLab][feature-pyramid-net] similarly used multiple feature layers in a decoder to be more size-invariant. We experimented on CIFAR-100 to verify performance changes according to different numbers of features to be combined to generate the spatial logits for SAOL, and Table 4 shows the obtained results. Performances tend to be improved with more feature layers for spatial logits.

WResNet 40-2 WResNet 28-10
Conv Block 3 75.68 79.99
Conv Block 2+3 76.18 80.70
Conv Block 1+2+3 76.50 80.89
Table 4: Performance comparisons on CIFAR-100 according to different combinations of feature blocks used for producing the spatial logits. WResNet stands for Wide-ResNet. Wide-ResNet has three convolutional blocks, and we denote the th block as Conv Block .

Effectiveness of Self-Supervision. To verify the benefits from the proposed two self-supervised losses, we conducted experiments with Wide-ResNet 40-2 on CIFAR-10 and CIFAR-100 (C-100), and the results are shown in Table 5. Similar to the baseline model, SAOL was also improved with the original CutMix regularization alone. However, additional incorporating or further enhanced the performances. Using both of self-supervised losses with SAOL led to the best performance.

CIFAR-10 C-100
Baseline (GAP-FC) 94.80 74.73
Baseline + CutMix 96.11 78.21
Baseline + CutMix + 96.04 78.14
SAOL 95.33 76.50
SAOL + CutMix 96.21 78.44
SAOL + CutMix + 96.19 78.92
SAOL + CutMix + 96.30 78.60
SAOL + CutMix + + 96.44 79.53
Table 5: Influences of CutMix and its additional self-supervised losses for Wide-ResNet 40-2 on CIFAR-10/100.

Note that we also tried to use on the baseline. For this, we attached an auxiliary layer on the last convolution block to produce a spatial map predicting the CutMix region and trained the original image classification loss and jointly. As a result, the use of did not improve the performance of the baseline. We conjecture that SAOL worked well with since it tried to learn the attention map for classification outputs simultaneously. We leave a more detailed investigation of this for future work.

Effectiveness of Self-Distillation. We also conducted experiments on CIFAR-100 to measure the effectiveness of our self-distillation. Instead of distilling outputs from SAOL, the standard cross-entropy (CE) loss was solely applied to the GAP-FC auxiliary layer during training. The results are shown in Table 6. Irrespective of the selected output layer at test time, training both of SAOL and the GAP-FC based output layer with the same CE loss led to performance drop compared to the use of our self-distillation loss , even though it still outperformed the baseline. This indicates that the knowledge transfer from robust SAOL to the conventional GAP-FC based output layer by our self-distillation is beneficial to performance improvement.

WResNet 40-2 WResNet 28-10
SAOL GAP-FC SAOL GAP-FC
Baseline N/A 74.73 N/A 80.13
CE 75.75 75.28 80.36 80.21
76.50 76.18 80.89 81.16
Table 6: Evaluation on the effectiveness of self-distillation.

4.2 Weakly-Supervised Object Localization Task

Model Method GFLOPs Backprop. CUB200-2011
Loc Acc (%) ImageNet
Loc Acc (%)
ResNet-50 [resnet_cvpr] CAM [CAM] 4.09 O 49.41* 46.30*
ResNet-50 [resnet_cvpr] + CutMix [yun2019cutmix] CAM [CAM] 4.09 O 54.81* 47.25*
ResNet-50 [resnet_cvpr] ABN [abn] 7.62 X 56.91 44.65
ResNet-50 [resnet_cvpr] + CutMix [yun2019cutmix] SAOL (Ours) 4.62 X 52.39 45.01
Table 7: Weakly supervised object localization results on CUB200-2011 test set and ImageNet validation set. The asterisk * indicates that the score is from the original paper.
Figure 5: Qualitative analysis of attention maps by SAOL with ResNet-50. From the left: CutMix-ed image, spatial attention map, heatmap of spatial output logit for top-2 classes. (a) Examples that previous CutMix model [yun2019cutmix] failed to correctly predict objects with top-2 classes’ scores. (b) Examples that previous CutMix model predicted small objects over-confidently.

To evaluate the spatial attention map by SAOL quantitatively, we performed experiments with ResNet-50 models for the tasks of WSOL. We followed the evaluation strategy of the existing WSOL method [CAM]

. A common practice in WSOL is to normalize the score maps using min-max normalization to have a value between 0 and 1. The normalized output score map can be binarized by a threshold, then the largest connected area in the binary mask is chosen. Our model was modified to enlarge the spatial resolutions of the spatial attention map and spatial logits to be

from and finetuned ImageNet-trained model. The obtained spatial attention map and spatial logits are combined as an elemental-wise product to yield a class-wise spatial attention map.

As the result are shown in Table 7, our method achieves competitive localization accuracy on ImageNet and CUB200-2011 [CUB_200_2011], compared to previous well-performing methods [choe2019attention-drop-wsol, yun2019cutmix]. It is noticeable that our competitive method requires much fewer computations to generate an attention map for object localization. While it is common to use CAM [CAM], burdensome backward-pass computations are unavoidable. Recently proposed ABN [abn] can produce an attention map with the single forward pass; however, it modifies the backbone network with a computationally-expensive attention mechanism. SAOL adds much less computational taxes while it performs competitively. We also emphasize that our results were obtained without any sophisticated post-processing, which is required by many WSOL methods. Utilizing sophisticated post-processing as well as training with a larger attention map may improve the result further.

Figure 5 visualizes the spatial attention map and the spatial logits obtained by SAOL on CutMix-ed image. Our spatial attention map focuses on the regions corresponding to the general concept of objectness. On the other hand, the spatial output logits show class-specific activation maps which have high scores on the respective target object regions. In the situation where two objects are mixed, the attention map by SAOL localizes each object well, and moreover its scores reflect the relative importance of each object more accurately.

5 Conclusion

We propose a new output layer for image classification, named spatially attentive output layer (SAOL). Outputs from the novel two branches, spatial attention map and spatial logits, generate the classification outputs through an attention mechanism. The proposed SAOL improves the performances of representative architectures for various tasks, with almost the same computational cost. Moreover, additional self-supervision losses specifically designed for SAOL also improve the performances further. The attention map and spatial logits produced by SAOL can be used for weakly-supervised object localization (WSOL), and it shows promising results not only for WSOL tasks but also towards interpretable networks. We will continue this research to develop better decoder-like output structures for image classification tasks and to explore a more sophisticated use of self-annotated spatial information without human labor.

References