# Data Augmentation Method for Plant Leaf Disease Recognition
## 3 Materials and Methods
### Pre-Activation Residual Attention Block  
In the initial training stage, the generator of CycleGAN attempts to transform the entire image region evenly and indiscriminately and learns to deceive the discriminator. This also includes background areas that are unnecessary for transformation. Moreover, CycleGAN lacks an attention mechanism, so the generator cannot discern the features that should be considered more important in the translation between the two domains. Due to these problems, the generator requires an exceptionally long learning time to accurately reflect the texture of the target domain.  
To solve this problem, we adopt CBAM and propose a Pre-activation Residual Attention Block (PaRAB), which allows adaptive feature refinement for the given feature responses by explicitly modeling the interdependence including the channel and spatial. As shown in Figure 2, PaRAB is configured by deploying an attention module before combining the output of the pre-activation residual and the low-level features delivered via skip connection. We construct a generator network through PaRAB and train the learnable parameters of the attention module using an adversarial loss function. This allows the generator to selectively emphasize features that are advantageous for deceiving the discriminator while suppressing less important ones. As a result, the generator can create an image that clearly shows the texture of the target domain.  
As shown in Figure 3, the two sub-modules within the PaRAB are calculated sequentially, and the attention process takes the feature map \(F\in\mathbb{R}^{C\times H\times W}\) as an input to generate a channel attention map \(M_{c}\in\mathbb{R}^{C\times 1\times 1}\) and a spatial attention map \(M_{s}\in\mathbb{R}^{1\times H\times W}\), which  
Figure 2: Pre-activation Residual Attention Block (PaRAB).  
are used by multiplying them sequentially with each given input. The attention module is placed after the second instance normalization layer. These attention processes are as follows:  
\[\begin{array}{c}F^{\prime}=M_{\text{C}}(F)\;\otimes\;F\\ F^{\prime}=M_{\text{S}}(F^{\prime})\;\otimes\;F^{\prime}\end{array} \tag{1}\]  
The channel attention module integrates the information of a given input feature \(F\) to generate an attention map \(M_{\text{c}}\) that models the interdependence between channels. These calculations are performed through average pooling and max pooling operations, and they generate channel descriptions \(F^{c}_{avg}\in\mathbb{R}^{C\times 1\times 1}\) and \(F^{c}_{max}\in\mathbb{R}^{C\times 1\times 1}\). The calculated two-channel descriptions pass through the shared network with a bottleneck compressed by a reduction ratio \(r\), and then add up to finally obtain the channel attention map \(M_{\text{c}}\) through the sigmoid function. These channel attention processes are as follows:  
\[M_{\text{c}}(F)=\sigma\left(MLP\big{(}P_{avg}(F)\big{)}+MLP(P_{max}(F))\right) \tag{2}\]  
The spatial attention module integrates the information of a given input feature \(F\) to generate an attention map \(M_{s}\) that models the interdependence between spatial. These calculations are performed through average pooling and max pooling operations, and they generate spatial descriptions \(F^{s}_{avg}\in\mathbb{R}^{1\times H\times W}\) and \(F^{s}_{max}\in\mathbb{R}^{1\times H\times W}\). Then, by integrating the two spatial descriptions, the model finally obtains the spatial attention map \(M_{s}\) using the sigmoid activation function after a \(7\times 7\) convolution. These spatial attention processes are as follows:  
\[M_{s}(F)=\sigma\left(f^{\prime\times 7}\big{(}[P_{avg}(F);\;P_{max}(F)]\big{)}\right) \tag{3}\]  
Since the two sub-modules proceed sequentially, the execution order can be changed arbitrarily. The authors report that, in general, using the channel attention module first showed better performance, and in this case, the input of the spatial attention module, used later, corresponds to \(F^{\prime}\in\mathbb{R}^{C\times H\times W}\).