## 2 Methodology
### Key Technical Innovations  
#### 2.2.1 SCSA Attention Mechanism [29]  
To solve the problem of feature dilution of traditional attention (such as CBAM) on PCB small targets, the SCSA attention mechanism is introduced. SCSA (Spatial and Channel Synergistic Attention) is a novel attention mechanism designed to enhance feature extraction in visual tasks by synergizing spatial and channel dimensions. SCSA consists of two main modules: shared multisemantic spatial attention (SMSA) and progressive channel self-attention (PCSA). Its framework is shown in Figure 2, where B denotes the batch size, C represents the number of channels, and H and W correspond to the height and width of the feature mapping, respectively. The variable n indicates the number of groups into which the sub-features are divided.  
The SMSA module extracts spatial information at different semantic levels from multiple independent sub-features using a 1D convolution with multi-scale depth sharing. The  
Figure 1: Diagram of the improved network structure.  
Figure 2: Framework diagram of the SCSA attention mechanism.  
input feature map \(X\in R^{B\times C\times H\times W}\) is decomposed into two one-dimensional sequences in the height and width directions, \(X_{H}\) and \(X_{W}\), and then normalized by GroupNormalization (GN) to generate the spatial attention graph. The main calculation formula is as follows:  
\[\widetilde{X}_{H}^{i}=DWConold_{k_{i}}^{\frac{C}{K}\rightarrow\frac{C}{K}} \left(X_{H}^{i}\right) \tag{1}\]  
\[\widetilde{X}_{W}^{i}=DWConold_{k_{i}}^{\frac{C}{K}\rightarrow\frac{C}{K}} \left(X_{W}^{i}\right) \tag{2}\]  
\(\widetilde{X}^{i}\) denotes the spatial structure information of the \(i\)th sub-feature obtained after the lightweight convolution operation. \(K_{i}\) denotes the convolution kernel applied to the \(i\)th sub-feature.  
\[Attn_{H}=\sigma\left(GN_{H}^{K}\left(Concat\left(\widetilde{X}_{H}^{-1}, \widetilde{X}_{H}^{-2},\ldots,\widetilde{X}_{H}^{-K}\right)\right)\right) \tag{3}\]  
\[Attn_{W}=\sigma\left(GN_{W}^{K}\left(Concat\left(\widetilde{X}_{W}^{-1}, \widetilde{X}_{W}^{-2},\ldots,\widetilde{X}_{W}^{-K}\right)\right)\right) \tag{4}\]  
\[SMSA(X)=X_{S}=Attn_{H}\times Attn_{W}\times X \tag{5}\]  
\(\sigma(\cdot)\) means normalized Sigmoid, and \(GN_{H}^{K}(\cdot)\) and \(GN_{W}^{K}(\cdot)\) means having \(K\) along the \(H\) and \(W\) dimensions, respectively Group GN.  
The PCSA module optimizes the channel features using a progressive compression strategy and a channel self-attention mechanism. The input features are pooled and compressed, and the single-head self-attention mechanism calculates the similarity between channels. The main computational formula is as follows:  
\[X_{P}=Pool_{(7,7)}^{(H,W)\rightarrow(H^{\prime},W^{\prime})}(X_{S}) \tag{6}\]  
\[F_{proj}=DWConyld_{(1,1)}^{C\rightarrow C} \tag{7}\]  
\[Q=F_{proj}^{Q}(X_{P}),K=F_{proj}^{K}(X_{P}),V=F_{proj}^{V}(X_{P}) \tag{8}\]  
\[X_{attn}=Attn(Q,K,V)=Softmax\left(\frac{QK^{T}}{\sqrt{C}}\right)V \tag{9}\]  
\[PCSA(X_{S})=X_{C}=X_{S}\times\sigma\left(Pool_{(H^{\prime},W^{\prime}) \rightarrow(1,1)}^{(H^{\prime},W^{\prime})}(X_{attn})\right) \tag{10}\]  
\(Pool_{(k,k)}^{(H,W)\rightarrow(H^{\prime},W^{\prime})}(\cdot)\) denotes a pooling operation with kernel size \(k\times k\) for \((k,k)\), which rescales the resolution from \((H,W)\) to \((H^{\prime},W^{\prime})\). \(F_{proj}(\cdot)\) represents the linear projection that generates the query, key, and value.  
_SCSA_ realizes the synergistic effect of spatial and channel attention by connecting the _SMSA_ and _PCSA_ modules in tandem. _SMSA_ provides accurate spatial a priori information, while _PCSA_ mitigates multi-semantic discrepancies and facilitates feature fusion through the self-attention mechanism. Ultimately, the output of _SCSA_ is  
\[SCSA(X)=PCSA(SMSA(X)) \tag{11}\]