# Improved MSRN-Based Attention Block for Mask Alignment Mark Detection in Photolithography
## 3 Improved MSRN-Based Attention Block
### Msrab  
Through two-scale convolution filters, multiple bypass networks are used to find image features at different scales. Figure 7 shows the structure of the Multiscale Residual Attention Block. In the existing multiscale feature extraction module, different channels and different location information in space are provided. The feature map generated at each step is connected to the CBAM module through multiple M blocks. Through this, by combining the location information and context information of various layers, important information in the image can be conveyed well, and an accurate prediction is obtained by obtaining a clear image.  
The purpose is to utilize the attention module to focus on a specific area of the image to improve the performance of the model. Characteristics extracted from convolution are mixed with various types of information, and there is a great deal of unnecessary information duplication, which can limit the performance of SISR. To extract image features, convolution kernels and different bypasses were constructed.  
The implementation of the multiscale residual block is defined as follows:  
\[K_{11}=\sigma(w_{3\times 3}^{1}\times M_{n-1}) \tag{2}\]  
\[K_{12}=\sigma(w_{5\times 5}^{1}\times M_{n-1}) \tag{3}\]  
\[K_{21}=\sigma(w_{3\times 3}^{2}\times(K_{11},K_{12}) \tag{4}\]  
\[K_{22}=\sigma(w_{5\times 5}^{2}\times(K_{11},K_{12}) \tag{5}\]  
\[K^{\prime}=w_{1\times 1}^{3}\times A_{c}\cdot A_{s}(K_{21},K_{22}) \tag{6}\]  
\[K_{n}=w_{1\times 1}\times A_{c}\cdot A_{s}(K_{0},K_{1},K_{2}\cdots,K_{n-1}) \tag{7}\]  
Several residual blocks are stacked together to form a residual group, and then hierarchical features are fused in the bottleneck hierarchy; all feature maps are sent to a \(1\times 1\) convolutional layer and then passed through CBAM. Channel attention is transferred to the average pooling step. For each step, M blocks represent the number of functional maps passed to MSRAB. The input and output of the first convolutional layer move to the next  
Figure 6: Structure of the proposed model.  
convolutional layer through the extraction map. M blocks combined by attention block are defined as follows:  
\[M_{n}=K^{\prime}+M_{n-1} \tag{8}\]  
CBAM applies channel attention and spatial attention as shown in Figure 7. This process is defined as  
\[F^{\prime}=A_{c}(F)\otimes F \tag{9}\]  
\[F^{\prime\prime}=A_{s}\big{(}F^{\prime}\big{)}\otimes F^{\prime\prime} \tag{10}\]  
Spatial information is extracted using Average pooling and Max pooling to extract descriptors \(F^{c}_{avg}\) and \(F^{c}_{max}\). Then, through Max pooling, object features that are clearly distinguished from others are captured. The output of MLP for each descriptor derives the final output through an element-wise sum.  
The above processes can be defined as follows:  
\[A_{c}(F)=\sigma(MLP(AvgPool(F))+MLP(MaxPool(F))) \tag{11}\]  
Descriptors \(F^{c}_{avg}\) and \(F^{c}_{max}\) are extracted from channel information using Average pooling and Max pooling. After concatenating \(F^{c}_{avg}\) and \(F^{c}_{max}\), the attention weight is calculated with one filter with a size of \(7\times 7\).  
The above sequence of processes can be defined as follows:  
\[A_{s}(F)=\sigma(f^{7\times 7}([AvgPool(F);MaxPool(F)])) \tag{12}\]  
As the layer of the MSRAB overall model becomes deeper, the method is designed to solve the problem of poor performance due to gradient vanishing and exploding problems. In this study, since the residual block is used for each step, the problem of performance degradation of the model was solved and improved. In addition, it can help the model extract many features from every layer. The two modules of channel attention and spatial attention are combined. In this study, attention blocks were used for each residual block  
Figure 7: Structure of the proposed detailed model.  
step of feature extraction to solve the problem of model performance degradation; this can help the model extract more features from every layer.