Computer Engineering and Applications ›› 2024, Vol. 60 ›› Issue (7): 282-291.DOI: 10.3778/j.issn.1002-8331.2308-0414

• Engineering and Applications • Previous Articles     Next Articles

Research on Steel Surface Defect Detection with Improved YOLOv7 Algorithm

GAO Chunyan, QIN Shen, LI Manhong, LYV Xiaoling   

  1. College of Mechanical Engineering, Hebei University of Technology, Tianjin 300401, China
  • Online:2024-04-01 Published:2024-04-01

改进YOLOv7算法的钢材表面缺陷检测研究

高春艳,秦燊,李满宏,吕晓玲   

  1. 河北工业大学 机械工程学院,天津 300401

Abstract: At present, the intelligent inspection technology based on deep learning is gradually applied to the field of steel surface defect detection. Aiming at the problem of low precision of steel surface defect detection, a high-precision and real-time defect detection algorithm CDN-YOLOv7 is proposed. Firstly, CARAFE lightweight up-sampling operator is added to improve the feature fusion capability of the network. Then, the YOLOv7 detection head network is redesigned by integrating the cascade attention mechanism and decoupling heads, aiming to solve the problem of low feature utilization efficiency of the original head network and make full use of multi-dimensional information of different scales, channels and spaces, improve the ability of model representation in complex scenarios. Finally, normalized Wasserstein distance is introduced to redesign Focal-EIoU loss function, and NF-EIoU is proposed to replace CIoU loss, balance the contribution of defect samples at different scales to loss, and reduce the missed detection rate of defects at different scales. The experimental results show that the detection accuracy of CDN-YOLOv7 can reach 80.3%, which is 6.0 percentage points higher than that of the original YOLOv7, and the model reasoning speed can reach 60.8 frame/s, meeting the real-time requirements. While improving the detection accuracy of defects at various scales, CDN-YOLOv7 significantly reduces the missed detection rate of defects.

Key words: machine vision, steel surface, defect detection, CDN-YOLOv7

摘要: 当前,基于深度学习的智能检测技术逐步应用于钢材表面缺陷检测领域,针对钢材表面缺陷检测精度低的问题,提出一种高精度实时的缺陷检测算法CDN-YOLOv7。加入CARAFE轻量化上采样算子来改善网络特征融合能力,融合级联注意力机制和解耦头重新设计YOLOv7检测头网络,旨在解决原始头网络特征利用效率不高的问题,使其充分利用各尺度、通道、空间的多维度信息,提升复杂场景下模型表征能力。引入归一化Wasserstein距离重新设计Focal-EIoU损失函数,提出NF-EIoU替换CIoU损失,平衡各尺度缺陷样本对Loss的贡献,降低各尺度缺陷的漏检率。实验结果表明,CDN-YOLOv7的检测精度可达80.3%,较于原YOLOv7精度提升了6.0个百分点,模型推理速度可达60.8帧/s,满足实时性需求,CDN-YOLOv7在提升各尺度缺陷检测精度的同时显著降低了缺陷的漏检率。

关键词: 机器视觉, 钢材表面, 缺陷检测, CDN-YOLOv7