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

图学学报 ›› 2023, Vol. 44 ›› Issue (2): 335-345.DOI: 10.11996/JG.j.2095-302X.2023020335

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

基于改进YOLOv5算法的钢材表面缺陷检测

曹义亲1(), 伍铭林1, 徐露2   

  1. 1.华东交通大学软件学院,江西 南昌 330013
    2.江西交通职业技术学院机电工程学院,江西 南昌 330013
  • 收稿日期:2022-06-17 接受日期:2022-10-07 出版日期:2023-04-30 发布日期:2023-05-01
  • 作者简介:曹义亲(1964-),男,教授,硕士。主要研究方向为图像处理与模式识别。E-mail:yqcao@ecjtu.edu.cn
  • 基金资助:
    国家自然科学基金项目(61861016);江西科技支撑计划重点项目(20161BBE50081)

Steel surface defect detection based on improved YOLOv5 algorithm

CAO Yi-qin1(), WU Ming-lin1, XU Lu2   

  1. 1. College of software, East China Jiaotong University, Nanchang Jiangxi 330013, China
    2. School of Electromechanical Engineering, Jiangxi V&T College of Communications, Nanchang Jiangxi 330013, China
  • Received:2022-06-17 Accepted:2022-10-07 Online:2023-04-30 Published:2023-05-01
  • About author:CAO Yi-qin (1964-), professor, master. His main research interests cover digital image processing and pattern recognition. E-mail:yqcao@ecjtu.edu.cn
  • Supported by:
    National Natural Science Foundation of China(61861016);Key Project of Jiangxi Science and Technology Support Plan(20161BBE50081)

摘要:

针对单阶段检测网络YOLOv5的特征提取能力不足、模型感受野受限以及特征融合不充分等问题,提出一种改进YOLOv5的钢材表面缺陷检测算法。该方法构造一种带残差边的SPP_Res特征金字塔结构,加快模型的训练速度,增强模型的特征提取能力;加入多头注意力机制(C3_MHSA),优化了网络结构,专注全局感受野,提取更加丰富的目标特征;引入多层特征融合机制,进一步融合浅层与深层特征,兼顾到更多的位置、语义、细节信息,提高网络对钢材表面缺陷的检测精度。实验结果表明,改进后的YOLOv5网络模型具有良好地检测性能,在NEU-DET数据集上的mAP达到了74.1%,相比原始YOLOv5网络提升了3.4%,较YOLOX提升4.0%,较YOLOv3提升了8.6%,较SSD算法提升了23.4%。检测速度优于其他主流算法,且在保持原检测速度基本不变的情况下,能够快速准确地对钢材表面缺陷进行检测。

关键词: YOLOv5, SPP_Res, 多头注意力机制, 多层融合, 缺陷检测

Abstract:

An improved YOLOv5 steel surface defects detection algorithm was proposed to address the one-stage detection network YOLOv5, such as inadequate feature extraction ability, limited receptive field, and insufficient feature fusion. A feature pyramid structure of SPP_Res with residual edges was proposed to speed up the training of the model and enhance the feature extraction ability of the model. Additionally, a multi-head self-attention mechanism (C3_MHSA) was added to optimize the network structure, focusing on the global receptive field of the model and extracting richer features of the target. Furthermore, a multi-layer fusion mechanism was introduced to further integrate shallow and deep features, taking into account more information on location, semantics, and details, thereby improving the detection accuracy of steel surface defects. The experimental results demonstrated that the improved YOLOv5 algorithm could exhibit excellent detection performance, and that the mAP on the NEU-DET datasets reached 74.1%, which was 3.4% higher than that of the original YOLOv5 algorithm, 4.0% higher than that of the YOLOX algorithm, 8.6% higher than that of YOLOv3 algorithm, and 23.4% higher than that of the SSD algorithm. The improved YOLOv5 network could detect steel surface defects more accurately than YOLOv5 with similar detection speed, while outperforming other mainstream algorithms in both accuracy and speed.

Key words: YOLOv5, SPP_Res, muti-head self-attention mechanism, muti-layer fusion mechanism, defect detection

中图分类号: