欢迎访问《图学学报》 分享到:

图学学报 ›› 2023, Vol. 44 ›› Issue (3): 427-437.DOI: 10.11996/JG.j.2095-302X.2023030427

• 图像处理与计算机视觉 • 上一篇    下一篇

基于改进YOLOv5的螺纹钢表面缺陷检测

胡欣1(), 周运强1, 肖剑2(), 杨杰2   

  1. 1.长安大学能源与电气工程学院,陕西 西安 710064
    2.长安大学电子与控制工程学院,陕西 西安 710064
  • 收稿日期:2022-11-02 接受日期:2023-01-02 出版日期:2023-06-30 发布日期:2023-07-03
  • 通讯作者: 肖剑(1975-),男,副教授,博士。主要研究方向为信号处理、人工智能应用、模式识别和计算机视觉等。E-mail:xiaojian@chd.edu.cn
  • 作者简介:

    胡欣(1975-),女,副教授,博士。主要研究方向为能源管理、计算机视觉和机器学习等。E-mail:huxin@chd.edu.cn

  • 基金资助:
    陕西省重点研发计划项目(2021GY-054);陕西省重点研发计划项目(2023-YBGY-094);宁夏回族自治区重点研发计划项目(2022BEG03072)

Surface defect detection of threaded steel based on improved YOLOv5

HU Xin1(), ZHOU Yun-qiang1, XIAO Jian2(), YANG Jie2   

  1. 1. School of Energy and Electrical Engineering, Chang′an University, Xi′an Shaanxi 710064, China
    2. School of Electronic and Control Engineering, Chang′an University, Xi′an Shaanxi 710064, China
  • Received:2022-11-02 Accepted:2023-01-02 Online:2023-06-30 Published:2023-07-03
  • Contact: XIAO Jian (1975-), associate professor, Ph.D. His main research interests cover signal processing, artificial intelligence applications, pattern recognition and computer vision, etc. E-mail:xiaojian@chd.edu.cn
  • About author:

    HU Xin (1975-), associate professor, Ph.D. Her main research interests cover energy management, computer vision and machine learning, etc. E-mail:huxin@chd.edu.cn

  • Supported by:
    Key R&D Project of Shaanxi Province(2021GY-054);Key R&D Project of Shaanxi Province(2023-YBGY-094);Key R&D Project of Ningxia Hui Autonomous Region(2022BEG03072)

摘要:

针对在工业场景下螺纹钢表面缺陷检测精度低、漏检和误检率高等问题,提出了一种改进YOLOv5的螺纹钢表面缺陷检测算法。改进YOLOv5算法中,融合多空间金字塔池化模块(M-SPP),优化网络,通过增加网络的深度加强特征的提取,可以一定程度上提高检测精度;添加改进的空间和坐标注意力模块(SCA),进一步区分空间领域不同像素之间的权重关系,更加关注感兴趣的区域,减小非必要的区域权重,提高模型对小目标缺陷的关注度;使用双采样过渡模块(TB)进行下采样,减少重要特征的丢失,获取更多特征信息;利用k-means++算法重聚类锚框,生成的预设锚框更适应缺陷的不同尺度大小,提高算法的检测精度。通过在螺纹钢表面缺陷数据集上的实验结果表明,改进后的YOLOv5算法对螺纹钢表面缺陷检测具有良好的检测性能,优于其他对比的算法。改进YOLOv5算法的AP50达到97.6%,相对于YOLOv5算法提高了3.2%,其他各项指标均有涨点,在保持原检测速度基本不变的情况下,精准地检测螺纹钢表面缺陷。

关键词: YOLOv5, 缺陷检测, 多空间金字塔, 注意力机制, 双采样过渡, k-means++

Abstract:

An improved YOLOv5 algorithm for surface defect detection was proposed to solve the problems of low detection accuracy, high missed detection, and false detection rate in industrial scenarios. The improved YOLOv5 algorithm incorporated the multi-space pyramid pooling module (M-SPP) to optimize the network and the detection accuracy could be improved to a certain extent by increasing the depth of the network for better feature extraction. The improved spatial and coordinate attention module (SCA) was introduced to further distinguish the weight relationship between different pixels in the spatial domain, put more emphasis on the region of interest. This algorithm reduced the unnecessary regional weight and enhanced the model’s attention to small target defects. The double sampling transition module (TB) was utilized for downsampling to reduce the loss of important features and obtain more feature information. The k-means ++ algorithm was also employed to reunite the class anchor frame, and the generated preset anchor frame was more suitable for different sizes of defects, thereby improving the detection accuracy of the algorithm. The experimental results on the surface defect dataset of spiral steel showed that the improved YOLOv5 algorithm achieved good detection performance for the surface defect detection of spiral steel, superior to other compared algorithms. The improved YOLOv5 algorithm achieved an AP50 of 97.6%, 3.2% higher than the YOLOv5 algorithm, and all other indexes showed an increase. While maintaining the original detection speed, the algorithm could accurately detect the surface defects of steel rebar.

Key words: YOLOv5, defect detection, multi-spatial pyramid pooling, attention mechanism, double sampling transition, k-means++

中图分类号: