# Weakly Supervised Learning for Object Localization Based on an Attention Mechanism
## 3 Proposed WSOL Method with Adjusted Weights  
In ABN [21], the classifier used more robust features to classify by dot-producting the attention map in the attention branch to the input feature map of the perception branch. Although this approach improves the performance of the classifier, since it further strengthens the distinct characteristics of the object, it suffers from the WSOL sub-optimal problem. In this paper, the attention mechanism method used in ABN [21] is modified to improve the extracted attention map, such that the classifier and feature extractor would instead allow the possibility of identifying a larger area of the object. First, the proposedmethod is shown in Figure 3, and the differences between ABN [21] and the proposed method are briefly shown in Figure 4.  
The method is now described in detail. For input image \(X\), the upper classifier after the feature extractor computes the probability that the input image belongs to each class using the feature map extracted from the feature extractor as input, and then creates attention map \(M(X)\). Since the generated attention map \(M(X)\) is a feature that is deemed important for prediction by the upper classifier, the lower classifier of the model uses a method to compensate for the large value of the attention map extracted from the upper classifier. This method can be described as Equation (5). Figure 4: Differences between ABN [21] and the proposed method: (**a**) ABN, (**b**) proposed method. (**a**) uses the class activation map method to improve the performance of the classifier. However, this method gives a greater weight to the robust feature map in the training process. Therefore, this method encounters a sub-optimal problem in the field of object localization. On the other hand, our proposed method (**b**) creates a new feature map by reducing the high value so that it can learn areas other than the area used in the upper classifier. Figure 3: Structure of the proposed method. \[ \begin{split} M_{c}^{\prime}(x,\ y)=M_{c}(x,y)-\overline{M_{c}(x,y)}\\ \text{where,}\ \ \ M_{c}(x,y)>\overline{M_{c}(x,y)}\\ \overline{M_{c}(x,y)}=\left(\frac{1}{H\times W}\sum\limits_{y=0} ^{H-1}\sum\limits_{x=0}^{W-1}M_{c}(x,y)\right)\end{split}  \tag{5}\]  
The elements of \(M_{c}^{\prime}(x,\ y)\) are formed by a process of significant reduction in the highlighted values of the attention map \(M_{c}(x,\ y)\), and the attention map extracted from the upper branch of Figure 2 becomes the area used mainly by the classifier of the upper branch. In this respect, the approach is identical to that in the paper for CAM [1], and also encounters the sub-optimal localization problem, as shown in Figure 4. Thus, we created an attention map that is a new \(M^{\prime}\) by mitigating the elements of \(M\) greater than \(\frac{1}{H\times W}\sum\limits_{y=0}^{H-1}\sum\limits_{x=0}^{W-1}M_{c}(x,y)\), as in Equation (5). Here, when generating \(M^{\prime}\) that mitigates \(M\), we replaced only those pixels larger than the average by taking a difference from the average. In fact, besides this particular approach, we also experimented with a variety of other architectural schemes to deemphasize the large values for better distribution. Among all the schemes considered that included the inversion of large and small values of the attention map \(M\) of the upper classifier and the replacement of the large values with 0, the proposed method showed the best results. Subsequently, by dot-producing the feature map extracted from the feature extractor, the feature map could be provided as the input value to the bottom branch, such that the input feature map of the bottom branch could be written as Equation (6). \[g_{c}^{\prime}(x_{i})=\left(1+M^{\prime}(x_{i})\right)\cdot g_{c}(x_{i}) \tag{6}\]  
Unlike ABN [21], the proposed method leaves open the possibility of learning different features of the top branch by providing a feature map that mitigates the robustly used features in the top classifier being used as inputs to the bottom classifier.