## 3 Improved Network for Component Detection
### Structure of Improved-YOLOv8 model
Alternatively, we decompose the attention function into three consecutive attentions, each dedicated to concentrating on a single perspective:  
\[W(\mathcal{F})=\pi_{C}(\pi_{S}(\pi_{L}(\mathcal{F})\cdot\mathcal{F})\cdot \mathcal{F})\cdot\mathcal{F} \tag{22}\]  
Figure 7: Structure diagram of Improved-YOLOv8. where \(\pi_{L(\cdot)}\), \(\pi_{S(\cdot)}\), and \(\pi_{C(\cdot)}\) represent three distinct attention functions, each applied to dimensions \(L\), \(S\), and \(C\), respectively. This module is equipped with scale-aware attention functions across the horizontal axis, and this module seamlessly integrates a range of different scales and thus effectively adjusts to the importance of various feature intensities. The scale-aware attention functions can be expressed as:  
\[\pi_{L}(\mathcal{F})\cdot\mathcal{F}=\sigma\Bigg{(}f\Bigg{(}\frac{1}{SC}\sum_{ S,C}\mathcal{F}\Bigg{)}\Bigg{)}\cdot\mathcal{F} \tag{23}\]  
where \(f(\cdot)\) denotes a linear function that is approximated through the use of a \(1\times 1\) convolutional layer and \(\sigma(x)\) is defined as the hard-sigmoid function given by \(\sigma(x)=max(0,min(1,(x+1)/2))\). The use of the hard-sigmoid operator is a key component of the attention mechanism, providing normalization, a probabilistic interpretation, and compatibility with the softmax function, all of which are essential for the effective operation of the attention mechanism in neural networks. The spatially aware attention module operates within the spatial domain (specifically, along height and width), strategically pooling features from the same spatial locations across layers to yield more distinct feature representations, and can be expressed by  
\[\pi_{S}(\mathcal{F})\cdot\mathcal{F}=\frac{1}{L}\sum_{l=1}^{L}\sum_{k=1}^{K}w_ {l,k}\cdot\mathcal{F}(l;p_{k}+\Delta p_{k};c)\cdot\Delta m_{k}, \tag{24}\]  
where \(K\) represents the count of sparsely sampled positions, with \(p_{k}+\Delta p_{k}\) indicating a relocated point achieved through the application of a spatial shift \(\Delta p_{k}\) that the model has learned, which is designed to concentrate on a region of discriminative interest. Additionally, \(\Delta m_{k}\) denotes a significance factor that the model has learned at the position \(p_{k}\). Both of these elements are derived from the input features extracted at the median level of the feature set \(\mathcal{F}\). The task-specific attention module operates at the channel level, enabling the dynamic engagement or disengagement of operational channels to accommodate and support a variety of tasks, and can be expressed as  
\[\pi_{C}(\mathcal{F})\cdot\mathcal{F}=max\Big{(}\alpha^{1}(\mathcal{F})\cdot \mathcal{F}_{c}+\beta^{1}(\mathcal{F}),\alpha^{2}(\mathcal{F})\cdot\mathcal{F }_{c}+\beta^{2}(\mathcal{F})\Big{)} \tag{25}\]  
Figure 8: Structure diagram of Dyhead. where \(\mathcal{F}_{c}\) denotes the feature tensor extracted from the \(c\)-th channel and the hyperparameter vector \([\alpha^{1},\alpha^{2},\beta^{1},\beta^{2}]^{T}=\theta(\cdot)\), which is determined by the function \(\theta(\cdot)\), is a specialized function that the model has been trained on to adjust activation thresholds. The function \(\theta(\cdot)\) is implemented in a manner akin to that described in reference [33], involving the following steps: first, it performs a global average pooling operation across the \(L\times S\) dimensions to decrease the feature dimensionality, followed by two fully connected neural layers and a normalization layer. The output is then normalized using a shifted sigmoid activation function, constraining it to the range of \([-1,1]\). (2) WIoU: In YOLOv8, the loss function is constructed from three distinct parts, which are divided into two unique streams, namely, classification and regression. For the former aspect, a Binary Cross-Entropy (BCE) loss is employed. For the latter aspect, the regression is handled using the CIoU bounding box loss and the Distribution Focus (DF) loss.