## 3 Method
### Improved MEAG-YOLO Model Structure
#### 3.2.3 Adaptive Spatial Feature Fusion Module  
The size of the PPE in the substation scenario can vary greatly. The original YOLOv8n network utilizes the FPN + PAN structure to merge information, effectively integrating high-level and low-level features. However, the network's weight allocation may lead to the loss of critical features, thereby affecting detection performance. To address this issue, this study incorporates the ASHF module to enhance the effectiveness of merging features from different scales. The ASHF module is a sophisticated mechanism that dynamically adjusts the weights of feature maps across different scales to achieve fusion. The structure of the ASHF module is illustrated in Figure 7.  
Figure 6: GAP structure diagram.  
Figure 7: ASHF module structure diagram.  
The ASFF module uses an adaptive learning system to change the weights of feature maps on various scales, depending on the task and data traits. Before combining them, it assigns these adjusted weights to the feature maps. This adaptive weight distribution allows the network to automatically adapt fusion strategies based on the importance of features across different spatial positions and scales. The ASFF module dynamically adjusts the fusion weights of feature maps across different scales, enhancing the efficiency of feature utilization. It fine-tunes the enhancement or suppression of features, thereby improving the model's capacity to recognize multi-scale targets in complex scenes. This mechanism enables the model to tailor its fusion strategy based on the spatial location and scale significance of features, leading to more precise target detection. With the integration of the ASFF module, the YOLOv8n model's ability to effectively process multi-scale targets is enhanced, particularly in intricate substation environments.  
The fusion process of ASFF-1 is demonstrated using X1, X2, and X3 as examples. This method uses three feature maps from the YOLOv8n backbone. They are then handled by combining FPN and PAN at three levels: Level 1, Level 2, and Level 3. ASFF-1 is formed by combining these three levels. The process of feature fusion at Level 1 is described by Equation (4):  
\[\mathbf{y}_{ij}^{l}=\alpha_{ij}^{l}\cdot\mathbf{x}_{ij}^{1\to l}+\beta_{ij}^{l} \cdot\mathbf{x}_{ij}^{2\to l}+\gamma_{ij}^{l}\cdot\mathbf{x}_{ij}^{3\to l} \tag{4}\]  
The vector at the \((i,\ j)\) position in the inter-channel output feature mapping is \(\mathbf{y}_{ij}^{l}\). \(\alpha_{ij}^{l}\), \(\beta_{ij}^{l}\), and \(\gamma_{ij}^{l}\) are the spatial importance weights of features from different levels during the forward propagation of the first layer. \(\mathbf{x}_{ij}^{n\to l}\) represents the feature vector at position \((i,\ j)\) from level \(n\) to \(l\). After processing with the softmax function, \(\alpha_{ij}^{l}+\beta_{ij}^{l}+\gamma_{ij}^{l}=1\), \((\alpha_{ij}^{l}\), \(\beta_{ij}^{l}\), \(\gamma_{ij}^{l}\in[0,\ 1])\). This module adaptively aggregates features from three distinct levels. They operate on their respective scales. After this aggregation, the fused features are passed to the head structure. The head structure is instrumental in classifying and detecting PPE.