# McAW-YOLO: An Efficient Detection Model for Ceramic Tile Surface Defects
## 3 MCAW-YOLO Network Model
### Lightweight Attention Mechanism  
During the tile-production process, there were often some difficult-to-identify defects. These defects were usually minor in size, had weak features, provided limited information, or had a high similarity to the background, making them difficult to distinguish and resulting in a challenging detection task. However, depth-wise separable convolution could only perform convolution within each channel, limiting information interaction between different channels and reducing the expressive power.  
Therefore, this paper introduced a normalization-based attention module (NAM) [22] into ghost shuffle convolution. It did not require additional calculations or parameters, such as fully connected layers or convolutions. Instead, it directly used the scaling factors in batch normalization to calculate attention weights. This module was referred to as GSAConv module, as shown in Figure 5. The limitations of depth-wise separable convolution in terms of lacking inter-channel correlation information were addressed by introducing channel attention. This allowed the model to automatically learn the importance of different positions and adaptively adjust the weight of the feature map based on the characteristics of the input data. As a result, the model could focus on more important features, reduce the false-negative rate of minor defects, decrease the interference of irrelevant information, and lower the false-positive rate.  
Specifically, the normalization-based attention mechanism avoided using fully connected or convolutional layers, reducing the number of parameters and computational complexity. NAM measured channel variations by calculating the scaling factors using batch normalization, as shown in Equation (1). A more prominent scaling factor indicated more significant variations, richer information, and greater importance in the features. Conversely, a weaker scaling factor indicated less diverse feature information and lower importance. The structures of NAM were shown in Figure 6.  
Figure 4: PGSC3 module.  
Figure 5: Structure of GSAConv module.  
Figure 6: Normalization-based attention module.  
After calculating the attention weights \(w_{r}\), the sigmoid function was applied to obtain the weight coefficients \(M_{c}\). These weight coefficients were then multiplied with the original features to obtain new features that reflect the importance of the information. The calculation of the attention module based on batch normalization was shown in Equation (1).  
\[\begin{split} B_{\text{out}}=BN(B_{\text{in}})=r\frac{B_{\text{in }}-\mu_{B}}{\sqrt{\sigma_{B}^{2}+\epsilon}}+\beta\\ M_{c}=sigmoid(w_{r}(BN(F_{1})))\\ \bar{F}_{2}=M_{c}*F_{1}\end{split} \tag{1}\]  
In this equation, \(\mu_{B}\) and \(\sigma^{2}{}_{B}\) represented the mean and variance of the minimum batch, respectively. \(r\) and \(\beta\) were trainable affine transformation parameters. \(F_{1}\) was the input feature map to the model, and \(F_{2}\) was the output feature map. \(w_{r}=r_{i}/\sum_{j=0}r_{j}\) represented the weight of each channel.