Please wait a minute...
浙江大学学报(工学版)  2025, Vol. 59 Issue (7): 1514-1522    DOI: 10.3785/j.issn.1008-973X.2025.07.019
机械与能源工程     
基于改进YOLO-v8的精密管件表面缺陷检测方法
刘子豪1,2(),张佳欣1,薛峰3,张俊4,5,陈伟杰6,鹿业波6
1. 嘉兴大学 人工智能学院,浙江 嘉兴 314001
2. 天津大学 机械工程学院,天津 300072
3. 浙江迈思特液压管件股份有限公司,浙江 嘉兴 314303
4. 嘉兴南湖学院 机电工程学院,浙江 嘉兴 314001
5. 天津大学 电气自动化与信息工程学院,天津 300072
6. 嘉兴大学 机械工程学院,浙江 嘉兴 314001
Surface defect detection method of precision pipe fittings based on improved YOLO-v8
Zihao LIU1,2(),Jiaxin ZHANG1,Feng XUE3,Jun ZHANG4,5,Weijie CHEN6,Yebo LU6
1. School of Artificial Intelligence, Jiaxing University, Jiaxing 314001, China
2. School of Mechanical Engineering, Tianjin University, Tianjin 300072, China
3. Zhejiang Master Hydraulic Fittings Co., Ltd, Jiaxing 314303, China
4. School of Mechanical and Electrical Engineering, Jiaxing Nanhu University, Jiaxing 314001, China
5. School of Electrical and Information Engineering, Tianjin University, Tianjin 300072, China
6. School of Mechanical Engineering, Jiaxing University, Jiaxing 314001, China
 全文: PDF(1953 KB)   HTML
摘要:

随机缺陷具有微尺度、形态和类型多样的特点,传统机器学习模型的缺陷检测精度和泛化性能欠佳,为此提出基于改进YOLO-v8的多源管件表面缺陷检测方法. 为了获取管件全局信息,构建基于焦距可调的管件全表面图像采集系统,对不同类型管件样本进行快速、高效的高清成像. 针对样本来源多样性问题,在YOLO-v8模型的主干特征提取模块中嵌入渐进特征金字塔网络(AFPN)架构,在瓶颈卷积特征层中融合封装-激励(SE)注意力机制,有效提升缺陷检测模型的泛化性. 通过视频抽取关键帧及静态定焦拍摄相结合的方式,对标定后的图像构建训练集和测试集,采用改进YOLO-v8算法自动识别管件表面缺陷. 实验结果表明,所提方法在推理阶段的检测mAP50为82.2%,相比传统YOLO-v8提升了3.1个百分点. 该结果为金属目标的缺陷通用性检测提供了参考.

关键词: 改进YOLO-v8缺陷检测图像处理管件机器视觉系统    
Abstract:

Random defects are characterized by micro-scale, various forms and rich types, and the defect detection accuracy and generalization performance of traditional machine learning models are ordinary. Based on the improved YOLO-v8, a multi-source pipe fitting surface defect detection method was proposed. In order to obtain global information on pipe fittings, a whole-surface image acquisition system based on the adjustable focal length of pipe fittings was constructed, and high-definition imaging of different types of pipe fittings was conducted quickly and efficiently. For the diverse sample sources, the asymptotic feature pyramid network (AFPN) architecture was added to the backbone feature extraction module of the YOLO-v8 model, and the squeeze-and-excitation (SE) attention mechanism was embedded in the bottleneck convolution feature layer to effectively improve the generalization of defect detection model. A training set and a test set were constructed by combining the video extraction of keyframes and static fixed-focus images, and the improved YOLO-v8 algorithm was used to automatically identify the surface defects of pipe fittings. Experimental results showed that the detection mAP50 of the proposed method in the inference stage was 82.2%, which was improved by 3.1 percentage points compared to the traditional YOLO-v8. The results provide a reference for the universal defect detection of metal targets.

