Abstract
<title>Abstract</title> <p>To address the challenges of diverse surface defect types, significant scale variations, and the high miss rate of small targets, a novel YOLOv5s-SC surface defect detection model for metal strips is proposed based on the YOLOv5s architecture. First, the K-means + + algorithm is adopted to optimize anchor box generation, and the Shape-IoU loss function is introduced to enhance bounding box regression accuracy. Second, the backbone network is improved by integrating the C2f module and switchable atrous convolution (SAC) to enrich gradient flow and strengthen multi-scale feature extraction. while the neck is upgraded with RepGFPN and a Squeeze-and-Excitation (SE) attention mechanism to strengthen semantic fusion and focus on defect-critical regions. To enable deployment on resource-constrained edge devices, the layer-adaptive magnitude-based pruning (LAMP) method is applied to structurally compress the model. Experimental results on the NEU-DET dataset demonstrate that the proposed YOLOv5s-SC2 achieves a mean average precision (mAP) of 84.3%, outperforming the baseline YOLOv5s by 4.4 percentage points. With LAMP pruning at 2.5× acceleration, the model size, computational cost, and memory are reduced to 56.2%, 39.4%, and 56.9% of the original, respectively, with a negligible mAP drop of only 0.2 percentage points, providing an effective and lightweight solution for industrial surface defect detection.</p>