## 3 Proposed Method
### Improving Multi-Scale Feature Fusion with BiFPN  
Steel surface defect detection often varies significantly in size and morphology. Unlike objects in natural images with strong semantic consistency, steel surfaces can have diverse defect types like minute cracks, large oxidation spots, and irregular indentations. This multi-scale heterogeneity significantly increases the challenge of feature representation for detection models. While the PANet structure in the original YOLOv8 offers some cross-layer feature fusion capabilities and outperforms traditional FPN, its linear weighting scheme cannot fully model the relative importance of features at different resolutions. This fusion approach risks suppressing high-level semantic features by excessive low-level detail representation, while potentially allowing large-scale features to dominate the integrated output, consequently degrading detection performance for small objects. To tackle this, we replace YOLOv8's original module with BiFPN. The schematic representations of FPN, PANet, and BiFPN network architectures are shown in Figure 5. By integrating BiFPN, we achieve adaptive feature selection and information enhancement, thereby improving overall detection accuracy [28]. Compared to the PANet module utilized in YOLOv8, BiFPN implements systematic replacements and optimizations across several key dimensions. First, concerning information flow design, BiFPN establishes a bidirectional feature propagation path, simultaneously supporting both top-down and bottom-up multi-level feature interaction. This design enables more comprehensive fusion of hierarchical semantic and spatial information, thereby improving feature representation completeness. Second, regarding cross-scale connections, BiFPN introduces several optimizations to enhance efficiency and fusion quality:  
* **Removal of single-input nodes:** BiFPN removes single-input nodes (those with only one input edge). Since these non-fusion nodes contribute negligibly to the network's feature integration objective. This optimization yields a more efficient bidirectional topology without compromising fusion performance. * **Same-level skip connections:** Extra connections are established between corresponding input and output nodes residing at the same level. This facilitates the merging of a greater number of features without a substantial rise in computational expense. Figure 4: Simplified demonstration of the sampling process of AKConv on crazing and roll-in scale samples. * **Repeated multi-layer fusion:** Unlike PANet's restricted single top-down and bottom-up pathway structure, BiFPN considers each bidirectional (top-down and bottom-up) pathway as an individual feature network layer. This identical layer is subsequently iterated multiple times to facilitate the integration of more advanced features. To further improve feature fusion quality, BiFPN incorporates a lightweight feature selection mechanism. This mechanism dynamically adjusts the importance of each input feature through learnable weights, suppressing redundant feature interference and strengthening critical information channels, making it particularly sensitive to the representation of minute defect regions. Its fast normalized fusion formula is expressed as follows:  
\[O=\sum_{i}\frac{w_{i}}{\epsilon+\sum_{j}w_{j}}\cdot I_{i}, \tag{5}\]  
Here, \(I_{i}\) signifies the \(i\)-th input feature, \(w_{i}\) denotes its corresponding trainable fusion weight, and \(O\) corresponds to the aggregated output. This adaptive mechanism enables dynamic weighting of input features during fusion based on their relative importance, thereby enhancing both the flexibility and robustness of the feature integration process.