Abstract:
Objective Steel surface defects directly reduce mechanical performance and corrosion resistance of steel products, threatening safety and reliability in construction, machinery, and energy industries. Traditional detection methods rely on manual inspection and conventional machine vision, which suffer from low efficiency, poor accuracy, and weak adaptability to complex industrial scenes. Deep learning-based one-stage detectors represented by YOLO series achieve fast inference but still face three critical limitations in steel surface defect inspection: insufficient semantic representation for multi-scale and low-contrast defects, inefficient static feature fusion that fails to model irregular defect shapes, and unbalanced performance between detection accuracy and inference speed. Lightweight models often sacrifice feature discrimination ability to reduce computation, while high-precision models introduce excessive parameters and slow down inference. This work aims to develop a lightweight, high-precision, real-time defect detection algorithm that supports industrial deployment and overcomes the above bottlenecks.
Methods An improved one-stage detection algorithm named ECS-YOLO was proposed based on the YOLOv11n framework, integrating semantic guidance and multi-scale fusion mechanisms to enhance feature extraction, dynamic modeling, and cross-level feature alignment. Three customized modules are designed and embedded into the backbone, neck, and feature pyramid networks respectively. First, an efficient semantic-aware module E-C3k2 is constructed by embedding an efficient semantic-aware attention module (ESAM) into the original C3k2 bottleneck structure. The core sparse-decomposed large kernel attention module (SDLKAM) adopts parallel convolutional paths: a 5×5 standard convolution captures local fine details, and two striped dilated convolutions extract long-range horizontal and vertical contextual features. A dynamic kernel selection and fusion module (DKSFM) performs joint channel-spatial calibration to enhance semantic responses in defect-sensitive regions and suppress redundant information. Second, a multi-scale dynamic hybrid module C2MDML replaces the static C2PSA layer in the neck network. The multi-scale dynamic mixing layer (MDML) uses a parallel multi-branch structure with different scales of depthwise separable convolutions. Content-dependent dynamic convolution weights are generated via global average pooling and two-layer linear projection, enabling position-adaptive feature aggregation. Channel shuffle operations strengthen cross-branch feature interaction and improve multi-scale information fusion efficiency. Third, a semantically guided feature pyramid network SGFPN is built to alleviate semantic and spatial misalignment in cross-level feature fusion. Soft nearest neighbor interpolation (SNNI) realizes soft spatial alignment between high-level semantic features and low-level texture features during upsampling. Enhanced lightweight grouped spatial convolution (ELGSConv) uses a parallel multi-path structure and channel rearrangement to preserve edge details and reduce computation overhead. Semantic guidance runs through feature extraction and fusion stages to improve positioning accuracy for tiny and fuzzy defects. The algorithm is evaluated on the NEU-DET dataset with six typical steel surface defects, and cross-scene generalization is verified on GC10-DET and PCB datasets. Evaluation metrics include precision, recall, mAP@50, mAP@50-95, parameter count, FLOPs, and FPS.
Results and Discussions Ablation experiments validate the effectiveness and compatibility of each module. Embedding E-C3k2 in the backbone improves mAP@50 to 77.5% and accelerates inference to 175 f/s with slightly reduced parameters. Adding C2MDML enhances multi-scale adaptability, lifting mAP@50 to 78.6%. Using SGFPN alone reduces false positive rate from 15.1% to 7.9% and raises mAP@50 to 78.3% while maintaining lightweight properties. When all three modules are integrated, ECS-YOLO reaches optimal performance: mAP@50 hits 80.3%, 3.4 percentage points higher than the baseline YOLOv11n; mAP@50-95 improves to 47.5%; parameters are compressed to 2.43M; FLOPs are 6.1G; inference speed reaches 197 f/s. The algorithm outperforms mainstream detectors including Faster R-CNN, SSD, RT-DETR, YOLOv3-tiny, YOLOv5n, YOLOv8n, YOLOv12n, YOLOv13n, and state-of-the-art steel defect detection models in comprehensive performance. Visualization results show that ECS-YOLO generates complete, continuous bounding boxes for slender scratches, scattered inclusions, and fuzzy patches, with higher positioning precision and stronger anti-interference ability under complex rolling textures. Robustness tests under varying brightness, Gaussian blur, and noise demonstrate graceful performance degradation, confirming strong environmental adaptability. Cross-scene experiments show that on the GC10-DET dataset with ten defect types, ECS-YOLO increases mAP@50 by 4.7% and inference speed to 229 f/s, with significant improvements in detecting inclusions, rolled pits, and creases. On the PCB dataset with six electronic defects, mAP@50 reaches 94.8%, 3.3% higher than the baseline, and recall rises by 5.3% to 92.0%, showing excellent detection for missing holes, shorts, spurs, and surplus copper.
Conclusions ECS-YOLO effectively addresses insufficient semantic representation, inefficient multi-scale fusion, and performance imbalance in steel surface defect detection. The E-C3k2 module strengthens semantic-aware feature extraction via sparse-decomposed large-kernel attention and dynamic kernel calibration. The C2MDML module enables content-adaptive dynamic modeling for complex defect morphologies through multi-branch dynamic convolution and feature interaction. The SGFPN module optimizes cross-level feature alignment and fusion via soft upsampling and lightweight grouped convolution, reducing detail loss and semantic noise. The proposed algorithm achieves high detection precision, ultra-lightweight structure, and real-time inference simultaneously, with strong robustness and cross-scene generalization. It meets the strict requirements of industrial inspection for accuracy, efficiency, and easy deployment, and can be extended to other industrial visual defect detection tasks. Future work will focus on tiny object detection, complex texture analysis, cross-domain defect recognition, and edge deployment optimization.