-
摘要
针对钢材表面缺陷区域小目标居多,现有大部分方法无法均衡检测精度和速度的问题,提出一种基于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算法对钢材表面区域小目标的检测更有效,实验表明改进后的算法能够更好地均衡检测精度和速度。
-
关键词:
- 缺陷检测 /
- YOLOv7-tiny /
- GAC-FPN网络 /
- 双层路由注意力 /
- SIoU
Abstract
Given that small targets are predominant in the steel surface defect areas, most existing methods cannot balance the trade-off between detection accuracy and speed. In this paper, we propose a steel surface defect detection algorithm based on YOLOv7-tiny (GBS-YOLOv7t). Firstly, we design the GAC-FPN network to fully integrate the target semantic information progressively and across layers, aiming to address the limited information flow issue in traditional feature pyramids. Secondly, we embed a bi-level routing attention (BRA) module to endow the model with dynamic query and sparse perception capabilities, thus enhancing the detection accuracy of small targets. Thirdly, we introduce the SIoU loss function to improve the training and inference capabilities of the model, and to enhance the network robustness. Experimental validation on the public dataset NEU-DET demonstrates an mAP of 72.9% and a precision of 69.9% for GBS-YOLOv7t, achieving improvements of 4.2% and 8.5%, respectively, over the original YOLOv7-tiny model. The FPS reaches 104.1 frames, indicating strong real-time performance. Compared to other detection algorithms, GBS-YOLOv7t is more effective in detecting small targets in steel surface areas, with experimental results showing that the improved algorithm better balances the detection accuracy and speed.
-
Key words:
- defect detection /
- YOLOv7-tiny /
- GAC-FPN network /
- bi-level routing attention /
- SIoU
-
Overview
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 GAS-FPN消融实验结果
Table 1. Results of GAS-FPN ablation experiment
A B mAP/% Params/M FLOPs/G FPS 69.2 7.11 14.1 106.38 √ 70.7 7.44 14.6 94.34 √ √ 71.9 6.56 13.2 111.11 表 2 GAS-FPN对比实验
Table 2. Comparison experiment of GAS-FPN
Model mAP/% Params/M FPS PANet 68.7 6.02 108.12 AFPN 69.2 7.11 106.38 GAC-FPN 71.9 6.56 111.11 表 3 BRA位置实验结果
Table 3. Experimental results of BRA position
Location mAP/% Params/M FPS Baseline 68.7 6.02 108.69 Stage3 69.0 6.09 79.37 Stage4 69.9 6.20 104.17 Stage5 69.3 7.08 111.11 表 4 BRA对比实验
Table 4. BRA comparison experiments
Model mAP/% Params/M FLOPs/G Baseline 68.7 6.02 13.1 SE 69.3 11.57 30.8 TA 68.9 6.02 13.2 CA 68.3 6.03 13.5 BRA (Ours) 69.9 6.20 13.2 表 5 消融实验结果
Table 5. Results of ablation experiment
M1 M2 M3 mAP/% Params/M P/% R/% 68.7 6.02 61.4 72.7 √ 71.9 6.56 63.8 70.2 √ √ 72.5 6.56 65.3 73.5 √ √ √ 72.9 6.83 69.9 70.5 表 6 对比实验结果
Table 6. Comparison of the experimental results
-
参考文献
[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
-
访问统计