改进GBS-YOLOv7t的钢材表面缺陷检测

梁礼明,龙鹏威,卢宝贺,等. 改进GBS-YOLOv7t的钢材表面缺陷检测[J]. 光电工程,2024,51(5): 240044. doi: 10.12086/oee.2024.240044
引用本文: 梁礼明,龙鹏威,卢宝贺,等. 改进GBS-YOLOv7t的钢材表面缺陷检测[J]. 光电工程,2024,51(5): 240044. doi: 10.12086/oee.2024.240044
Liang L M, Long P W, Lu B H, et al. Improvement of GBS-YOLOv7t for steel surface defect detection[J]. Opto-Electron Eng, 2024, 51(5): 240044. doi: 10.12086/oee.2024.240044
Citation: Liang L M, Long P W, Lu B H, et al. Improvement of GBS-YOLOv7t for steel surface defect detection[J]. Opto-Electron Eng, 2024, 51(5): 240044. doi: 10.12086/oee.2024.240044

改进GBS-YOLOv7t的钢材表面缺陷检测

  • 基金项目:
    国家自然科学基金资助项目(51365017,61463018);江西省自然科学基金面上项目(20192BAB205084);江西省教育厅科学技术研究重点项目(GJJ170491);江西省研究生创新专项资金项目(YC2022-S676)
详细信息
    作者简介:
    *通讯作者: 龙鹏威,2637018663@qq.com
  • 中图分类号: TP391.4

Improvement of GBS-YOLOv7t for steel surface defect detection

  • Fund Project: Project supported by National Natural Science Foundation of China (51365017, 61463018), Jiangxi Provincial Natural Science Foundation (20192BAB205084), Jiangxi Provincial Department of Education Scientific and Technological Research Key Project (GJJ170491), and Jiangxi Provincial Postgraduate Innovation Special Funds Project (YC2022-S676)
