基于改进YOLOv12的金属表面缺陷检测算法
Metal Surface Defect Detection Algorithm Based on Improved YOLOv12
摘要: 针对金属表面缺陷检测中存在的缺陷边缘模糊、小目标漏检以及模型收敛效果差等问题,提出了一种基于改进YOLOv12的金属表面缺陷检测算法SCA-YOLO。设计边缘增强卷积模块(EEConv),通过多方向差分卷积提取缺陷边缘特征,增强模型对划痕、裂纹等线性缺陷的特征表达能力;引入空间通道协同注意力机制(SCA),通过空间注意力定位缺陷区域并利用通道注意力筛选重要特征,提升小目标检测精度;引入Wise-IoU损失函数替代传统的CIoU,利用其动态非单调聚焦机制平衡不同质量样本的权重,加速模型收敛。在NEU-DET数据集上的实验结果表明,SCA-YOLO的mAP@0.5达到78.9%,相比基线YOLOv12n提升5.7%,同时参数量仅增加3.5%,验证了所提方法的有效性。
Abstract: Aiming at the problems of fuzzy defect edges, missed detection of small targets, and poor model convergence in metal surface defect detection, an improved YOLOv12-based algorithm named SCA-YOLO is proposed. An Edge Enhancement Convolution (EEConv) module is designed to extract defect edge features through multi-directional differential convolution, enhancing the model’s feature representation capability for linear defects such as scratches and cracks. A Spatial-Channel Collaborative Attention (SCA) mechanism is introduced, which locates defect regions via spatial attention and filters important features through channel attention, thereby improving the detection accuracy for small targets. The Wise-IoU loss function replaces the traditional CIoU, utilizing its dynamic non-monotonic focusing mechanism to balance the weights of samples of different qualities and accelerate model convergence. Experimental results on the NEU-DET dataset show that SCA-YOLO achieves an mAP@0.5 of 78.9%, which is 5.7% higher than the baseline YOLOv12n, while the number of parameters increases by only 3.5%, verifying the effectiveness of the proposed method.
文章引用:于浩. 基于改进YOLOv12的金属表面缺陷检测算法[J]. 建模与仿真, 2026, 15(1): 156-163. https://doi.org/10.12677/mos.2026.151014

参考文献

[1] Song, K. and Yan, Y. (2013) A Noise Robust Method Based on Completed Local Binary Patterns for Hot-Rolled Steel Strip Surface Defects. Applied Surface Science, 285, 858-864. [Google Scholar] [CrossRef
[2] 景会成, 鲍成明. 基于改进YOLOv12的铝型材工件缺陷检测技术研究[J/OL]. 电子测量技术, 1-11.
https://kns.cnki.net/kcms2/article/abstract?v=Ow72tX7v2w3hZdm71ce_i65hlORKj5vZQfymSFNfU93v7_nhz1mJBDnqgtaSYd1QYYMCVpb6R6lpfDiO_cj0C39FJx5wUP01ykm_kyENK0zRxXtIM3A48hVapjy9LMoYymEnzIQ9U4C6F04Fxy7bKc2nELEWpOaaewaGN-rkVTCpqYSTiuEn8w==&uniplatform=NZKPT&language=CHS, 2025-11-28.
[3] 周建新, 许兴博. 改进Steel-YOLO的钢材表面缺陷检测[J/OL]. 东北师大学报(自然科学版), 1-12.
https://kns.cnki.net/kcms2/article/abstract?v=Ow72tX7v2w3X43yDZ2IrBQCF2nN-g9BsgliiSGv0hXkM9ax9EAiCLNJAZIa5S9MZ3WHXLoJ2B4zeKT-n5zFfTWkHmQZggw6TV3VHlNFbLv14O6K3ikWZb_wHJ2_eyyRe6oX9eIvGn-1nfBOSH69Jsd3TYuRCvgZJYJrIE7wNSlV0R4XZfsFylg==&uniplatform=NZKPT&language=CHS, 2025-11-28.
[4] 赵洋, 杨聪, 陈蓉, 等. CSM-YOLO: 红外弱小目标检测算法[J]. 红外技术, 2025, 47(10): 1234-1245.
[5] He, K., Zhang, X., Ren, S. and Sun, J. (2016) Deep Residual Learning for Image Recognition. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, 27-30 June 2016, 770-778. [Google Scholar] [CrossRef
[6] Redmon, J., Divvala, S., Girshick, R. and Farhadi, A. (2016) You Only Look Once: Unified, Real-Time Object Detection. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, 27-30 June 2016, 779-788. [Google Scholar] [CrossRef
[7] Tian, Y., Ye, Q. and Doermann, D. (2025) YOLOv12: Attention-Centric Real-Time Object Detectors. arXiv:2502.12524.
[8] Hu, J., Shen, L. and Sun, G. (2018) Squeeze-and-Excitation Networks. 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Salt Lake City, 18-23 June 2018, 7132-7141. [Google Scholar] [CrossRef
[9] Woo, S., Park, J., Lee, J. and Kweon, I.S. (2018) CBAM: Convolutional Block Attention Module. In: Ferrari, V., Hebert, M., Sminchisescu, C. and Weiss, Y., Eds., Lecture Notes in Computer Science, Springer International Publishing, 3-19. [Google Scholar] [CrossRef
[10] Tong, Z., Chen, Y., Xu, Z., et al. (2023) Wise-IoU: Bounding Box Regression Loss with Dynamic Focusing Mechanism. arXiv:2301.10051.