## 2 Materials and Methods
### PBD-YOLO Algorithm Architecture
#### 2.4.3 SPDDEConv Module  
Modern neural networks typically incorporate down-sampling structures to generate multi-scale feature maps and learn the characteristics of defects across various sizes. YOLOv10 employs a strided convolutions to achieve down-sampling. When the image resolution is high and the object size is moderate, this strided convolution can conveniently skip a large amount of redundant information and effectively learn features. However, when there is significant scale variation in target defects, with both large and small targets present and a blurred distinction between the targets and background, this operation can lead to the loss of fine-grained information [32], resulting in a decline in accuracy and learning capability [33]. Meanwhile, the convolution kernel weights used in traditional down-sampling operations are randomly initialized, making it difficult to specifically enhance the features of defect edges, which affects the model's ability to recognize defects with low contrast and sparse texture features.  
The SPDDEConv module was proposed to address these challenges, where space-to-depth convolution [21] and difference convolution were integrated, enabling enhanced edge feature preservation while high down-sampling efficiency was retained.  
The structure of the SPDDEConv module is depicted in Figure 9. The input feature image \(X\in\mathbb{R}^{S\times S\times C_{1}}\) was firstly partitioned in the spatial dimension, and through uniform grid sampling, it was decomposed into four sub-graphs with halved spatial dimensions:  
\[\begin{cases}f_{0,0}=X[0:2:S,0:2:S]\\ f_{0,1}=X[0:2:S,1:2:S]\\ f_{1,0}=X[1:2:S,0:2:S]\\ f_{1,1}=X[1:2:S,1:2:S]\end{cases} \tag{3}\]  
Figure 8: Structure of the SAC module.  
This method could achieve spatial compression without information loss. Subsequently, based on this, the four sub-graphs were enhanced in feature expression through different operations. The sub-graph \(f_{0,0}\) retained the original information, while the sub-graph \(f_{1,0}\) extracted horizontal edge features through horizontal difference convolution (HDC), with its weight matrix listed as follows:  
\[W_{hd}=\begin{bmatrix}w_{1}&0&-w_{1}\\ w_{2}&0&-w_{2}\\ w_{3}&0&-w_{3}\end{bmatrix}, \tag{4}\]  
where \(w_{1}\sim w_{3}\) are trainable parameters. This operation can simulate horizontal gradient computation, incorporating prior knowledge to enhance the response to horizontal edges of defects. The sub-graph \(f_{0,1}\) extracted vertical edge features through vertical difference convolution (VDC), with its weight matrix listed as follows:  
\[W_{\text{vd}}=\begin{bmatrix}w_{4}&w_{5}&w_{6}\\ 0&0&0\\ -w_{4}&-w_{5}&-w_{6}\end{bmatrix}, \tag{5}\]  
where \(w_{4}\sim w_{6}\) are trainable parameters. This convolutional operation also incorporated prior knowledge, capable of simulating vertical gradient computation, extracting vertical edges, and enhancing the response to vertical edges of defects [22]. The sub-graph \(f_{1,1}\) extracted general features through a standard \(3\times 3\) convolution. The outputs of the four branches were ultimately stacked along the channel dimension and adjusted to the required number of output channels through a \(1\times 1\) convolution, resulting in the down-sampled feature image \(F_{out}\in\mathbb{R}^{\frac{S}{2}}\frac{S}{2}\times C_{2}\).