图学学报 ›› 2023, Vol. 44 ›› Issue (3): 427-437.DOI: 10.11996/JG.j.2095-302X.2023030427
收稿日期:
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
基金资助:
HU Xin1(), ZHOU Yun-qiang1, XIAO Jian2(
), YANG Jie2
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:
摘要:
针对在工业场景下螺纹钢表面缺陷检测精度低、漏检和误检率高等问题,提出了一种改进YOLOv5的螺纹钢表面缺陷检测算法。改进YOLOv5算法中,融合多空间金字塔池化模块(M-SPP),优化网络,通过增加网络的深度加强特征的提取,可以一定程度上提高检测精度;添加改进的空间和坐标注意力模块(SCA),进一步区分空间领域不同像素之间的权重关系,更加关注感兴趣的区域,减小非必要的区域权重,提高模型对小目标缺陷的关注度;使用双采样过渡模块(TB)进行下采样,减少重要特征的丢失,获取更多特征信息;利用k-means++算法重聚类锚框,生成的预设锚框更适应缺陷的不同尺度大小,提高算法的检测精度。通过在螺纹钢表面缺陷数据集上的实验结果表明,改进后的YOLOv5算法对螺纹钢表面缺陷检测具有良好的检测性能,优于其他对比的算法。改进YOLOv5算法的AP50达到97.6%,相对于YOLOv5算法提高了3.2%,其他各项指标均有涨点,在保持原检测速度基本不变的情况下,精准地检测螺纹钢表面缺陷。
中图分类号:
胡欣, 周运强, 肖剑, 杨杰. 基于改进YOLOv5的螺纹钢表面缺陷检测[J]. 图学学报, 2023, 44(3): 427-437.
HU Xin, ZHOU Yun-qiang, XIAO Jian, YANG Jie. Surface defect detection of threaded steel based on improved YOLOv5[J]. Journal of Graphics, 2023, 44(3): 427-437.
名称 | 实验配置 |
---|---|
操作系统 | ubantu20.04 |
编程语言 | Python 3.8 |
深度学习框架 | PyTorch 1.8.0 |
CPU | Intel Core i7-9700K |
GPU | NVIDIA RTX 3050 (6 G) |
Cuda | Cuda 11.2 |
平台 | Pycharm 2022.1 |
表1 实验软硬件配置
Table 1 Experimental software and hardware onfiguration
名称 | 实验配置 |
---|---|
操作系统 | ubantu20.04 |
编程语言 | Python 3.8 |
深度学习框架 | PyTorch 1.8.0 |
CPU | Intel Core i7-9700K |
GPU | NVIDIA RTX 3050 (6 G) |
Cuda | Cuda 11.2 |
平台 | Pycharm 2022.1 |
k-means++ | M-SPP | SCA | TB | AP (%) | AP50 (%) | AP75 (%) | APS (%) | APM (%) | APL (%) |
---|---|---|---|---|---|---|---|---|---|
- | - | - | - | 64.7 | 94.4 | 68.6 | 39.7 | 62.9 | 68.6 |
√ | - | - | - | 65.8 | 95.7 | 69.9 | 39.9 | 63.3 | 68.7 |
- | √ | - | - | 64.9 | 94.6 | 68.5 | 40.1 | 63.7 | 69.9 |
- | - | √ | - | 66.2 | 96.2 | 69.4 | 42.5 | 63.8 | 69.4 |
- | - | - | √ | 65.6 | 94.7 | 68.5 | 39.7 | 63.3 | 68.6 |
√ | √ | √ | √ | 67.4 | 97.6 | 70.8 | 42.8 | 65.3 | 70.0 |
表2 消融实验结果对比
Table 2 Comparison of ablation test results
k-means++ | M-SPP | SCA | TB | AP (%) | AP50 (%) | AP75 (%) | APS (%) | APM (%) | APL (%) |
---|---|---|---|---|---|---|---|---|---|
- | - | - | - | 64.7 | 94.4 | 68.6 | 39.7 | 62.9 | 68.6 |
√ | - | - | - | 65.8 | 95.7 | 69.9 | 39.9 | 63.3 | 68.7 |
- | √ | - | - | 64.9 | 94.6 | 68.5 | 40.1 | 63.7 | 69.9 |
- | - | √ | - | 66.2 | 96.2 | 69.4 | 42.5 | 63.8 | 69.4 |
- | - | - | √ | 65.6 | 94.7 | 68.5 | 39.7 | 63.3 | 68.6 |
√ | √ | √ | √ | 67.4 | 97.6 | 70.8 | 42.8 | 65.3 | 70.0 |
YOLOv5 | Parameters (M) | APS (%) | APM (%) | APL (%) |
---|---|---|---|---|
+CA (GAP) | 180.5 | 41.5 | 62.9 | 69.4 |
+CA (GMP) | 180.5 | 41.9 | 63.1 | 69.3 |
+SCA (Ours) | 180.5 | 42.5 | 63.8 | 69.4 |
表3 SCA使用不同池化结果对比
Table 3 Comparison of SCA pooling results
YOLOv5 | Parameters (M) | APS (%) | APM (%) | APL (%) |
---|---|---|---|---|
+CA (GAP) | 180.5 | 41.5 | 62.9 | 69.4 |
+CA (GMP) | 180.5 | 41.9 | 63.1 | 69.3 |
+SCA (Ours) | 180.5 | 42.5 | 63.8 | 69.4 |
YOLOv5 | Parameters (M) | APS (%) | APM (%) | APL (%) |
---|---|---|---|---|
+SE | 180.2 | 39.7 | 63.1 | 69.1 |
+CBAM | 180.7 | 40.4 | 64.0 | 69.2 |
+CA | 180.4 | 40.9 | 62.8 | 68.8 |
+SCA (Ours) | 180.5 | 42.5 | 63.8 | 69.4 |
表4 YOLOv5加入不同注意力
Table 4 YOLOv5 adds different attention
YOLOv5 | Parameters (M) | APS (%) | APM (%) | APL (%) |
---|---|---|---|---|
+SE | 180.2 | 39.7 | 63.1 | 69.1 |
+CBAM | 180.7 | 40.4 | 64.0 | 69.2 |
+CA | 180.4 | 40.9 | 62.8 | 68.8 |
+SCA (Ours) | 180.5 | 42.5 | 63.8 | 69.4 |
Model | Backbone | AP (%) | AP50 (%) | AP75 (%) | APS (%) | APM (%) | APL (%) |
---|---|---|---|---|---|---|---|
Faster R-CNN[ | ResNet-50 | 57.1 | 87.7 | 52.2 | 33.9 | 51.3 | 58.2 |
YOLOv4[ | CSPDark-53 | 59.8 | 88.2 | 56.3 | 34.6 | 53.6 | 62.8 |
FCOS[ | ResNet-50 | 61.7 | 89.6 | 59.1 | 32.9 | 54.3 | 65.2 |
ATSS[ | ResNet-50 | 63.5 | 90.7 | 61.7 | 33.1 | 54.8 | 61.7 |
YOLOv5 | Focus-CSPDarkNet | 65.3 | 94.4 | 68.6 | 39.7 | 62.9 | 68.6 |
YOLOv7[ | ELAN | 66.7 | 96.5 | 71.3 | 41.9 | 64.4 | 70.2 |
YOLOv5*(Ours) | Focus-CSPDarkNet-MSPP | 67.4 | 97.6 | 70.8 | 42.8 | 65.3 | 70.0 |
表5 不同网络性能对比
Table 5 Performance comparison of different networks
Model | Backbone | AP (%) | AP50 (%) | AP75 (%) | APS (%) | APM (%) | APL (%) |
---|---|---|---|---|---|---|---|
Faster R-CNN[ | ResNet-50 | 57.1 | 87.7 | 52.2 | 33.9 | 51.3 | 58.2 |
YOLOv4[ | CSPDark-53 | 59.8 | 88.2 | 56.3 | 34.6 | 53.6 | 62.8 |
FCOS[ | ResNet-50 | 61.7 | 89.6 | 59.1 | 32.9 | 54.3 | 65.2 |
ATSS[ | ResNet-50 | 63.5 | 90.7 | 61.7 | 33.1 | 54.8 | 61.7 |
YOLOv5 | Focus-CSPDarkNet | 65.3 | 94.4 | 68.6 | 39.7 | 62.9 | 68.6 |
YOLOv7[ | ELAN | 66.7 | 96.5 | 71.3 | 41.9 | 64.4 | 70.2 |
YOLOv5*(Ours) | Focus-CSPDarkNet-MSPP | 67.4 | 97.6 | 70.8 | 42.8 | 65.3 | 70.0 |
图9 可视化结果对比((a)原图;(b) YOLOv5网络检测结果;(c)改进YOLOv5网络检测结果)
Fig. 9 Comparison of visualization results ((a) Original figure; (b) YOLOv5 network detection results; (c) Improved YOLOv5 network detection results)
图10 缺陷误检实验对比((a)原图;(b) YOLOv5网络检测结果;(c)改进YOLOv5网络检测结果)
Fig. 10 Comparison of defect misdetection experiments ((a) Original figure; (b) YOLOv5 network detection results; (c) Improved YOLOv5 network detection results)
[1] | 唐莺. 基于脉冲漏磁检测机理的缺陷检测研究[EB/OL]. [2022-10-02]. https://xueshu.baidu.com/usercenter/paper/show?paperid=143568429b51eeba2a36b11d8e06f050&site=xueshu_se&hitarticle=1. |
TANG Y. Research on defect detection based on pulse magnetic flux leakage testing mechanism[EB/OL]. [2022-10-02]. https://xueshu.baidu.com/usercenter/paper/show? paperid=143568429b51eeba2a36b11d8e06f050&site=xueshu_se&hitarticle=1. (in Chinese) | |
[2] | 武新军, 张卿, 沈功田. 脉冲涡流无损检测技术综述[J]. 仪器仪表学报, 2016, 37(8): 1698-1712. |
WU X J, ZHANG Q, SHEN G T. Review on advances in pulsed eddy current nondestructive testing technology[J]. Chinese Journal of Scientific Instrument, 2016, 37(8): 1698-1712. (in Chinese) | |
[3] | 索会迎. 超声波无损检测技术应用研究[D]. 南京: 南京邮电大学, 2012. |
SUO H Y. The application and research of ultrasonic non-destructive testing technology[D]. Nanjing: Nanjing University of Posts and Telecommunications, 2012. (in Chinese) | |
[4] | HORAUD R, CHARRAS J P. Automatic inspection and orientation of external screws[EB/OL]. [2022-09-18]. https://www.researchgate.net/publication/292553139_AUTOMATIC_INSPECTION_AND_ORIENTATION_OF_EXTERNAL_SCREWS. |
[5] | SOUKUP D, HUBER-MÖRK R. Convolutional neural networks for steel surface defect detection from photometric stereo images[M]//Advances in Visual Computing. Cham: Springer International Publishing, 2014: 668-677. |
[6] | 赵月, 张运楚, 孙绍涵, 等. 基于深度学习的螺纹钢表面缺陷检测[J]. 计算机系统应用, 2021, 30(7): 87-94. |
ZHAO Y, ZHANG Y C, SUN S H, et al. Defect detection method of rebar based on deep learning[J]. Computer Systems & Applications, 2021, 30(7): 87-94. (in Chinese) | |
[7] |
REN S Q, HE K M, 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 PMID |
[8] |
HE K M, ZHANG X Y, REN S Q, 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 PMID |
[9] | HOU Q B, ZHOU D Q, FENG J S. Coordinate attention for efficient mobile network design[C]// 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition. New York: IEEE Press, 2021: 13708-13717. |
[10] | LIU S, QI L, QIN H F, et al. Path aggregation network for instance segmentation[C]// 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition. New York: IEEE Press, 2018: 8759-8768. |
[11] | 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. New York: IEEE Press, 2016: 779-788. |
[12] | REDMON J, FARHADI A. YOLO9000: better, faster, stronger[C]// 2017 IEEE Conference on Computer Vision and Pattern Recognition. New York: IEEE Press, 2017: 6517-6525. |
[13] | REDMON J, FARHADI A. YOLOv3: an incremental improvement[EB/OL]. [2022-10-02]. https://arxiv.org/abs/1804.02767. |
[14] | BOCHKOVSKIY A, WANG C Y, LIAO H Y M. YOLOv4: optimal speed and accuracy of object detection[EB/OL]. [2022-10-02]. https://arxiv.org/abs/2004.10934. |
[15] | 唐靓, 余明慧, 武明虎, 等. 基于改进YOLOv5的绝缘子缺陷检测算法[J]. 华中师范大学学报: 自然科学版, 2022, 56(5): 771-780. |
TANG J, YU M H, WU M H, et al. Insulator defect detection algorithm based on improved YOLOv5[J]. Journal of Central China Normal University: Natural Sciences, 2022, 56(5): 771-780. (in Chinese) | |
[16] | 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[EB/OL]. [2022-10-02]. https://arxiv.org/abs/2207.02696. |
[17] | 胡欣, 马丽军. 基于YOLOv5的多分支注意力SAR图像舰船检测[J]. 电子测量与仪器学报, 2022, 36(8): 141-149. |
HU X, MA L J. Multi-branch attention SAR image ship detection based on YOLOv5[J]. Journal of Electronic Measurement and Instrumentation, 2022, 36(8): 141-149. (in Chinese) | |
[18] | HU J, SHEN L, ALBANIE S, et al. Squeeze-and-excitation networks[C]// IEEE/CVF Conference on Computer Vision and Pattern Recognition. New York: IEEE Press, 2018: 7132-7141. |
[19] | WOO S, PARK J, LEE J Y, et al. CBAM: convolutional block attention module[EB/OL]. [2022-10-02]. https://arxiv.org/abs/1807.06514. |
[20] | HUANG G, LIU Z, VAN DER MAATEN L, et al. Densely connected convolutional networks[C]// 2017 IEEE Conference on Computer Vision and Pattern Recognition. New York: IEEE Press, 2017: 2261-2269. |
[21] |
LIKAS A, VLASSIS N, J VERBEEK J. The global k-means clustering algorithm[J]. Pattern Recognition, 2003, 36(2): 451-461.
DOI URL |
[22] | ARTHUR D, VASSILVITSKII S. K-Means++: the advantages of careful seeding[EB/OL] [2022-10-02]. https://xueshu.baidu.com/usercenter/paper/show?paperid=5d168abdad2ea2ca220841fdd783f488. |
[23] | 东辉, 陈鑫凯, 孙浩, 等. 基于改进YOLOv4和图像处理的蔬菜田杂草检测[J]. 图学学报, 2022, 43(4): 559-569. |
DONG H, CHEN X K, SUN H, et al. Weed detection in vegetable field based on improved YOLOv4 and image processing[J]. Journal of Graphics, 2022, 43(4): 559-569. (in Chinese) | |
[24] | 张伟康, 孙浩, 陈鑫凯, 等. 基于改进YOLOv5的智能除草机器人蔬菜苗田杂草检测研究[J]. 图学学报, 2023, 44(2): 346-356. |
ZHANG W K, SUN H, CHEN X K, et al. Research on weed detection in vegetable seedling fields based on the improved YOLOv5 intelligent weeding robot[J]. Journal of Graphics, 2023, 44(2): 346-356. (in Chinese) | |
[25] | ZHOU B L, KHOSLA A, LAPEDRIZA A, et al. Learning deep features for discriminative localization[C]// 2016 IEEE Conference on Computer Vision and Pattern Recognition. New York: IEEE Press, 2016: 2921-2929. |
[26] | TIAN Z, SHEN C H, CHEN H, et al. FCOS: fully convolutional one-stage object detection[C]// 2019 IEEE/CVF International Conference on Computer Vision. New York: IEEE Press, 2020: 9626-9635. |
[27] | ZHANG S F, CHI C, YAO Y Q, et al. Bridging the gap between anchor-based and anchor-free detection via adaptive training sample selection[C]// 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition. New York: IEEE Press, 2020: 9756-9765. |
[28] | 蒋镕圻, 彭月平, 谢文宣, 等. 嵌入scSE模块的改进YOLOv4小目标检测算法[J]. 图学学报, 2021, 42(4): 546-555. |
JIANG R Q, PENG Y P, XIE W X, et al. Improved YOLOv4 small target detection algorithm with embedded scSE module[J]. Journal of Graphics, 2021, 42(4): 546-555. (in Chinese) | |
[29] | 胡俊, 顾晶晶, 王秋红. 基于遥感图像的多模态小目标检测[J]. 图学学报, 2022, 43(2): 197-204. |
HU J, GU J J, WANG Q H. Multimodal small target detection based on remote sensing image[J]. Journal of Graphics, 2022, 43(2): 197-204. (in Chinese) |
[1] | 李利霞, 王鑫, 王军, 张又元 .
基于特征融合与注意力机制的无人机图像小目标检测算法
[J]. 图学学报, 2023, 44(4): 658-666. |
[2] | 郝帅, 赵新生, 马旭, 张旭, 何田, 侯李祥.
基于 TR-YOLOv5 的输电线路多类缺陷目标检测方法
[J]. 图学学报, 2023, 44(4): 667-676. |
[3] | 曹义亲 , 周一纬 , 徐露 .
基于 E-YOLOX 的实时金属表面缺陷检测算法
[J]. 图学学报, 2023, 44(4): 677-690. |
[4] | 李鑫, 普园媛, 赵征鹏, 徐丹, 钱文华 .
内容语义和风格特征匹配一致的艺术风格迁移
[J]. 图学学报, 2023, 44(4): 699-709. |
[5] | 余伟群, 刘佳涛, 张亚萍.
融合注意力的拉普拉斯金字塔单目深度估计
[J]. 图学学报, 2023, 44(4): 728-738. |
[6] | 李刚, 张运涛, 汪文凯, 张东阳. 采用DETR与先验知识融合的输电线路螺栓缺陷检测方法[J]. 图学学报, 2023, 44(3): 438-447. |
[7] | 毛爱坤, 刘昕明, 陈文壮, 宋绍楼. 改进YOLOv5算法的变电站仪表目标检测方法[J]. 图学学报, 2023, 44(3): 448-455. |
[8] | 郝鹏飞, 刘立群, 顾任远. YOLO-RD-Apple果园异源图像遮挡果实检测模型[J]. 图学学报, 2023, 44(3): 456-464. |
[9] | 罗文宇, 傅明月. 基于YoloX-ECA模型的非法野泳野钓现场监测技术[J]. 图学学报, 2023, 44(3): 465-472. |
[10] | 李雨, 闫甜甜, 周东生, 魏小鹏. 基于注意力机制与深度多尺度特征融合的自然场景文本检测[J]. 图学学报, 2023, 44(3): 473-481. |
[11] | 吴文欢, 张淏坤. 融合空间十字注意力与通道注意力的语义分割网络[J]. 图学学报, 2023, 44(3): 531-539. |
[12] | 谢国波, 贺笛轩, 何宇钦, 林志毅. 基于 P-CenterNet 的光学遥感图像烟囱检测[J]. 图学学报, 2023, 44(2): 233-249. |
[13] | 熊举举 , 徐杨 , 范润泽 , 孙少聪 . 基于轻量化视觉 Transformer 的花卉识别 [J]. 图学学报, 2023, 44(2): 271-279. |
[14] | 陈刚 , 张培基 , 龚冬冬 , 于俊清 . 火电厂监控视频安全服检测方法研究[J]. 图学学报, 2023, 44(2): 291-297. |
[15] | 成浪, 敬超. 基于改进 YOLOv7 的 X 线图像旋转目标检测[J]. 图学学报, 2023, 44(2): 324-334. |
阅读次数 | ||||||
全文 |
|
|||||
摘要 |
|
|||||