More Information
  • 针对钢材表面缺陷区域小目标居多,现有大部分方法无法均衡检测精度和速度的问题,提出一种基于YOLOv7-tiny的钢材表面缺陷检测算法(GBS-YOLOv7t)。该方法一是设计GAC-FPN网络,采用渐进和跨层的方式充分融合目标语义信息,以改善传统特征金字塔中存在限制信息流问题;二是嵌入双层路由注意力模块,使模型具备动态查询和感知稀疏性能力,以提高对小目标的检测精度;三是引入SIoU损失函数,提升模型训练和推理能力,增强网络鲁棒性。最后在公共数据集NEU-DET进行实验验证,mAP和精确度分别为72.9%和69.9%,相较于YOLOv7-tiny原模型分别提升4.2%和8.5%;FPS达到104.1帧,具有较强实时性;与其他检测算法相比,GBS-YOLOv7t算法对钢材表面区域小目标的检测更有效,实验表明改进后的算法能够更好地均衡检测精度和速度。

  • Overview: Aiming at the problem that most of the existing methods are unable to equalize the detection accuracy and the speed because of the predominance of small targets in the defective region of the steel surface, this paper proposes a steel surface defect detection algorithm based on YOLOv7-tiny (GBS-YOLOv7t). The method, firstly, takes into account that the feature fusion network of the original YOLOv7-tiny model adopts the traditional path aggregation network (PANet), which is designed with a bottom-up structure, but the bottom-up structure will have the problem of limiting the information flow. To address this problem, this paper compresses the model complexity and further preserves the semantic information of small targets by introducing the asymptotic feature pyramid (AFPN), and on its basis, by introducing the ghost shuffle mixing convolution (GSConv) and cross-layer connectivity. Based on the above improvements, the Ghost Asymptotic Cross-layer Fusion Network (GAC-FPN) is designed and replaces the original YOLOv7-tiny path aggregation network. The GAC-FPN network adopts an asymptotic and cross-layer approach to fully fuse the semantic information of the target features, which effectively improves the problem of restricting the flow of information in the top-down structure in the traditional feature pyramid. Secondly, to increase the model's accuracy in detecting the small targets. To improve the detection accuracy of the model for small targets, a Bi-Level Routing Attention module is embedded in the backbone network, and the optimal location of the module in the backbone network is verified through experiments, and the results show that the module makes the model possess the ability of dynamic querying and sparsity perception while taking into account the number of network parameters and the computational complexity, which effectively improves the detection accuracy of the model for small targets; thirdly, a SIoU loss function is introduced to replace the CIoU loss function of the original network, effectively improving the model training and reasoning ability, which improves the model training and inference ability, and enhances the network robustness. Finally, experimental validation is carried out on the publicly available Northeastern University Steel Surface Defect Dataset (NEU-DET), and the experimental results show that the mAP and accuracy of the GBS-YOLOv7t algorithm reach 72.9% and 69.9%, respectively, which are improved by 4.2% and 8.5%, respectively, compared with the original model of YOLOv7-tiny; the FPS reaches 104.1 frames, which is strong real-time performance. Compared with other classical detection models and current mainstream algorithms, the GBS-YOLOv7t algorithm has better performance and is more effective in detecting small targets on the surface area of steel, and the experiments show that the improved algorithm better balances lightweight, detection accuracy and speed.

  • 加载中
  • 图 1  GBS-YOLOv7t网络结构

    Figure 1.  Network structure of GBS-YOLOv7t

    图 2  GAC-FPN网络结构

    Figure 2.  GAC-FPN network structure

    图 3  GSConv网络结构

    Figure 3.  GSConv network structure

    图 4  BRA网络结构

    Figure 4.  BRA network structure

    图 5  SIoU损失函数计算方式

    Figure 5.  Calculation method of SIoU loss function

    图 6  钢材表面各类缺陷图像

    Figure 6.  Images of various defects on steel surface

    图 7  GAC-FPN、PANet和AFPN网络检测各类缺陷AP值对比

    Figure 7.  Comparison of AP values of GAC-FPN, PANet and AFPN networks for detecting various types of defects

    图 8  改进算法检测结果对比

    Figure 8.  Comparison of detection results of the improved algorithm

    图 9  本文算法与其他算法检测效果对比

    Figure 9.  Comparison of detection effect between the proposed algorithm and other algorithms

    表 1  GAS-FPN消融实验结果

    Table 1.  Results of GAS-FPN ablation experiment

    ABmAP/%Params/MFLOPs/GFPS
    69.27.1114.1106.38
    70.77.4414.694.34
    71.96.5613.2111.11
    下载: 导出CSV

    表 2  GAS-FPN对比实验

    Table 2.  Comparison experiment of GAS-FPN

    ModelmAP/%Params/MFPS
    PANet68.76.02108.12
    AFPN69.27.11106.38
    GAC-FPN71.96.56111.11
    下载: 导出CSV

    表 3  BRA位置实验结果

    Table 3.  Experimental results of BRA position

    LocationmAP/%Params/MFPS
    Baseline68.76.02108.69
    Stage369.06.0979.37
    Stage469.96.20104.17
    Stage569.37.08111.11
    下载: 导出CSV

    表 4  BRA对比实验

    Table 4.  BRA comparison experiments

    ModelmAP/%Params/MFLOPs/G
    Baseline68.76.0213.1
    SE69.311.5730.8
    TA68.96.0213.2
    CA68.36.0313.5
    BRA (Ours)69.96.2013.2
    下载: 导出CSV

    表 5  消融实验结果

    Table 5.  Results of ablation experiment

    M1M2M3mAP/%Params/MP/%R/%
    68.76.0261.472.7
    71.96.5663.870.2
    72.56.5665.373.5
    72.96.8369.970.5
    下载: 导出CSV

    表 6  对比实验结果

    Table 6.  Comparison of the experimental results

    ModelmAP/%Params/MFPS
    Faster R-CNN65.772.017.8
    SSD61.024.441.0
    YOLOv367.061.531.5
    YOLOv451.052.545.0
    YOLOv5s70.17.07102.0
    YOLOX-s71.88.046.0
    YOLOv770.037.236.1
    YOLOv7-tiny68.76.02108.1
    FCOS68.843.212.0
    RetinaNet69.518.315.1
    PC-YOLOv7[13]71.25.9761.0
    文献[22]73.09.54
    文献[23]74.123.975
    GBS-YOLOv7t72.96.83104.1
    下载: 导出CSV
  • [1]

    陈海永, 赵鹏, 闫皓炜. 融合注意力的多尺度Faster RCNN的裂纹检测[J]. 光电工程, 2021, 48(1): 200112. doi: 10.12086/oee.2021.200112

    Chen H Y, Zhao P, Yan H W. Crack detection based on multi-scale Faster RCNN with attention[J]. Opto-Electron Eng, 2021, 48(1): 200112. doi: 10.12086/oee.2021.200112

    [2]

    梁礼明, 卢宝贺, 龙鹏威, 等. 自适应特征融合级联Transformer视网膜血管分割算法[J]. 光电工程, 2023, 50(10): 230161. doi: 10.12086/oee.2023.230161

    Liang L M, Lu B H, Long P W, et al. Adaptive feature fusion cascade transformer retinal vessel segmentation algorithm[J]. Opto-Electron Eng, 2023, 50(10): 230161. doi: 10.12086/oee.2023.230161

    [3]

    赵朗月, 吴一全. 基于机器视觉的表面缺陷检测方法研究进展[J]. 仪器仪表学报, 2023, 43(1): 198−219. doi: 10.19650/j.cnki.cjsi.J2108805

    Zhao L Y, Wu Y Q. Research progress of surface defect detection methods based on machine vision[J]. Chin J Sci Instrum, 2023, 43(1): 198−219. doi: 10.19650/j.cnki.cjsi.J2108805

    [4]

    Liu Z, Yeoh J K W, Gu X Y, et al. Automatic pixel-level detection of vertical cracks in asphalt pavement based on GPR investigation and improved mask R-CNN[J]. Autom Constr, 2023, 146: 104689. doi: 10.1016/j.autcon.2022.104689

    [5]

    Zhang W M, Zhu Q K, Li Y Q, et al. MAM Faster R-CNN: improved Faster R-CNN based on malformed attention module for object detection on X-ray security inspection[J]. Digital Signal Process, 2023, 139: 104072. doi: 10.1016/j.dsp.2023.104072

    [6]

    Hu B, Wang J H. Detection of PCB surface defects with improved faster-RCNN and feature pyramid network[J]. IEEE Access, 2020, 8: 108335−108345. doi: 10.1109/ACCESS.2020.3001349

    [7]

    Qian H M, Wang H L, Feng S, et al. FESSD: SSD target detection based on feature fusion and feature enhancement[J]. J Real-Time Image Process, 2023, 20(1): 2. doi: 10.1007/s11554-023-01258-y

    [8]

    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

    [9]

    Lin T Y, Dollár P, Girshick R, et al. Feature pyramid networks for object detection[C]//Proceedings of the 2017 IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, 2017: 936–944. https://doi.org/10.1109/CVPR.2017.106.

    [10]

    Liu S, Qi L, Qin H F, et al. Path aggregation network for instance segmentation[C]//Proceedings of the 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Salt Lake City, 2018: 8759–8768. https://doi.org/10.1109/CVPR.2018.00913.

    [11]

    方钧婷, 谭晓阳. 注意力级联网络的金属表面缺陷检测算法[J]. 计算机科学与探索, 2021, 15(7): 1245−1254. doi: 10.3778/j.issn.1673-9418.2007005

    Fang J T, Tan X Y. Defect detection of metal surface based on attention cascade R-CNN[J]. J Front Comput Sci Technol, 2021, 15(7): 1245−1254. doi: 10.3778/j.issn.1673-9418.2007005

    [12]

    熊聪, 于安宁, 高兴华, 等. 基于改进YOLOX的钢材表面缺陷检测算法[J]. 电子测量技术, 2023, 46(9): 151−157. doi: 10.19651/j.cnki.emt.2211012

    Xiong C, Yu A N, Gao X H, et al. Steel surface defect detection algorithm based on improved YOLOX[J]. Electron Meas Technol, 2023, 46(9): 151−157. doi: 10.19651/j.cnki.emt.2211012

    [13]

    赵春华, 罗顺, 谭金铃, 等. 基于PC-YOLOv7算法钢材表面缺陷检测[J]. 国外电子测量技术, 2023, 42(9): 137−145. doi: 10.19652/j.cnki.femt.2304998

    Zhao C H, Luo S, Tan J L, et al. Detection of steel surface defects based on PC-YOLOv7 algorithm[J]. Foreign Electron Meas Technol, 2023, 42(9): 137−145. doi: 10.19652/j.cnki.femt.2304998

    [14]

    Lian J W, He J H, Niu Y, et al. Fast and accurate detection of surface defect based on improved YOLOv4[J]. Assem Autom, 2022, 42(1): 134−146. doi: 10.1108/AA-04-2021-0044

    [15]

    马燕婷, 赵红东, 阎超, 等. 改进YOLOv5网络的带钢表面缺陷检测方法[J]. 电子测量与仪器学报, 2022, 36(8): 150−157. doi: 10.13382/j.jemi.B2205354

    Ma Y T, Zhao H D, Yan C, et al. Strip steel surface defect detection method by improved YOLOv5 network[J]. J Electron Meas Instrum, 2022, 36(8): 150−157. doi: 10.13382/j.jemi.B2205354

    [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[C]//Proceedings of the 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, 2023: 7464–7475. https://doi.org/10.1109/CVPR52729.2023.00721.

    [17]

    Yang G Y, Lei J, Zhu Z K, et al. AFPN: Asymptotic feature pyramid network for object detection[C]//2023 IEEE International Conference on Systems, Man, and Cybernetics, Honolulu, 2023: 2184–2189. https://doi.org/10.1109/SMC53992.2023.10394415.

    [18]

    Li H L, Li J, Wei H B, et al. Slim-neck by GSConv: A better design paradigm of detector architectures for autonomous vehicles[Z]. arXiv: 2206.02424, 2022. https://doi.org/10.48550/arXiv.2206.02424.

    [19]

    Liu S T, Huang D, Wang Y H. Learning spatial fusion for single-shot object detection[Z]. arXiv: 1911.09516, 2019. https://doi.org/10.48550/arXiv.1911.09516.

    [20]

    Zhu L, Wang X J, Ke Z H, et al. BiFormer: Vision transformer with bi-level routing attention[C]//Proceedings of the 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, 2023: 10323–10333. https://doi.org/10.1109/CVPR52729.2023.00995.

    [21]

    Gevorgyan Z. SIoU loss: More powerful learning for bounding box regression[Z]. arXiv: 2205.12740, 2022. https://doi.org/10.48550/arXiv.2205.12740.

    [22]

    Li Z G, Wei X M, Hassaballah M, et al. A deep learning model for steel surface defect detection[J]. Complex Intell Syst, 2024, 10(1): 885−897. doi: 10.1007/s40747-023-01180-7

    [23]

    曹义亲, 伍铭林, 徐露. 基于改进YOLOv5算法的钢材表面缺陷检测[J]. 图学学报, 2023, 44(2): 335−345. doi: 10.11996/JG.j.2095-302X.2023020335

    Cao Y Q, Wu M L, Xu L. Steel surface defect detection based on improved YOLOv5 algorithm[J]. J Graphics, 2023, 44(2): 335−345. doi: 10.11996/JG.j.2095-302X.2023020335

  • 加载中

(10)

(6)

计量
  • 文章访问数: 
  • PDF下载数: 
  • 施引文献:  0
出版历程
收稿日期:  2024-02-29
修回日期:  2024-03-20
录用日期:  2024-03-22
刊出日期:  2024-05-25

目录

/

返回文章
返回