Key words: improved YOLO-v8    defect detection    image processing    pipe fittings    machine vision system
收稿日期: 2024-05-06 出版日期: 2025-07-25
CLC:  TP 391.4  
基金资助: 国家自然科学基金资助项目(62374074);浙江省“尖兵领雁”研发攻关计划(2024C04028);嘉兴市公益性研究计划项目(SQGY202400009);校企合作项目(00523144);海盐重点研发计划项目(2024ZD03);嘉兴大学人才项目(CD70623008);浙江省大学生科技创新训练计划项目(2023R417A030);嘉兴大学SRT科技创新训练计划项目(8517231497,8517231255,8517231256,8517231279,8517231493).
作者简介: 刘子豪(1988—),男,副教授,博士,从事工业产品在线无损检测技术研究. orcid.org/0009-0006-4837-5575. E-mail:lzh@zjxu.edu.cn
服务  
把本文推荐给朋友
加入引用管理器
E-mail Alert
作者相关文章  
刘子豪
张佳欣
薛峰
张俊
陈伟杰
鹿业波

引用本文:

刘子豪,张佳欣,薛峰,张俊,陈伟杰,鹿业波. 基于改进YOLO-v8的精密管件表面缺陷检测方法[J]. 浙江大学学报(工学版), 2025, 59(7): 1514-1522.

Zihao LIU,Jiaxin ZHANG,Feng XUE,Jun ZHANG,Weijie CHEN,Yebo LU. Surface defect detection method of precision pipe fittings based on improved YOLO-v8. Journal of ZheJiang University (Engineering Science), 2025, 59(7): 1514-1522.

链接本文:

https://www.zjujournals.com/eng/CN/10.3785/j.issn.1008-973X.2025.07.019        https://www.zjujournals.com/eng/CN/Y2025/V59/I7/1514

