# Fourier Domain Adaptation for the Identification of Grape Leaf Diseases
## 2 Materials and Methods
### Methods
#### 2.2.2 Fourier Domain Adaptation  
To facilitate discussion, we first introduce some notation. The source dataset is defined as \(D^{s}=\big{\{}\big{(}x_{i}^{s},y_{i}^{s}\big{)}\sim P(x^{s},y^{s})\big{\}}_{i=1}^{ N_{i}}\), where \(x^{s}\in\mathbb{R}^{H\times W\times 3}\) is a color image of grape leaves and \(y^{s}\in\mathbb{R}\) is the category label related to \(x^{s}\) described as having two domains, S for the source and T for the target. The target dataset, which lacks category labels, is denote as \(D^{t}=\big{\{}\big{(}x_{i}^{t}\big{)}\big{\}}_{i=1}^{N_{i}}\). Typically, when the recognition network trained on \(D^{s}\) tries on \(D^{t}\), its performance will decrease. In order to diminish the domain gap between the two domains, we propose Fourier domain adaptation for the identification of grape leaf diseases.  
\(\mathcal{F}^{A}:\mathbb{R}^{H\times W\times 3}\) and \(\mathcal{F}^{P}:\mathbb{R}^{H\times W\times 3}\) represent the amplitude and phase of an RGB image Fourier transform \(\mathcal{F}\), respectively. For the image \(x\), the transformation is shown in Formula (1) as follows:  
\[\mathcal{F}(x)(m,n)=\sum_{h,w}x(h,w),^{-2\pi(\frac{h}{2}m+\frac{\beta}{2}n)},j ^{2}=-1 \tag{1}\]  
which the FFT method may implement effectively. \(\mathcal{F}^{-1}\) is the inverse Fourier transform that returns the phase and amplitude of spectral signals to picture space. All images are in RGB format, so the red channel, green channel, and blue channel are used as independent two-dimensional signals, respectively, and then 2D FFT is applied to each channel. In this way, the characteristics and spectral information of each color channel can be analyzed in the frequency domain to support subsequent image processing and analysis. Additionally, we represent a mask with \(M_{\beta}\), whose value is zero except for the central region where \(\beta\in(0,1)\).  
\[M_{\beta}(h,w)=1_{(h,w)\in[-\beta H;\beta H,-\beta H;\beta H]} \tag{2}\]  
here, we will suppose that (0,0) is the image's center. Because \(\beta\) is not measured in pixels, selecting \(\beta\) is independent of the size or resolution of the image. There are two randomly selected photo definitions of \(x^{s}\sim D^{s},\ x^{t}\sim D^{t}\); Fourier domain adaptation is represented by the following Formula (3):  
\[x^{s\to t}=\mathcal{F}^{-1}\Big{(}\Big{[}M_{\beta}\circ\mathcal{F}^{A} \big{(}x^{t}\big{)}+\big{(}1-M_{\beta}\big{)}\circ\mathcal{F}^{A}(x^{s}), \mathcal{F}^{P}(x^{s})\Big{]}\Big{)} \tag{3}\]  
in the formula, \(x^{t}\) is the target image, which takes the place of the source image's low-frequency portion of its amplitude. \(\mathcal{F}^{A}(x^{s})\) is the source image. The picture \(x^{s\to t}\), whose  
Figure 2: Spectral transfer of grape disease leaf image.  
content is identical to \(x^{s}\) but will resemble the appearance of a sample from \(D^{t}\), is then projected back to the changed spectral representation of \(x^{t}\), with its phase component unaltered. The mask \(M_{\beta}\), which is depicted in green in Figure 2, shows the procedure.  
According to Equation (3), \(\beta=0\), \(x^{s\to t}\) will be rendered exactly as the original source image \(x^{s}\). On the other hand, the amplitude of \(x^{s}\) will be replaced by that of \(x^{t}\) when \(\beta=1.0\). Figure 3 shows how \(\beta\) is an impact. The image \(x^{s\to t}\) approaches the goal image \(x^{t}\) as \(\beta\) approaches 1.0 but also shows noticeable artifacts, as can be seen from the enlarged blue and yellow boxes area in Figure 3. We choose \(\beta\leq 0.15\). But in Table 1, similar to a straightforward multi-scale pooling strategy, we display the impact of various \(\beta\) selections along with the average of the generated models.