## 2 Frequency Domain Filtering of Overlapping Patches
### Frequency Domain Filtering of Overlapping Patches
After a neural network develops its weights through the learning process, it should be used to filter images. To extract patches from an image, we use a window of size \(m\times n\). By moving this window across the image using steps \(s_{x}\) and \(s_{y}\) (where \(s_{x}\) corresponds to the step along the \(x\)-axis and \(s_{y}\) to the step along the \(y\)-axis), we extract the intensities contained within the window into a patch. As a result of this operation, a set of overlapping patches is generated if \(s_{x}<m\) and \(s_{y}<n\). This procedure is illustrated in Figure 2.  
For the reader's convenience, we provide an algorithm (Algorithm 1) for extracting a set of overlapping patches from an image to be processed. It should also be mentioned that the provided algorithm describes the process of building a set of patches for the actual image filtering process. ```
1:Input:
2:\(I\): An image of size \(M\times N\)
3:\(m\): The patch width
4:\(n\): The patch height
5:\(s_{x}\): The step size along \(x\)-axis
6:\(s_{y}\): The step size along \(y\)-axis
7:Output:
8: P: A set of overlapping patches
9:Procedure:
10:\(P\leftarrow\emptyset\)
11:for\(i\gets 1\) to \(M-m\) by \(s_{x}\)do
12:for\(j\gets 1\) to \(N-n\) by \(s_{y}\)do
13: Extract a patch \(p\): \(p\gets I[i:i+m,j:j+n]\)
14:\(P\gets P\cup\{p\}\)
15:endfor
16:endfor
17:return\(P\)
```  
**Algorithm 1** Extracting a set of overlapping patches from the input image  
Since we perform processing in the frequency domain, after a set of overlapping patches \(P\) is built, we need to create \(P_{\mathcal{F}}\)--a set of Fourier transforms of these patches--in the following way:  
\[P_{\mathcal{F}}=\bigg{\{}\frac{1}{nm}\mathcal{F}(p)\biggm{|}p\in P\bigg{\}}.\]  
Figure 2: Process of extracting overlapping patches from image. The vectorized Fourier transform \(p_{\mathcal{F}}\in P_{\mathcal{F}}\) should be used as an input sample for MLMVN. As was mentioned above, we employ a shallow MLMVN with a \(k-q-k\) topology for processing frequency domain data. This means that a neural network consists of an input layer with \(k\) inputs, a single hidden layer with \(q\) neurons, and an output layer with \(k\) neurons. The number of inputs \(k\), which is also equal to the number of neurons in the output layer, depends on the size of the image fragments being processed (\(k=mn\)). The number of hidden neurons \(q\) should be determined based on experimental testing. It is important to make a remark about activation functions, which we use in our network. Two activation functions have been considered so far for MVNs--discrete and continuous ones. But both these functions project a weighted sum of MVNs onto the unit circle [46]. In MLMVN, which is used here, all hidden neurons employ a standard continuous MVN activation function \(f(z)=\frac{z}{|z|}\). At the same time, neither discrete nor continuous activation functions producing an output located on the unit circle can be used for output layer neurons. As our goal is to use MLMVN to estimate the Fourier transform of a clean patch, output neurons should produce an output not necessarily located on the unit circle. This requires the use of a different type of activation function capable of producing an output with an arbitrary (not necessarily unitary) magnitude. We used three such activation functions in our experiments: a linear activation function (when a weighted sum becomes an output), a complex-valued sigmoid activation function, and complex-valued hyperbolic tangent activation function. The respective results and analysis of the network behavior with all three of these activation functions are presented in Section 3. As a result of processing elements of \(P_{\mathcal{F}}\) with a neural network, we obtain a set of vectorized filtered overlapping patches \(\tilde{P}_{\mathcal{F}}\) in the frequency domain.