Please wait a minute...
浙江大学学报(工学版)  2022, Vol. 56 Issue (12): 2349-2357    DOI: 10.3785/j.issn.1008-973X.2022.12.004
机械工程     
基于改进YOLOv5的推力球轴承表面缺陷检测算法
袁天乐1(),袁巨龙1,*(),朱勇建2,郑翰辰1
1. 浙江工业大学 机械工程学院,浙江 杭州 310023
2. 浙江科技学院 机械工程学院,浙江 杭州 310023
Surface defect detection algorithm of thrust ball bearing based on improved YOLOv5
Tian-le YUAN1(),Ju-long YUAN1,*(),Yong-jian ZHU2,Han-chen ZHENG1
1. College of Mechanical Engineering, Zhejiang University of Technology, Hangzhou 310023, China
2. College of Mechanical Engineering, Zhejiang University of Science and Technology, Hangzhou 310023, China
 全文: PDF(1216 KB)   HTML
摘要:

为了提高推力球轴承表面缺陷检测的精确率和召回率,增强模型抗干扰能力,提出自动提取检测区域预处理和改进Transformer中的多头自注意力机制模块. 在特征网络引入所提模块,忽略无关噪声信息而关注重点信息,提升中小表面缺陷的提取能力. 使用实例归一化代替批量归一化,提高模型训练时的收敛速度和检测精度. 结果表明,在推力球轴承表面缺陷检测数据集中,改进YOLOv5模型的准确率达到87.0%,召回率达到83.0%,平均精度达到86.1%,平均每张图片检测时间为14.96 ms. 相比于YOLOv5s模型,改进模型的准确率提升1.5%,召回率提升7.3%,平均精度提升7.9%. 与原模型相比,改进YOLOv5模型有更好的缺陷定位能力和较高的准确度,能够减小检测过程中的异物对检测结果造成的干扰,检测速度满足工业大批量检测的要求.

关键词: 深度学习推力球轴承YOLOv5Transformer注意力机制表面缺陷检测    
Abstract:

An automatic extraction detection area preprocessing and a multi-head self-attention mechanism module in the improved Transformer were proposed, in order to improve the accuracy and recall rate of the surface defect detection of thrust ball bearings, and enhance the anti-interference ability of the model. The proposed module was introduced into the feature network ignoring irrelevant noise information and focusing on the key information, and the extraction ability of small and medium-sized surface defects was improved. Instance normalization was used instead of Batch normalization to improve the convergence speed and detection accuracy during model training. Results show that in the thrust ball bearing surface defect detection dataset, the accuracy rate of the improved YOLOv5 model reaches 87.0%, the recall rate reaches 83.0%, the average precision reaches 86.1%, and the average detection time per image was 14.96 ms. Compared with the YOLOv5s model, the accuracy of the improved model is increased by 1.5%, the recall rate is increased by 7.3%, and the average precision is increased by 7.9%. Compared with the original model, the improved YOLOv5 model has better defect positioning ability and higher accuracy, and can reduce interference of foreign objects in the detection process on detection results. A detection speed of the improved YOLOv5 model can meet the requirements of industrial mass detection.

Key words: deep learning    thrust ball bearing    YOLOV5    Transformer    attention mechanism    surface defect detection.
收稿日期: 2021-12-10 出版日期: 2023-01-03
CLC:  TP 391.41  
基金资助: 国家重点研发计划资助项目(2018YFB2000402);国家自然科学基金资助项目(U1809221);浙江省基础公益计划资助项目(LGG21E050006)
通讯作者: 袁巨龙     E-mail: 435282558@qq.com;jlyuan@zjut.edu.cn
作者简介: 袁天乐(1997—),男,硕士生,从事机器视觉检测技术研究. orcid.org/0000-0002-1696-5558. E-mail: 435282558@qq.com
服务  
把本文推荐给朋友
加入引用管理器
E-mail Alert
作者相关文章  
袁天乐
袁巨龙
朱勇建
郑翰辰

引用本文:

袁天乐,袁巨龙,朱勇建,郑翰辰. 基于改进YOLOv5的推力球轴承表面缺陷检测算法[J]. 浙江大学学报(工学版), 2022, 56(12): 2349-2357.

Tian-le YUAN,Ju-long YUAN,Yong-jian ZHU,Han-chen ZHENG. Surface defect detection algorithm of thrust ball bearing based on improved YOLOv5. Journal of ZheJiang University (Engineering Science), 2022, 56(12): 2349-2357.

链接本文:

