# Steel Surface Defect Detection Algorithm Based on Improved YOLOv8 Modeling
## 3 Construction of EB-YOLOv8
### Constructing Weighted Fusion Splicing Module to Realize Multi-Scale Feature Fusion  
More advanced feature fusion mechanisms are required for the accurate and rapid identification of defects when inspecting steel surfaces. However, the neck component of YOLOv8 still uses the PANet [25] path aggregation structure, which transmits feature information through a bidirectional path network consisting of top-down and bottom-up paths. All feature layers contribute equally during fusion without considering differences in scale. YOLOv8's original Concat connection structure simply stacks feature maps without an adaptive weighting mechanism that distinguishes the importance of different input feature maps. This results in low fusion efficiency and potentially introduces redundant or interfering information. Based on the above issues, this paper employs a weighted bidirectional feature pyramid network (BiFPN) to enhance the feature network (structure shown in Figure 5). The green arrows in the figure represent downward paths, the orange arrows represent upward paths, and the blue arrows represent jump connections. Uncolored circles represent features, while colored circles represent operators. The BiFPN constructs a bidirectional closed-loop fusion for the five levels of features from P3 to P7 (decreasing resolution, increasing semantic depth): The top-down path progressively upsamples high-level semantic features (P7/P6/P5) and dynamically fuses them with adjacent mid-to-low-level features (P6/P5/P4) via learnable weights, ultimately injecting them into the high-resolution lower-level P3 layer to enhance details; the bottom-up path downsamples the enhanced P3 details layer-by-layer and fuses them back into the P4-P7 layers, simultaneously optimizing the high-level semantic representation. This bidirectional flow enhances the expressive power of the features. A fast normalization method is also used for weighted fusion to distinguish the contribution of each level of features to the fusion, thereby achieving more precise feature fusion. This weighted strategy makes the utilization of features more efficient and effectively improves the performance of small object detection. This paper proposes a Concat_BiFPN structure based on fast normalized weighted fusion (Figure 6) to replace the Concat and PANet modules in YOLOv8. The Concat_BiFPN module performs weighted fusion on the two input feature maps by assigning learnable weights to each input path's feature map for importance-based weighting. The weighted feature maps are then concatenated along the channel dimension, followed by convolution layers to fuse the concatenated information and reduce dimensions, thereby achieving the weighted fusion of multi-scale features. Finally, the SiLU activation function is used with a \(1\times 1\) convolution to adjust the number of channels, enabling the model to have stronger fusion capabilities when dealing with multi-scale features with defects. This structure innovatively adopts an adaptive weight allocation strategy, dynamically learning  
Figure 5: BiFPN structure. the importance ratios of features at different levels to significantly optimize the fusion effect of multi-scale features. During feature processing, high-resolution shallow-layer features are assigned higher weights, effectively enhancing the identification capability of micron-level pitting; simultaneously, the channel dimension fusion method avoids feature compression loss in traditional methods, significantly improving the retention rate of details in small-sized defects. This technology offers unique advantages over traditional fusion modes. For example, compared to the multi-layer redundant calculations of the stacked BiFPN, this technology achieves cross-scale feature optimization through a single weighted channel concatenation, fundamentally solving the problem of small-target information attenuation caused by multiple feature compressions in stacked structures. It significantly improves sensitivity to small defects while maintaining real-time performance.