电子科技 ›› 2024, Vol. 37 ›› Issue (12): 48-55.doi: 10.16180/j.cnki.issn1007-7820.2024.12.008

• • 上一篇    下一篇

改进YOLOv5s算法的钢材表面缺陷检测

崔晶楠, 黄春艳, 李艳玲   

  1. 华北水利水电大学 数学与统计学院,河南 郑州 450046
  • 收稿日期:2023-04-27 出版日期:2024-12-15 发布日期:2024-12-16
  • 作者简介:崔晶楠(1999-),男,硕士研究生。研究方向:计算机视觉、图像处理。
    黄春艳(1979-),女,博士。研究方向:图像处理。
    李艳玲(1978-),女,博士,副教授。研究方向:深度学习、大数据技术。
  • 基金资助:
    河南省科技攻关项目(212102310306)

Improvement of YOLOv5s Algorithm for Steel Surface Defect Detection

CUI Jingnan, HUANG Chunyan, LI Yanling   

  1. School of Mathematics and Statistics,North China University of Water Resources and Electric Power, Zhengzhou 450046,China
  • Received:2023-04-27 Online:2024-12-15 Published:2024-12-16
  • Supported by:
    Science and Technology Project of Henan(212102310306)

摘要:

针对现有钢材表面缺陷检测方法准确率不高、识别速度慢等问题,文中提出了一种基于改进YOLOv5s(You Only Look Once version 5s)的缺陷检测方法。为了实现对图像重要区域信息的关注以及提高模型对目标缺陷的学习能力,在主干特征提取网络引入CBAM(Convolutional Block Attention Module)注意力机制。为了提高目标框的回归速度和定位的准确性,使用距离损失和宽高损失结合的EIoU(Efficient Intersection over Union)边界框损失函数计算损失值。通过迁移学习加快模型的收敛速度来提升模型对各类缺陷检测准确率。通过在数据集NEU-DET上的实验结果表明,相较原始YOLOv5s网络,改进YOLOv5s网络模型对该数据集的准确率提升了6.3百分点,召回率提升了9.2百分点,mAP(mean Average Precision)达到了81.7%,对于钢材表面缺陷检测具有良好的性能。改进YOLOv5s算法的钢材表面缺陷检测模型大小仅为13.8 MB,在确保实时性的基础上提升了检测精度,便于模型在实际应用中的部署。

关键词: 深度学习, 卷积神经网络, YOLOv5s, 注意力机制, 损失函数, 迁移学习, 目标检测, 缺陷检测

Abstract:

In view of the problems such as low accuracy and slow recognition speed of existing steel surface defect detection methods, a defect detection method based on improved YOLOv5s(You Only Look Once version 5s) is proposed in this study. CBAM(Convolutional Block Attention Module) attention mechanism is introduced into the backbone feature extraction network to pay attention to the information of important regions and improve the model's learning ability of target defects. In order to improve the regression speed and localization accuracy of the target frame, the EIoU(Efficient Intersection over Union) boundary frame loss function combining distance loss and width-height loss are used to calculate the loss value. Transfer learning is used to accelerate the convergence speed of the model to improve the accuracy of defects detection. The experimental results on the data set NEU-DET show that compared with the original YOLOv5s network, the improved YOLOv5s network of the accuracy rate of the data set increased by 6.3 percentage point, the recall rate increased by 9.2 percentage point, and the mAP(mean Average Precision) reached 81.7%, which indicates the improved method has good performance for the detection of steel surface defects. The size of the steel surface defect detection model with the improved YOLOv5s algorithm is only 13.8 MB, which improves the detection accuracy on the basis of real-time performance and facilitates the deployment of the model in practical applications.

Key words: deep learning, convolutional neural networks, YOLOv5s, attention mechanism, loss function, transfer learning, target detection, defect detection

中图分类号: 

  • TP391.41