https://www.zjujournals.com/eng/CN/10.3785/j.issn.1008-973X.2022.12.004        https://www.zjujournals.com/eng/CN/Y2022/V56/I12/2349

图 1  YOLOv5的网络结构
图 2  推力球轴承图片自动提取目标区域的预处理流程图
图 3  Vision Transformer 网络结构
图 4  Transformer多头自注意力机制模块的改进
图 5  改进YOLOv5模型结构
图 6  推力球轴承表面缺陷样品
图 7  推力球轴承图像数据增强
模型 AP p r mAP@0.5 t/ms
划伤 压印 缺球
YOLOv5s 0.567 0.789 0.988 0.855 0.757 0.782 8.28
YOLOv5m 0.550 0.807 0.991 0.811 0.783 0.783 15.64
表 1  YOLOv5s和YOLOv5m的轴承检测结果对比
预处理 AP p r mAP@0.5 t/ms
划伤 压印 缺球
0.567 0.789 0.988 0.855 0.757 0.782 8.28
0.676 0.846 0.986 0.826 0.816 0.836 8.89
表 2  预处理前后的轴承检测结果对比
图 8  改进前后分类损失收敛情况对比
算法 预处理 AP p r mAP@0.5
划伤 压印 缺球
BN 0.567 0.789 0.988 0.855 0.757 0.782
IN 0.592 0.835 0.994 0.840 0.791 0.807
BN 0.676 0.846 0.986 0.826 0.816 0.836
IN 0.684 0.855 0.993 0.862 0.792 0.844
表 3  改进归一化函数检测结果对比
图 9  模型基准网络结构
实验 模型 算法 AP F1 mAP@0.5
划伤 压印 缺球
1 BN 0.676 0.846 0.986 0.821 0.836
2 图5(a) BN 0.666 0.864 0.993 0.821 0.841
3 图5(b) BN 0.698 0.851 0.988 0.831 0.846
4 图5(c) BN 0.566 0.869 0.987 0.814 0.807
5 图5(d) BN 0.714 0.869 0.989 0.832 0.857
6 图5(b) IN 0.715 0.869 0.992 0.845 0.859
7 图5(d) IN 0.717 0.876 0.991 0.850 0.861
表 4  添加多头自注意力机制模块检测结果对比
图 10  YOLOv5s改进前后在轴承表面缺陷数据集中的检测结果对比
模型 AP mAP@0.5 t/ms
划伤 压印 缺球
YOLOv3 0.586 0.813 0.981 0.806 34.39
YOLOv3-SPP 0.65 0.815 0.991 0.819 30.73
Faster-RCNN 0.468 0.690 0.984 0.714 124
YOLOv5s 0.676 0.846 0.986 0.836 8.28
本研究 0.717 0.876 0.991 0.861 14.96
表 5  本研究模型与主流模型检测结果对比
1 刘桥方, 严枫 我国轴承制造技术的现状及其发展趋势[J]. 轴承, 2005, (6): 42- 45
LIU Qiao-fang, YAN Feng Current situation and development trend of Chinese bearing manufacturing technology[J]. Bearing, 2005, (6): 42- 45
doi: 10.3969/j.issn.1000-3762.2005.06.018
2 ZOU Y, DU D, CHANG B, et al Automatic weld defect detection method based on Kalman filtering for real-time radiographic inspection of spiral pipe[J]. NDT&E International, 2015, 72: 1- 9
3 BEARD M D, LOWE M J S Non-destructive testing of rock bolts using guided ultrasonic waves[J]. International Journal of Rock Mechanics and Mining Sciences, 2003, 40 (4): 527- 536
doi: 10.1016/S1365-1609(03)00027-3
4 TITMAN D J Applications of thermography in non-destructive testing of structures[J]. NDT&E International, 2001, 34 (2): 149- 154
5 LU Q Y, WONG C H Applications of non-destructive testing techniques for post-process control of additively manufactured parts[J]. Virtual and Physical Prototyping, 2017, 12 (4): 301- 321
doi: 10.1080/17452759.2017.1357319
6 GIRSHICK R, DONAHUE J, DARRELL T, et al. Rich feature hierarchies for accurate object detection and semantic segmentation [C]// 2014 IEEE Conference on Computer Vision and Pattern Recognition. Columbus: IEEE, 2014: 580-587.
7 HE K, ZHANG X, REN S, et al Spatial pyramid pooling in deep convolutional networks for visual recognition[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2015, 37 (9): 1904- 1916
doi: 10.1109/TPAMI.2015.2389824
8 GIRSHICK R. Fast R-CNN [J]. 2015 IEEE International Conference on Computer Vision. Santiago: IEEE, 2015: 1440-1448.
9 REN S, HE K, GIRSHICK R, et al Faster R-CNN: towards real-time object detection with region proposal networks[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017, 39 (6): 1137- 1149
doi: 10.1109/TPAMI.2016.2577031
10 DAI J, LI Y, HE K, et al. R-FCN: object detection via region-based fully convolutional networks [C]// Proceedings of the 30th International Conference on Neural Information Processing Systems. Barcelona: [s. n.], 2016: 379-387.
11 HE K, GKIOXARI G, DOLLÁR P, et al. Mask R-CNN [C]// 2017 IEEE International Conference on Computer Vision. Venice: IEEE, 2017: 2961-2969.
12 REDMON J, DIVVALA S, GIRSHICK R, et al. You only look once: unified, real-time object detection [C]// 2016 IEEE Conference on Computer Vision and Pattern Recognition. Las Vegas: IEEE, 2016: 779-788.
13 REDMON J, FARHADI A. YOLO9000: better, faster, stronger [C]// 2017 IEEE Conference on Computer Vision and Pattern Recognition. Honolulu: IEEE, 2017: 7263-7271.
14 REDMON J, FARHADI A. YOLOv3: an incremental improvement [EB/OL]. [2021-10-08]. https://arxiv.org/pdf/1804.02767.pdf.
15 BOCHKOVSKIY A, WANG C Y, LIAO H Y M. YOLOv4: optimal speed and accuracy of object detection [EB/OL]. [2021-10-08]. https://arxiv.org/pdf/2004.10934v1.pdf.
16 LIU W, ANGUELOV D, ERHAN D, et al. SSD: single shot multiBox detector [C]// European Conference on Computer Vision 2016. [S. l.]: Springer, 2016: 21-37.
17 FU C Y, LIU W, RANGA A, et al. DSSD: deconvolutional single shot detector [EB/OL]. [2021-10-08]. https://arxiv.org/pdf/1701.06659.pdf .
18 LI Z, ZHOU F. FSSD: feature fusion single shot multibox detector [EB/OL]. [2021-10-08]. https://arxiv.org/pdf/1712.00960.pdf.
19 LIN T Y, GOYAL P, GIRSHICK R, et al. Focal loss for dense object detection [C]// 2017 IEEE International Conference on Computer Vision. Venice: IEEE, 2017: 2980-2988.
20 王鹏. 基于机器视觉的钢球表面缺陷检测系统[D]. 哈尔滨: 哈尔滨理工大学, 2005.
WANG Peng. Surface defect detect system of steel ball based on machine vision [D]. Harbin: Harbin University of Science and Technology, 2005.
21 陈琦. 基于机器视觉的滑动轴承内表面缺陷自动检测系统的研究[D]. 镇江: 江苏大学, 2017.
CHEN Qi. Research on automatic detection system of inner surface defects of sliding bearing based on machine vision [D]. Zhenjiang: Jiangsu University, 2017.
22 KUNAKORNVONG P, TANGKONGKIET C, SOORAKSA P. Defect detection on air bearing surface with gray level co-occurrence matrix [C]// The 4th Joint International Conference on Information and Communication Technology, Electronic and Electrical Engineering. Chiang Rai: IEEE, 2014: 1-4.
23 DENG S, CAI W, XU Q, et al. Defect detection of bearing surfaces based on machine vision technique [C]// 2010 International Conference on Computer Application and System Modeling. Taiyuan: IEEE, 2010: V4−548−V4−554.
24 李维刚, 叶欣, 赵云涛, 等 基于改进YOLOv3算法的带钢表面缺陷检测[J]. 电子学报, 2020, (7): 1284- 1292
LI Wei-gang, YE Xin, ZHAO Yun-tao, et al Strip steel surface defect detection based on improved YOLOv3 algorithm[J]. Acta Electronica Sinica, 2020, (7): 1284- 1292
doi: 10.3969/j.issn.0372-2112.2020.07.006
25 张磊, 郎贤礼, 王乐 基于图像融合与YOLOv3的铝型材表面缺陷检测[J]. 计算机与现代化, 2020, (11): 8- 15
ZHANG Lei, LANG Xian-li, WANG Le Surface defect detection of aluminum profiles based on image fusion and YOLOv3[J]. Computer and Modernization, 2020, (11): 8- 15
doi: 10.3969/j.issn.1006-2475.2020.11.002
26 李浪怡, 刘强, 邹一鸣, 等 基于改进YOLOv5算法的轨面缺陷检测[J]. 五邑大学学报: 自然科学版, 2021, 35 (3): 43- 48
LI Lang-yi, LIU Qiang, ZOU Yi-ming, et al Rail surface defect detection based on improved YOLOv5 algorithm[J]. Journal of Wuyi University: Natural Science Edition, 2021, 35 (3): 43- 48
27 JIN R, NIU Q Automatic fabric defect detection based on an improved YOLOv5[J]. Mathematical Problems in Engineering, 2021, 7321394
28 ZHAO Z, YANG X, ZHOU Y, et al Real-time detection of particleboard surface defects based on improved YOLOV5 target detection[J]. Scientific Reports, 2021, 11: 21777
doi: 10.1038/s41598-021-01084-x
29 IOFFE S, SZEGEDY C. Batch normalization: accelerating deep network training by reducing internal covariate shift [C]// Proceedings of the 32nd International conference on machine learning. Lille: [s. n.], 2015: 448-456.
30 BA J L, KIROS J R, HINTON G E. Layer normalization [EB/OL]. [2021-10-08]. https://arxiv.org/pdf/1607.06450.pdf.
31 LIN T Y, DOLLÁR P, GIRSHICK R, et al. Feature pyramid networks for object detection [C]// 2017 IEEE Conference on Computer Vision and Pattern Recognition. Honolulu: IEEE, 2017: 2117-2125.
32 LIU S, QI L, QIN H, et al. Path aggregation network for instance segmentation [C]// 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition. Lake City: IEEE, 2018: 8759-8768.
[1] 刘近贞,陈飞,熊慧. 多尺度残差网络模型的开放式电阻抗成像算法[J]. 浙江大学学报(工学版), 2022, 56(9): 1789-1795.
[2] 王万良,王铁军,陈嘉诚,尤文波. 融合多尺度和多头注意力的医疗图像分割方法[J]. 浙江大学学报(工学版), 2022, 56(9): 1796-1805.
[3] 郝琨,王阔,王贝贝. 基于改进Mobilenet-YOLOv3的轻量级水下生物检测算法[J]. 浙江大学学报(工学版), 2022, 56(8): 1622-1632.
[4] 夏杰锋,唐武勤,杨强. 光伏航拍红外图像的热斑自动检测方法[J]. 浙江大学学报(工学版), 2022, 56(8): 1640-1647.
[5] 莫仁鹏,司小胜,李天梅,朱旭. 基于多尺度特征与注意力机制的轴承寿命预测[J]. 浙江大学学报(工学版), 2022, 56(7): 1447-1456.
[6] 赵永胜,李瑞祥,牛娜娜,赵志勇. 数字孪生驱动的机身形状控制方法[J]. 浙江大学学报(工学版), 2022, 56(7): 1457-1463.
[7] 王友卫,童爽,凤丽洲,朱建明,李洋,陈福. 基于图卷积网络的归纳式微博谣言检测新方法[J]. 浙江大学学报(工学版), 2022, 56(5): 956-966.
[8] 鞠晓臣,赵欣欣,钱胜胜. 基于自注意力机制的桥梁螺栓检测算法[J]. 浙江大学学报(工学版), 2022, 56(5): 901-908.
[9] 何立,庞善民. 结合年龄监督和人脸先验的语音-人脸图像重建[J]. 浙江大学学报(工学版), 2022, 56(5): 1006-1016.
[10] 张雪芹,李天任. 基于Cycle-GAN和改进DPN网络的乳腺癌病理图像分类[J]. 浙江大学学报(工学版), 2022, 56(4): 727-735.
[11] 许萌,王丹,李致远,陈远方. IncepA-EEGNet: 融合Inception网络和注意力机制的P300信号检测方法[J]. 浙江大学学报(工学版), 2022, 56(4): 745-753, 782.
[12] 柳长源,何先平,毕晓君. 融合注意力机制的高效率网络车型识别[J]. 浙江大学学报(工学版), 2022, 56(4): 775-782.
[13] 陈巧红,裴皓磊,孙麒. 基于视觉关系推理与上下文门控机制的图像描述[J]. 浙江大学学报(工学版), 2022, 56(3): 542-549.
[14] 褚晶辉,史李栋,井佩光,吕卫. 适用于目标检测的上下文感知知识蒸馏网络[J]. 浙江大学学报(工学版), 2022, 56(3): 503-509.
[15] 程若然,赵晓丽,周浩军,叶翰辰. 基于深度学习的中文字体风格转换研究综述[J]. 浙江大学学报(工学版), 2022, 56(3): 510-519, 530.