# Data Augmentation Method for Plant Leaf Disease Recognition
## 3 Materials and Methods
### Loss Function  
Image mapping functions \(G\) and \(F\) perform adversarial learning with discriminators \(D_{X}\) and \(D_{Y}\). The adversarial loss function used is the least squares loss function, and the objective function is as follows:  
\[ \begin{split}\mathcal{L}_{adv}(G,D_{Y})&=\mathbb{E }_{y\sim p_{data(y)}}\left[\left(D_{Y}\big{(}y\oplus m_{y}\big{)}-1\right)^{2} \right]+\mathbb{E}_{x\sim p_{data(x)}}\Big{[}\left(D_{Y}\big{(}G(x)\oplus m_{ x}\big{)}^{2}\right]\\ \mathcal{L}_{adv}(F,D_{X})&=\mathbb{E}_{y\sim p_{ data(y)}}\left[\left(D_{X}\big{(}x\oplus m_{x}\big{)}-1\right)^{2}\right]+\mathbb{E}_{x \sim p_{data(x)}}\Big{[}\left(D_{X}\big{(}F(y)\oplus m_{y}\big{)}^{2}\right] \end{split}  \tag{4}\]  
where \(\oplus\) denotes a concatenation channel-wise operation that is calculated using a given real image and corresponding mask data. Since the test phase does not use the discriminator, \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Layer** & **Activation** & **Normalization** & **Output Shape** \\ \hline Image \(\oplus\) Mask & - & - & (256 \(\times\) 256 \(\times\) 6) \\ Down-sample & Leaky ReLU & Spectral Normalization & (128 \(\times\) 128 \(\times\) 64) \\ Down-sample & Leaky ReLU & Spectral Normalization & (64 \(\times\) 64 \(\times\) 128) \\ Conv 1 \(\times\) 1 & Linear & - & (256 \(\times\) 256 \(\times\) 3) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Related parameter and Output shape of Discriminator. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Layer** & **Activation** & **Normalization** & **Output Shape** \\ \hline Image \(\oplus\) Mask & - & - & (256 \(\times\) 256 \(\times\) 6) \\ Down-sample & Leaky ReLU & Spectral Normalization & (128 \(\times\) 128 \(\times\) 64) \\ Down-sample & Leaky ReLU & Spectral Normalization & (64 \(\times\) 64 \(\times\) 128) \\ Down-sample & Leaky ReLU & Spectral Normalization & (32 \(\times\) 32 \(\times\) 256) \\ Conv 4 \(\times\) 4 & Leaky ReLU & Spectral Normalization & (31 \(\times\) 31 \(\times\) 512) \\ Conv 1 \(\times\) 1 & Linear & Spectral Normalization & (30 \(\times\) 30 \(\times\) 1) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Related parameter and Output shape of Generator. the mask can serve as an additional input. We confirmed that the discriminator learns more stably when provided with such additional information. In addition, the cycle-consistency loss and identity loss used for training are as follows:  
\[\mathcal{L}_{cycle}=\mathbb{E}_{x\sim p_{data(y)}}[\left|F(G(x))-x\right|_{1}]+ \mathbb{E}_{y\sim p_{data(y)}}[\left|G(F(y))-y\right|_{1}] \tag{5}\]  
\[\mathcal{L}_{ilt}=\mathbb{E}_{y\sim p_{data(y)}}[\left|G(y)-y\right|_{1}]+ \mathbb{E}_{x\sim p_{data(y)}}[\left|F(x)-x\right|_{1}] \tag{6}\]  
The purpose of the cycle-consistency loss is to limit transformations that do not reflect the characteristics of the input data. Therefore, it minimizes the difference when restoring fake images \(G(x)\) and \(F(y)\), generated from input images to the original domain. The identity loss helps preserve the color and tint of each domain. The background loss helps to prevent the transformation of the background regions between the mapped image and the input image, and is as follows:  
\[\mathcal{L}_{bg}=\mathbb{E}_{x\sim p_{data(x)}}\left[\left|m_{x}^{b}\otimes(G( x)-x)\right|_{1}\right]+\mathbb{E}_{y\sim p_{data(y)}}\left[\left|m_{y}^{b} \otimes(F(y)-y)\right|_{1}\right] \tag{7}\]  
where \(\otimes\) denotes an element-wise product operation calculated using a given real image and corresponding background mask data. Basically, the mask \(m_{x}\) represents the leaf region, so \(m_{x}^{b}=1-m_{x}\) is calculated and used for the background loss function.