# Fourier Ptychographic Reconstruction Method of Self-Training Physical Model
## 3 Self-Training SwinIR Network Structure
### Subnetwork Structure
#### 3.2.2 Deep Feature Extraction Module  
The module mainly reconstructs the image loss high-frequency features based on the residual SwinTransformer block (RSTB). Each RSTB block uses multiple Swin Transformer layers to implement a local attention mechanism and cross-window interaction mechanism (Cross-Windows Interaction), and a 3 \(\times\) 3 convolution layer is placed at the end for feature enhancement.  
The deep feature extraction module of the SwinIR network mainly consists of six RSTB (Residual Swin Transformer Block) blocks. Each RSTB block uses multiple Swin Transformer layers (STL) for the local attention mechanism and cross-window interaction. At the same time, a residual connection is added to each RSTB module. The purpose of adding residual connections is to enable different levels of features to be fused together to enhance the details of the image lost in one-layer feature extraction. The structure of the RSTB is shown in Figure 5.  
Figure 4: SwinIR physical model.  
In RSTB, there are six STL modules and a 3 \(\times\) 3 convolution layer. The STL module is based on the traditional standard multi-head attention mechanism, but different from the STL module, the local window attention and cyclic shift are added. The local window attention is used to reduce the computational burden caused by the global attention of the traditional transformer, and the calculation of attention is limited to each window, which is still the original multi-head self-attention in each window. Generally, a 3 \(\times\) 3 convolution layer is used to extract local adjacent information to reduce the computational cost of the network.  
Two residual connections are used in the STL layer, and the nonlinear problem is solved by a multi-layer perceptron (MLP). The LayerNorm layer is added before MSA (Multi-head Self-Attention) and MLP to ensure the stability of the data feature distribution, which can use a larger learning rate and a faster convergence speed. At the same time, the LayerNorm layer also has a certain anti-overfitting effect, which makes the training process more stable and avoids the data falling into the saturation area of the activation function to reduce the problem of gradient disappearance. The structure of the STL is shown in Figure 6.  
Extracting deep features \(F_{DF}\) from shallow features \(F_{0}\) occurs block by block.  
\[F_{DF}=H_{DF}(F_{0}), \tag{19}\]  
\[F_{DF}\in R^{H_{x}W_{x}C}\]  
\(H_{DF}\) (\(\cdot\)) is a deep feature extraction module that contains six Residual Swin Transformer blocks (RSTB) and a 3 \(\times\) 3 convolutional layer.  
The RSTB module includes a Swin Transformer layer (STL) and a convolutional layer. Given the input features of the \(i\)th module, the role of the STL layer is to extract intermediate features \(F_{i,1}\), \(F_{i,2}\)...... \(F_{i,L}\), namely:  
\[F_{i,j}=H_{STL_{i,j}}(F_{i,j}-1),\ j=1,2,\ldots\ldots,L \tag{20}\]  
\(H_{STL_{i,j}}(\cdot)\) is the \(j\)th STL layer in the \(i\)th RSTB.  
Figure 5: Residual Swin Transformer Block (RSTB).  
Figure 6: Swin Transformer Layer (STL).  
The output of the RSTB module is:  
\[F_{i,out}=H_{CONV_{i}}(F_{i,L})+F_{i,0} \tag{21}\]  
\(H_{CONV_{i}}(\cdot)\) is the convolution layer in the ith RSTB.