图 1  管件表面缺陷示意图
图 2  管件图像采集装置示意图
图 3  管件图像采集的机器视觉系统
图 4  管件的圆心角计算示意图
图 5  渐进特征金字塔网络的结构流程图
图 6  有效多尺度卷积模块示意图
图 7  改进YOLO-v8检测模型结构示意图
图 8  不同管件的热力图显示结果
模型名称Inner-CIoUAFPNSEPmAP50/%NP/106GFlops
YOLO-v8------0.73180.574.293.1
++----0.78581.267.799.4
--++--0.75882.881.287.6
----++0.76481.184.994.8
++++--0.81283.176.392.2
++--++0.77982.368.796.9
--++++0.78282.184.189.3
本研究++++++0.79583.578.995.5
表 1  改进YOLO-v8检测模型的模块消融实验结果
图 9  改进YOLO-v8检测模型的损失函数和准确率曲线走势图
方法mAP50/%NP/106t/ms
训练阶段验证阶段
多层感知器[19]67.365.417.15.2
YOLO-v4[20]76.471.186.721.8
YOLO-v5[21]77.175.682.927.3
YOLO-v7[22]80.175.7103.432.8
YOLOX[23]79.378.687.731.6
YOLO-v8[12]80.579.174.227.2
本研究83.582.278.929.7
表 2  不同检测方法的性能对比结果
缺陷类型mAP50/%t/ms
训练阶段推理阶段
磕碰(bruise)83.578.225.5
裂纹-1(crack)97.326.8
裂纹-3(crack)90.829.7
锈迹(rust)81.633.9
毛刺(burr)77.828.2
平均值83.585.128.8
表 3  改进YOLO-v8检测模型的管件缺陷检测实验结果
图 10  改进YOLO-v8检测模型对金属管件5种表面缺陷的检测结果
1 WEN S, CHEN Z, LI C Vision-based surface inspection system for bearing rollers using convolutional neural networks[J]. Applied Sciences, 2018, 8 (12): 2565
doi: 10.3390/app8122565
2 TAO J, ZHU Y, JIANG F, et al Rolling surface defect inspection for drum-shaped rollers based on deep learning[J]. IEEE Sensors Journal, 2022, 22 (9): 8693- 8700
doi: 10.1109/JSEN.2022.3159743
3 XU L M, YANG Z Q, JIANG Z H, et al Light source optimization for automatic visual inspection of piston surface defects[J]. The International Journal of Advanced Manufacturing Technology, 2017, 91 (5): 2245- 2256
4 FEYZA C, SERAP K, ALI O M, et al Online metallic surface defect detection using deep learning[J]. Emerging Materials Research, 2020, 9 (4): 1- 8
5 姜乐兵, 宋飞虎, 裴永胜, 等 基于粒子群优化Gabor滤波器的钢板表面缺陷检测[J]. 传感器与微系统, 2023, 42 (11): 135- 138
JIANG Lebing, SONG Feihu, PEI Yongsheng, et al Surface defect detection of steel plate based on PSO-Gabor filter[J]. Transducer and Microsystem Technologies, 2023, 42 (11): 135- 138
6 郭浩然, 郭继昌, 汪昱东 面向水下场景的轻量级图像语义分割网络[J]. 浙江大学学报: 工学版, 2023, 57 (7): 1278- 1286
GUO Haoran, GUO Jichang, WANG Yudong Lightweight semantic segmentation network for underwater image[J]. Journal of Zhejiang University: Engineering Science, 2023, 57 (7): 1278- 1286
7 崔克彬, 焦静颐 基于MCB-FAH-YOLOv8的钢材表面缺陷检测算法[J]. 图学学报, 2024, 45 (1): 112- 125
CUI Kebin, JIAO Jingyi Steel surface defect detection algorithm based on MCB-FAH-YOLOv8[J]. Journal of Graphics, 2024, 45 (1): 112- 125
8 王春梅, 刘欢 YOLOv8-VSC: 一种轻量级的带钢表面缺陷检测算法[J]. 计算机科学与探索, 2024, 18 (1): 151- 160
WANG Chunmei, LIU Huan YOLOv8-VSC: lightweight algorithm for strip surface defect detection[J]. Journal of Frontiers of Computer Science and Technology, 2024, 18 (1): 151- 160
doi: 10.3778/j.issn.1673-9418.2308060
9 ZHENG H, KONG L X, NAHAVANDI S Automatic inspection of metallic surface defects using genetic algorithms[J]. Journal of Materials Processing Technology, 2002, 125: 427- 433
10 STIVANELLO M E, MARCELLINO K J A machine vision system for online metal can-end rivet inspection[J]. Journal of Physics: Conference Series, 2019, 1335 (1): 012002
doi: 10.1088/1742-6596/1335/1/012002
11 SUN J, LI C, WU X J, et al An effective method of weld defect detection and classification based on machine vision[J]. IEEE Transactions on Industrial Informatics, 2019, 15 (12): 6322- 6333
doi: 10.1109/TII.2019.2896357
12 HUSSAIN M YOLO-v1 to YOLO-v8, the rise of YOLO and its complementary nature toward digital manufacturing and industrial defect detection[J]. Machines, 2023, 11 (7): 677
doi: 10.3390/machines11070677
13 刘莫尘, 褚镇源, 崔明诗, 等. 基于改进YOLO v8-Pose的红熟期草莓识别和果柄关键点检测 [EB/OL]. (2023–09–12)[2024–05–21]. https://link.cnki.net/urlid/11.1964.S.20230911.2034.046.
14 谢碧森. 基于卷积神经网络的牛脸识别技术研究[D]. 昆明: 云南大学, 2021: 1–58.
XIE Bisen. Research on cow face recognitiontechnology based on convolutional neural network [D]. Kunming: Yunnan University, 2021: 1–58.
15 张求星. 基于ByteTrack的自动驾驶多目标行人跟踪技术研究[D]. 北京: 军事科学院, 2023: 1–73.
ZHANG Qiuxing. Research on ByteTrack based autonomous driving multi object pedestrian tracking technology [D]. Beijing: Academy of Military Science, 2023: 1–73.
16 杨观赐, 杨静, 苏志东, 等 改进的YOLO特征提取算法及其在服务机器人隐私情境检测中的应用[J]. 自动化学报, 2018, 44 (12): 2238- 2249
YANG Guanci, YANG Jing, SU Zhidong, et al An improved YOLO feature extraction algorithm and its application to privacy situation detection of social robots[J]. Acta Automatica Sinica, 2018, 44 (12): 2238- 2249
17 DUAN D Y, XIA Y J Pseudo color ghost coding imaging with pseudo thermal light[J]. Optics Communications, 2018, 413: 295- 298
doi: 10.1016/j.optcom.2017.12.064
18 HU J, SHEN L, SUN G. Squeeze-and-excitation networks [C]// Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. Salt Lake City: IEEE, 2018: 7132–7141.
19 ZHOU Y, XU J IoT perception layer scheduling deadlock relieving optimization method[J]. Journal of Intelligent and Fuzzy Systems, 2020, 38 (6): 7521- 7529
20 BOCHKOVSKIY A, WANG C Y, LIAO H Y M. YOLOv4: optimal speed and accuracy of object detection [EB/OL]. (2020–04–23)[2024–05–21]. https://arxiv.org/pdf/2004.10934.
21 XING B, WANG W, QIAN J, et al A lightweight model for real-time monitoring of ships[J]. Electronics, 2023, 12 (18): 3804- 3821
doi: 10.3390/electronics12183804
22 WANG C Y, BOCHKOVSKIY A, LIAO H Y M. YOLOv7: trainable bag-of-freebies sets new state-of-the-art for real-time object detectors [C]// 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). Vancouver: IEEE, 2023: 7464–7475.
[1] 鞠文博,董华军. 基于上下文信息融合与动态采样的主板缺陷检测方法[J]. 浙江大学学报(工学版), 2025, 59(6): 1159-1168.
[2] 梁耕良,韩曙光. 基于改进RT-DETR的牛仔面料疵点检测算法[J]. 浙江大学学报(工学版), 2025, 59(6): 1169-1178.
[3] 梁礼明,龙鹏威,金家新,李仁杰,曾璐. 基于改进YOLOv8s的钢材表面缺陷检测算法[J]. 浙江大学学报(工学版), 2025, 59(3): 512-522.
[4] 杨敏航,徐海松,黄益铭,叶正男,张云涛,胡兵. 基于光源感知的跨相机颜色一致性算法[J]. 浙江大学学报(工学版), 2025, 59(3): 557-565.
[5] 陈智超,杨杰,李凡,冯志成. 基于深度学习的列车运行环境感知关键算法研究综述[J]. 浙江大学学报(工学版), 2025, 59(1): 1-17.
[6] 唐善成,逯建辉,张莹,金子成,赵安新. 修复缺陷嫌疑区域的无监督磁瓦表面缺陷检测[J]. 浙江大学学报(工学版), 2024, 58(4): 718-728.
[7] 刘坤,王丁,王静凯,陈海永,刘卫朋. 基于特征过滤与特征解耦的域泛化模型[J]. 浙江大学学报(工学版), 2024, 58(3): 459-467.
[8] 王安静,袁巨龙,朱勇建,陈聪,吴金津. 基于改进YOLOv8s的鼓形滚子表面缺陷检测算法[J]. 浙江大学学报(工学版), 2024, 58(2): 370-380.
[9] 赵小强,王泽,宋昭漾,蒋红梅. 基于动态注意力网络的图像超分辨率重建[J]. 浙江大学学报(工学版), 2023, 57(8): 1487-1494.
[10] 郭浩然,郭继昌,汪昱东. 面向水下场景的轻量级图像语义分割网络[J]. 浙江大学学报(工学版), 2023, 57(7): 1278-1286.
[11] 熊帆,陈田,卞佰成,刘军. 基于卷积循环神经网络的芯片表面字符识别[J]. 浙江大学学报(工学版), 2023, 57(5): 948-956.
[12] 卞佰成,陈田,吴入军,刘军. 基于改进YOLOv3的印刷电路板缺陷检测算法[J]. 浙江大学学报(工学版), 2023, 57(4): 735-743.
[13] 兰欢,余建波. 基于深度学习三维成型的钢板表面缺陷检测[J]. 浙江大学学报(工学版), 2023, 57(3): 466-476.
[14] 温佩芝,陈君谋,肖雁南,温雅媛,黄文明. 基于生成式对抗网络和多级小波包卷积网络的水下图像增强算法[J]. 浙江大学学报(工学版), 2022, 56(2): 213-224.
[15] 袁天乐,袁巨龙,朱勇建,郑翰辰. 基于改进YOLOv5的推力球轴承表面缺陷检测算法[J]. 浙江大学学报(工学版), 2022, 56(12): 2349-2357.