基于多头注意力机制的改进YOLOv8的钢结构防腐涂层缺陷检测
Improved YOLOv8 Based on Multi-Head Attention Mechanism for Defect Detection of Anti-Corrosion Coatings on Steel Structures
钢结构耐腐蚀能力差,需要防腐涂层进行保护,涂层老化会导致防腐效果降低甚至失效,因此对防腐涂层的维护至关重要。本文构建了用于服役钢结构防腐涂层缺陷检测的数据集,并提出了一种基于多种注意力机制改进的YOLOv8算法,用于检测钢结构防腐涂层中的缺陷。对Backbone中的C2f模块加入了多尺度的可变形注意力机制,提高对小目标的检测能力。Head采用了融合自注意力机制的Dynamic Head,增强了尺度感知、空间感知和任务感知能力。采用优化分类损失函数Slide Loss来解决数据集中样本不均衡的问题,优化IoU损失函数使Shape IoU提升了多尺度目标的检测能力。所提出的改进算法解决了传统机器学习图像分类模型无法进行多缺陷检测、泛化性能不强的问题,与YOLOv8基线算法相比,改进算法提高了5.82%的精确率、5.01%的召回率和4.78%的mAP指标。
Steel structures have poor corrosion resistance and require anti-corrosion coatings for protection. Coating aging can reduce or even eliminate the anti-corrosion effects, making the maintenance of their anti-corrosion coatings crucial. This study independently constructs a dataset for defect detection of anti-corrosion coatings on steel structures in service, and proposes an improved YOLOv8 algorithm based on multiple attention mechanisms for detecting defects in anti-corrosion coatings on steel structures. A multi-scale deformable attention mechanism is added to the C2f module in Backbone to improve its ability to detect small targets. The Head adopts a Dynamic Head that integrates a self-attention mechanism to enhance scale, spatial, and task awareness. The classification loss function is optimized as Slide Loss to address sample imbalance in the dataset, and the IoU loss function is optimized as Shape IoU to enhance the detection capability of multi-scale targets. The proposed improved algorithm overcomes the limitations of traditional machine learning image classification models that cannot perform multi-defect detection and have weak generalization performance. Compared with the YOLOv8 baseline algorithm, the improved algorithm improves precision by 5.82%, recall by 5.01%, and mAP index by 4.78%, respectively.
| [1] |
SOUFEIANI L, FOLIENTE G, NGUYEN K T Q, et al. Corrosion protection of steel elements in façade systems-A review[J]. Journal of Building Engineering, 2020, 32: 101759. DOI:10.1016/j.jobe.2020.101759. |
| [2] |
吕大财, 陈向东, 朱飞, 钢结构涂装红外热成像技术检测的影响因素分析[J]. 无损探伤, 2020, 44(5): 16-20. DOI:10.13689/j.cnki.cn21-1230/th.2020.05.004. |
| [3] |
LYU Dacai, CHEN Xiangdong, ZHU Fei, et al. Analysis of infrared thermal imaging technology on steel structure coating detection[J]. Nondestructive Testing Technology, 2020, 44(5): 16-20. DOI:10.13689/j.cnki.cn21-1230/th.2020.05.004.(in Chinese) |
| [4] |
罗东亮, 蔡雨萱, 杨子豪, 工业缺陷检测深度学习方法综述[J]. 中国科学: 信息科学, 2022, 52(6): 1002-1039. |
| [5] |
LUO Dongliang, CAI Yuxuan, YANG Zihao, et al. Survey on industrial defect detection with deep learning[J]. Scientia Sinica (Informationis), 2022, 52(6): 1002-1039. (in Chinese) |
| [6] |
XU J B, ZHANG J D, ZHANG K P, et al. An APF-ACO algorithm for automatic defect detection on vehicle paint[J]. Multimedia Tools and Applications, 2020, 79(35): 25315-25333. DOI:10.1007/s11042-020-09245-2. |
| [7] |
吴旭东, 闫志鸿, 胡飞涛, 基于光度学特征与SVM的热轧铝板表面缺陷检测[J]. 热加工工艺, 2023, 52(6): 157-162. DOI:10.14158/j.cnki.1001-3814.20212961. |
| [8] |
WU Xudong, YAN Zhihong, HU Feitao, et al. Surface defect detection of hot-rolled aluminum sheet based on photometric features and SVM[J]. Hot Working Technology, 2023, 52(6): 157-162. DOI:10.14158/j.cnki.1001-3814.20212961.(in Chinese) |
| [9] |
王艳, 罗健, 陶金, 基于YOLOv8-PCB的印制电路板缺陷检测[J]. 激光与光电子学进展, 2025, 62(4): 0412002. |
| [10] |
WANG Yan, LUO Jian, TAO Jin, et al. Defect detection of printed circuit boards based on YOLOv8-PCB[J]. Laser & Optoelectronics Progress, 2025, 62(4): 0412002. (in Chinese) |
| [11] |
周永钦, 王勇, 王瑛. 基于多尺度特征及注意力机制的轻量化PCB缺陷检测方法[J]. 计算机与现代化, 2024(2): 88-92, 107. |
| [12] |
ZHOU Yongqin, WANG Yong, WANG Ying. Lightweight PCB defect detection method based on multi-scale features and attention mechanism[J]. Computer and Modernization, 2024(2): 88-92, 107. (in Chinese) |
| [13] |
JIANG X H, YAN F, LU Y, et al. Joint attention-guided feature fusion network for saliency detection of surface defects[J]. IEEE Transactions on Instrumentation and Measurement, 2022, 71: 2520912. DOI:10.1109/TIM.2022.3218547. |
| [14] |
GAO Y P, GAO L, LI X Y, et al. A semi-supervised convolutional neural network-based method for steel surface defect recognition[J]. Robotics and Computer-Integrated Manufacturing, 2020, 61: 101825. DOI:10.1016/j.rcim.2019.101825. |
| [15] |
LI S Y, ZHAO X F, ZHOU G Y. Automatic pixel-level multiple damage detection of concrete structure using fully convolutional network[J]. Computer-Aided Civil and Infrastructure Engineering, 2019, 34(7): 616-634. DOI:10.1111/mice.12433. |
| [16] |
RAHMAN A, WU Z Y, KALFARISI R. Semantic deep learning integrated with RGB feature-based rule optimization for facility surface corrosion detection and evaluation[J]. Journal of Computing in Civil Engineering, 2021, 35(6): 04021018. DOI:10.1061/(ASCE)CP.1943-5487.0000982. |
| [17] |
杨绵芳, 陈伯建, 李扬笛, 基于改进YOLOv9算法的配电网绝缘子缺陷检测[J]. 上海电力大学学报, 2024, 40(6): 571-578. |
| [18] |
YANG Mianfang, CHEN Bojian, LI Yangdi, et al. Insulator defect detection in distribution network based on improved YOLOv9 method[J]. Journal of Shanghai University of Electric Power, 2024, 40(6): 571-578. (in Chinese) |
| [19] |
李耀华, 刘传召. 融合注意力机制的轻量化航空发动机表面缺陷检测算法[J]. 航空动力学报, 2025, 40(6): 20240096. DOI:10.13224/j.cnki.jasp.20240096. |
| [20] |
LI Yaohua, LIU Chuanzhao. Lightweight aero-engine surface defect detection algorithm fused with attention mechanism[J]. Journal of Aerospace Power, 2025, 40(6): 20240096. DOI:10.13224/j.cnki.jasp.20240096.(in Chinese) |
| [21] |
祁雷, 李宁, 梁伟, 基于注意力机制的U-Net叶片缺陷图像分割[J]. 中国安全科学学报, 2024, 34(5): 139-146. DOI:10.16265/j.cnki.issn1003-3033.2024.05.0767. |
| [22] |
QI Lei, LI Ning, LIANG Wei, et al. Blade defect detection of U-Net network based on attention mechanism[J]. China Safety Science Journal, 2024, 34(5): 139-146. DOI:10.16265/j.cnki.issn1003-3033.2024.05.0767.(in Chinese) |
| [23] |
ZHANG H, LI F, LIU S L, et al. DINO: DETR with improved denoising anchor boxes for end-to-end object detection[EB/OL]. (2022-03-07)[2025-11-18]. https://arxiv.org/abs/2203. 03605. |
| [24] |
ZHAO Y A, LV W Y, XU S L, et al. DETRs beat YOLOs on real-time object detection[C]//2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). Seattle: IEEE, 2024. |
| [25] |
VIEIRA E SILVA A L, SIMÕES F, KOWERKO D, et al. Attention modules improve image-level anomaly detection for industrial inspection: A DifferNet case study[C]//2024 IEEE/CVF Winter Conference on Applications of Computer Vision (WACV). Waikoloa: IEEE, 2024. |
| [26] |
XIA Z F, PAN X R, SONG S J, et al. Vision transformer with deformable attention[C]//2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). New Orleans: IEEE, 2022. |
| [27] |
DAI X Y, CHEN Y P, XIAO B, et al. Dynamic head: Unifying object detection heads with attentions[C]//2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). Nashville: IEEE, 2021. |
| [28] |
YU Z P, HUANG H B, CHEN W J, et al. YOLO-FaceV2: A scale and occlusion aware face detector[J]. Pattern Recognition, 2024, 115(11): 110714. DOI:10.1016/j.patcog.2024.110714. |
| [29] |
ZHANG H, ZHANG S J. Shape-IoU: More accurate metric considering bounding box shape and scale[EB/OL]. (2023-12-29)[2025-11-18]. https://arxiv.org/abs/2312.17663. |
/
| 〈 |
|
〉 |