-
摘要
针对复杂背景下焊接缺陷特征不明显、背景信息复杂,导致传统缺陷检测算法在实际应用中精度不佳,特征丢失等问题,本文提出一种改进自YOLOv8的焊缝表面缺陷检测算法(GD-YOLO)。模型首先引进特征提取模块与卷积模块融合,增强模型信息的提取能力;然后在颈部网络中嵌入Slim-Neck结构并在特征融合阶段引用上采样算子CAFARE,辅助增强模型性能;其次,改进注意力机制模块,使之在不显著增加计算负担的情况下,优化整体性能;最后,改用损失函数Inner-SIoU,解决边界框不匹配的问题。实验结果表明,本文模型mAP0.5检测指标比基线模型高7.8%,参数量和计算量分别减少了0.12 M、0.7 G。
-
关键词:
- 深度学习 /
- 缺陷检测 /
- YOLOv8 /
- Inner-SIoU
Abstract
In response to the problems of traditional defect detection algorithms, such as poor accuracy and feature loss in practical applications due to the inconspicuous characteristics of welding defects and complex background information, this paper proposes a welding surface defect detection algorithm based on the improved YOLOv8 (GD-YOLO). The model first introduces the fusion of feature extraction modules and convolutional modules to enhance its information extraction capabilities. Then, a slim-neck structure is embedded in the neck network, and the upsampling operator CAFARE is referenced in the feature fusion stage to assist in enhancing the model's performance. Subsequently, the attention mechanism module is improved to optimize the overall performance without significantly increasing the computational burden. Finally, the loss function is changed to Inner-SIOU to address the problem of mismatched bounding boxes. Experimental results show that the mAP0.5 detection metric of the model in this paper is 7.8% higher than that of the baseline model, and the number of parameters and the amount of computation are reduced by 0.2 M and 0.7 G, respectively.
-
Key words:
- deep learning /
- defect detection /
- YOLOv8 /
- Inner-SIoU
-
Overview
Overview: The welding quality of steel thin plates is of paramount importance in modern industrial production, with its widespread use in sectors such as intelligent manufacturing, industrial construction, and aerospace. Weld defects can lead to significant safety and performance issues, making the detection of these flaws a critical task. In light of this, this paper introduces an enhanced YOLOv8-based algorithm for weld surface defect detection, named GD-YOLO. The development of GD-YOLO begins with the introduction of a novel feature extraction module, C2f-DWR, which integrates the lightweight attention mechanism DWR with the feature extraction module C2f. This replacement of the original C2f module is designed to boost the model's efficiency in gathering information during real-time detection. The integration of the Slim-Neck structure into the neck network further reduces the algorithm's complexity and enhances its ability to detect the rough edges of defects. The algorithm also incorporates the upsampling operator CAFARE in the feature fusion stage, replacing the traditional Upsample operator. This change is aimed at increasing the resolution of feature maps and the transmission of semantic information, which is vital for accurate defect detection. Additionally, the improved attention mechanism module GD-CBAM is incorporated into the backbone network of YOLOv8, which not only accelerates the inference speed but also ensures that the model remains lightweight and efficient. To address the common issue of mismatch between the true and predicted bounding boxes, the GD-YOLO model employs the Inner-SIOU bounding box regression loss function. This function is specifically designed to minimize the discrepancies between the actual defect locations and the model's predictions. Empirical evidence from experiments demonstrates that the proposed GD-YOLO model outperforms the original YOLOv8 by 7.8% in the mAP0.5 detection metric, a significant improvement in accuracy. Moreover, the model shows a reduction of 0.2 M in parameter quantity and 0.7 G in computational load, making it more efficient than its predecessor. Compared to other target defect detection models, GD-YOLO exhibits a clear advantage in terms of detection accuracy. Ablation experiments conducted to validate the effectiveness of each module within the GD-YOLO framework confirm that each component contributes positively to the overall performance of the model. Furthermore, generalization experiments substantiate the improved algorithm's ability to perform well across different datasets, indicating its robustness and versatility in various real-world applications. In conclusion, GD-YOLO represents a significant advancement in steel thin plate weld defect detection, offering a more accurate, efficient, and reliable solution for industrial quality control.
-
-
表 1 损失函数对比
Table 1. Loss function comparison
IoU loss function mAP0.5/% R/% Params/M CIoU 94.6 89.3 2.89 SIoU 92.9 85.1 2.89 GIoU 94.0 88.9 2.89 EIoU 93.3 90.3 2.89 DIoU 93.8 91.7 2.89 WIoU 95.0 89.4 2.89 Inner-SIoU 95.3 89.4 2.89 表 2 消融实验结果
Table 2. Ablation experiments results
C2f-DWR CARAFE GSConv Inner-SIoU GD-CBAM mAP0.5/% P/% R/% FLOPs/G Params/M FPS 87.5 85.5 81.4 8.1 3.01 247 √ 95.1 91.1 88.9 8.0 2.95 286 √ 94.2 90.6 88.7 8.4 3.15 132 √ 94.4 89.9 90.1 7.3 2.79 273 √ 90.9 89.1 88.3 8.1 3.01 259 √ √ 95.9 92.0 89.5 11.6 3.35 318 √ √ √ 96.5 92.3 89.9 11.6 3.35 322 √ √ √ √ 94.6 91.2 89.3 7.4 2.89 243 √ √ √ √ √ 95.3 90.7 89.4 7.4 2.89 257 表 3 对比实验
Table 3. Results of comparison experiments
Model mAP0.5/% P/% R/% FLOPs/G Params/M FPS YOLOv8n(baseline) 87.5 85.5 81.4 8.1 3.01 247 Faster R-CNN 79.8 83.1 77.9 33.3 41.20 95 YOLOv3-tiny 93.4 93.0 88.1 19.0 12.13 242 YOLOv5n 85.7 84.5 78.7 7.1 2.51 282 YOLOv6n 85.0 84.2 78.1 11.8 4.23 285 YOLOv9t 87.4 85.2 80.1 7.6 1.97 229 YOLOv10n 94.3 88.3 88.6 6.5 2.26 292 RT-DETR 90.7 89.5 82.9 110.2 32.01 117 YOLOv11n 94.2 89.1 89.6 6.3 2.58 307 Ours 95.3 90.7 89.4 7.4 2.89 257 表 4 NEU-DET数据集对比实验结果
Table 4. Experimental results of NEU-DET dataset
Model mAP0.5/% P/% R/% FLOPs/G YOLOv5m 74.8 71.2 69.0 48.0 YOLOv7 73.7 66.3 68.6 104.7 YOLOv8s 74.7 69.1 69.0 28.4 YOLOv8n 77.3 71.9 70.0 8.1 YOLOv9t 73.8 69.7 70.3 7.6 YOLOv11n 77.9 73.9 74.6 6.5 RT-DETR 76.7 72.4 70.2 110.2 WFRE-YOLOv8s 79.4 73.6 75.9 32.6 Ours 78.8 75.2 75.7 7.4 -
参考文献
[1] 梁礼明, 龙鹏威, 卢宝贺, 等. 改进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
[2] 苏虎, 张家斌, 张博豪, 等. 基于视觉感知的表面缺陷检测综述[J]. 计算机集成制造系统, 2023, 29(1): 169−191. doi: 10.13196/j.cims.2023.01.015
Su H, Zhang J B, Zhang B H, et al. Review of surface defect inspection based on visual perception[J]. Comput Integr Manuf Syst, 2023, 29(1): 169−191. doi: 10.13196/j.cims.2023.01.015
[3] 阳丽莎, 李茂军, 胡建文, 等. 基于改进YOLOv7-tiny的带钢表面缺陷检测算法[J]. 计算机工程, 2025, 51(1): 208−215. doi: 10.19678/j.issn.1000-3428.0068397
Yang L S, Li M J, Hu J W, et al. Strip steel surface defect detection algorithm based on improved YOLOv7-tiny[J]. Comput Eng, 2025, 51(1): 208−215. doi: 10.19678/j.issn.1000-3428.0068397
[4] Liu W, Anguelov D, Erhan D, et al. SSD: single shot multibox detector[C]//Proceedings of the 14th European Conference on Computer Vision, Amsterdam, 2016: 21–37. https://doi.org/10.1007/978-3-319-46448-0_2.
[5] Redmon J. You only look once: unified, real-time object detection[C]//Proceedings of 2016 IEEE Conference on Computer Vision and Pattern Recognition, 2016: 779–788. https://doi.org/10.1109/CVPR.2016.91.
[6] Wang C, Bochkovskiy A, Liao H M. YOLOv7: trainable bag-of-freebies sets new state-of-the-art for real-time object detectors[C]//Proceedings of 2013 IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022: 7464–7475. https://doi.org/10.1109/CVPR52729.2023.00721.
[7] Girshick R. Fast R-CNN[C]//Proceedings of 2015 IEEE International Conference on Computer Vision, Santiago, 2015: 1440–1448. https://doi.org/10.1109/ICCV.2015.169.
[8] He K M, Gkioxari G, Dollár P, et al. Mask R-CNN[C]//Proceedings of 2017 IEEE International Conference on Computer Vision, 2017: 2980–2988. https://doi.org/10.1109/ICCV.2017.322.
[9] Sun X D, Wu P C, Hoi S C H. Face detection using deep learning: an improved faster RCNN approach[J]. Neurocomputing, 2018, 299: 42−50. doi: 10.1016/j.neucom.2018.03.030
[10] 穆春阳, 李闯, 马行, 等. 改进YOLOv7-tiny的轻量化大型铸件焊缝缺陷检测[J]. 组合机床与自动化加工技术, 2024, (7): 156−160. doi: 10.13462/j.cnki.mmtamt.2024.07.032
Mu C Y, Li C, Ma X, et al. Improved YOLOv7-tiny lightweight large casting weld defect detection[J]. Modular Mach Tool Autom Manuf Tech, 2024, (7): 156−160. doi: 10.13462/j.cnki.mmtamt.2024.07.032
[11] 李其鹏, 缪海波, 李志文, 等. 基于改进YOLOv7-tiny焊缝表面缺陷检测算法[J]. 焊接技术, 2024, 53(7): 123−126. doi: 10.13846/j.cnki.cn12-1070/tg.2024.07.012
Li Q P, Miao H B, Li Z W, et al. Weld surface defect detection based on the improved YOLOv7-tiny algorithm[J]. Weld Technol, 2024, 53(7): 123−126. doi: 10.13846/j.cnki.cn12-1070/tg.2024.07.012
[12] 宋杰三. 基于改进Yolov8的焊缝缺陷检测研究[J]. 中国设备工程, 2024, (14): 196−199
Song J S. Research on weld defect detection based on improved Yolov8[J]. China Plant Engineering, 2024, (14): 196−199
[13] 张恩召, 李磊, 汪建华, 等. 基于改进YOLOv8的船板焊缝质量检测方法[J]. 陕西科技大学学报, 2024, 42(6): 172−179. doi: 10.3969/j.issn.1000-5811.2024.06.021
Zhang E Z, Li L, Wang J H, et al. Improved YOLOv8-based quality inspection method for ship plate welds[J]. J Shaanxi Univ Sci Technol, 2024, 42(6): 172−179. doi: 10.3969/j.issn.1000-5811.2024.06.021
[14] 李先旺, 贺岁球, 贺德强, 等. 基于改进YOLOv8的地铁列车焊缝缺陷轻量化检测方法[J]. 广西大学学报(自然科学版), 2024, 49(3): 540−552. doi: 10.13624/j.cnki.issn.1001-7445.2024.0540
Li X W, He S Q, He D Q, et al. Lightweight detection method for weld defects of metro train based on improved YOLOv8[J]. J Guangxi Univ (Nat Sci Ed), 2024, 49(3): 540−552. doi: 10.13624/j.cnki.issn.1001-7445.2024.0540
[15] 吴磊, 储钰昆, 杨洪刚, 等. 面向铝合金焊缝DR图像缺陷的Sim-YOLOv8目标检测模型[J]. 中国激光, 2024, 51(16): 1602103. doi: 10.3788/CJL231485
Wu L, Chu Y K, Yang H C, et al. Sim-YOLOv8 object detection model for DR image defects in aluminum alloy welds[J]. Chin J Lasers, 2024, 51(16): 1602103. doi: 10.3788/CJL231485
[16] Lin T Y, Dollár P, Girshick R, et al. Feature pyramid networks for object detection[C]//Proceedings of 2017 IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, 2017: 936–944. https://doi.org/10.1109/CVPR.2017.106.
[17] Wei H R, Liu X, Xu S C, et al. DWRSeg: rethinking efficient acquisition of multi-scale contextual information for real-time semantic segmentation[Z]. arXiv: 2212.01173, 2022. https://arxiv.org/abs/2212.01173.
[18] Wang J, Chen K, Xu R, et al. CARAFE: content-aware ReAssembly of features[C]//Proceedings of 2019 IEEE/CVF International Conference on Computer Vision, 2019: 3007–3016. https://doi.org/10.1109/ICCV.2019.00310.
[19] Li H L, Li J, Wei H B, et al. Slim-neck by GSConv: a lightweight-design for real-time detector architectures[J]. J Real Time Image Process, 2022, 21(3): 62. doi: 10.1007/s11554-024-01436-6
[20] Zhang H, Xu C, Zhang S J. Inner-IoU: more effective intersection over union loss with auxiliary bounding box[Z]. arXiv: 2311.02877, 2023. https://arxiv.org/abs/2311.02877.
[21] Gevorgyan Z. SIoU loss: more powerful learning for bounding box regression[Z]. arXiv: 2205.12740, 2022. https://arxiv.org/abs/2205.12740.
[22] Rezatofighi H, Tsoi N, Gwak J, et al. Generalized intersection over union: a metric and a loss for bounding box regression[C]//Proceedings of 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2019: 658–666. https://doi.org/10.1109/CVPR.2019.00075.
[23] Zhang Y F, Ren W Q, Zhang Z, et al. Focal and efficient IOU loss for accurate bounding box regression[J]. Neurocomputing, 2022, 506: 146−157. doi: 10.1016/j.neucom.2022.07.042
[24] Zheng Z H, Wang P, Liu W, et al. Distance-IoU loss: faster and better learning for bounding box regression[C]//Proceedings of the 34th AAAI Conference on Artificial Intelligence, 2020: 12993–13000. https://doi.org/10.1609/aaai.v34i07.6999.
[25] Tong Z J, Chen Y H, Xu Z W, et al. Wise-IoU: bounding box regression loss with dynamic focusing mechanism[Z]. arXiv: 2301.10051, 2023. https://arxiv.org/abs/2301.10051.
[26] Huang Y, Tan W, Li L, et al. WFRE-YOLOv8s: a new type of defect detector for steel surfaces[J]. Coatings, 2023, 13(12): 2010. doi: 10.3390/coatings13122010
-
访问统计