Please wait a minute...
浙江大学学报(工学版)  2026, Vol. 60 Issue (7): 1438-1451    DOI: 10.3785/j.issn.1008-973X.2026.07.007
计算机与控制工程     
基于全局信息感知的轻量级螺纹钢表面缺陷检测算法
肖剑1(),杨小苑1,何昕泽1,陈林2,胡欣3,*()
1. 长安大学 电子与控制工程学院,陕西 西安 710064
2. 宿迁学院 信息工程学院,江苏 宿迁 223800
3. 长安大学 能源与电气工程学院,陕西 西安 710064
Lightweight rebar surface defect detection algorithm based on global information perception
Jian XIAO1(),Xiaoyuan YANG1,Xinze HE1,Lin CHEN2,Xin HU3,*()
1. School of Electronics and Control Engineering, Chang’an University, Xi’an 710064, China
2. School of Information Engineering, Suqian University, Suqian 223800, China
3. School of Energy and Electrical Engineering, Chang’an University, Xi’an 710064, China
 全文: PDF(4002 KB)   HTML
摘要:

针对螺纹钢表面缺陷检测精度不足及终端设备计算资源受限的问题,提出轻量级缺陷检测算法. 基于YOLOv8n模型,结合卷积门控线性单元的条件位置编码特性与自注意力机制的动态全局交互能力重新设计C2f模块,构建具有全局信息建模能力的主干网络. 采用上下文锚点注意力模块改进高层筛选特征金字塔网络,通过宽、高方向带状卷积组合策略聚焦远距离像素信息,并通过特征选择减少多尺度特征融合中的信息冗余. 通过共享卷积与分离BN层,提出自适应检测头,提高参数利用率并保证检测精度. 采用Unified-IoU边界框损失函数,通过动态权重分配提升密集缺陷检测性能. 实验结果表明,在自建螺纹钢数据集上,改进算法的mAP@0.5达到94.5%,较YOLOv8n提升了4.3个百分点;模型参数量降低至1.4 M,减少了53.33%;计算量降低了34.57%,FPS达到156帧/s,实现了检测性能与计算资源消耗的平衡. 此外,在NEU-DET数据集上验证了该算法具有良好的泛化性能.

关键词: 缺陷检测YOLOv8n轻量化网络全局信息高层筛选特征金字塔网络(HS-FPN)Unified-IoU    
Abstract:

A lightweight defect detection algorithm was proposed to address the issues of insufficient detection accuracy for rebar surface defects and limited computational resources of terminal devices. Based on the YOLOv8n model, the C2f module was redesigned and a backbone network with global information modeling capabilities was constructed by combining the conditional positional encoding characteristics of the convolutional gated linear unit and the dynamic global interaction capability of the self-attention mechanism. A context anchor attention module was used to improve the high-level screening feature pyramid network. A combined strategy of width-wise and height-wise strip convolutions was adopted to effectively focus on the long-distance pixel information, and the information redundancy in multi-scale feature fusion was reduced through feature selection. An adaptive detection head was proposed via shared convolution and separated BN layers to improve the parameter utilization while ensuring the detection accuracy. The Unified-IoU bounding box loss function was employed to enhance the performance of dense defect detection through dynamic weight distribution. Experimental results showed that the improved algorithm achieved a mAP@0.5 of 95.4% on a self-constructed rebar dataset, which was 4.3 percentage points higher than that of YOLOv8n. The model’s parameter count was reduced to 1.4 M, representing a decrease of 53.33%, the computational complexity was reduced by 34.57%, and the FPS reached 156 frames per second, achieving a balance between the detection performance and the computational resource consumption. Additionally, the algorithm’s good generalization performance was validated on the NEU-DET dataset.

Key words: defect detection    YOLOv8n    lightweight network    global information    HS-FPN    Unified-IoU
收稿日期: 2025-04-02 出版日期: 2026-05-23
CLC:  TP 391.4  
基金资助: 陕西省秦创原“科学家+工程师”队伍建设项目(2024QCY-KXJ-161);咸阳市重点研发计划资助项目(L2025-ZDKJ-ZDGG-RGZN-005).
通讯作者: 胡欣     E-mail: xiaojian@chd.edu.cn;huxin@chd.edu.cn
作者简介: 肖剑(1975—),男,副教授,博士,从事检测技术研究. orcid.org/0000-0003-0650-6099. E-mail:xiaojian@chd.edu.cn
服务  
把本文推荐给朋友
加入引用管理器
E-mail Alert
作者相关文章  
肖剑
杨小苑
何昕泽
陈林
胡欣

引用本文:

肖剑,杨小苑,何昕泽,陈林,胡欣. 基于全局信息感知的轻量级螺纹钢表面缺陷检测算法[J]. 浙江大学学报(工学版), 2026, 60(7): 1438-1451.

Jian XIAO,Xiaoyuan YANG,Xinze HE,Lin CHEN,Xin HU. Lightweight rebar surface defect detection algorithm based on global information perception. Journal of ZheJiang University (Engineering Science), 2026, 60(7): 1438-1451.

链接本文:

https://www.zjujournals.com/eng/CN/10.3785/j.issn.1008-973X.2026.07.007        https://www.zjujournals.com/eng/CN/Y2026/V60/I7/1438

图 1  整体网络结构图
图 2  主干网络CACGLUFormer结构图
图 3  不同的通道混合器对比
图 4  SFF策略的结构图
图 5  改进的高层筛选特征金字塔网络结构图
图 6  SCSBN检测头结构图
类别N
图片实例
锈迹1 88312 673
划伤1 99510 304
结疤396571
表 1  自建数据集中各类缺陷的图片数目与实例个数
图 7  数据集中部分实例照片
模型P/%R/%mAP@0.5/%mAP@0.5-0.95/%Np/MFLOPs/GFPS/(帧·s?1)
YOLOv8n(baseline)88.383.190.255.93.08.1133
YOLOv8n-GhostNet85.582.887.652.21.75.1140
YOLOv8n-GhostNetV281.484.886.349.62.46.4134
YOLOv8n-MobileViT87.883.089.855.42.212.8132
YOLOv8n-MobileNetV382.780.284.541.12.35.7133
YOLOv8n-MobileNetV485.083.788.841.75.722.5128
YOLOv8n-ShuffleNetV281.380.084.241.51.95.2139
YOLOv8n-EfficientNetV282.978.884.542.02.12.6148
YOLOv8n-VanillaNet84.983.286.551.82.05.7147
YOLOv8n-FasterNet85.183.987.850.44.210.7130
YOLOv8n-StarNet82.078.983.745.92.26.5137
CACGLUFormer87.587.492.956.22.46.8148
表 2  轻量级主干网络对比实验结果
损失函数P/%R/%mAP@0.5/%mAP@0.5-0.95/%FPS/(帧·s?1)
CIoU88.383.190.255.9133
DIoU86.484.990.256.2136
GIoU87.983.690.055.9131
EIoU81.585.889.956.073
WIoU81.585.389.855.893
SIoU87.483.790.256.5101
Wise-IoU88.285.490.755.7125
Inner-IoU87.487.191.255.5128
Unified-IoU(linear)89.189.291.756.5135
Unified-IoU(cos)89.089.191.656.5135
Unified-IoU(fraction)88.889.191.356.6136
表 3  损失函数对比实验
检测头mAP@0.5/%Np/MFLOPs/GFPS/(帧·s?1)
YOLOv8n90.23.08.1133
+A-Head88.12.46.5135
+B-Head89.92.46.5128
+SCSBN Head90.92.46.5135
表 4  轻量化检测头对比实验
模型ABCD类别P/%R/%mAP@0.5/%mAP@0.5-0.95/%Np/MFLOPs/GFPS/(帧·s?1)
M0划伤92.985.293.054.73.08.1133
锈迹88.076.287.252.2
结疤84.187.890.560.7
All88.383.190.255.9
M1划伤89.290.094.454.52.46.8148
锈迹89.380.289.953.0
结疤84.092.094.461.1
All87.587.492.956.2
M2划伤90.486.892.454.12.17.3152
锈迹88.979.989.453.0
结疤85.490.692.564.4
All88.285.891.457.2
M3划伤92.090.994.357.42.46.5135
锈迹88.482.989.357.8
结疤82.085.788.955.4
All87.586.590.957.4
M4划伤89.990.994.557.41.86.4141
锈迹87.284.091.654.4
结疤88.993.892.156.6
All88.789.592.756.8
M5划伤89.291.295.055.41.45.3149
锈迹87.684.091.555.7
结疤86.490.993.860.6
All87.888.793.457.2
M6F划伤91.292.495.656.31.45.3155
锈迹91.086.694.256.1
结疤86.388.693.164.2
All90.088.994.358.9
M7C划伤91.493.096.556.21.45.3152
锈迹91.286.594.656.3
结疤87.687.292.564.0
All90.289.094.558.8
M8L划伤91.693.096.356.41.45.3156
锈迹91.286.894.756.1
结疤87.787.192.464.0
All90.289.094.558.8
表 5  不同改进策略的消融实验
模型P/%R/%mAP@0.5/%mAP@0.5-0.95/%Np/MFLOPs/GFPS/(帧·s?1)
Faster R-CNN82.172.982.744.6137.1370.26
SSD80.680.785.049.341.1145.341
YOLOv3-Tiny80.879.986.350.912.118.978
YOLOv4-Tiny84.381.088.452.15.916.1113
YOLOv5n85.581.289.452.52.47.1107
YOLOv6n81.680.687.251.34.211.2130
YOLOv7-Tiny85.481.289.354.76.113.1109
YOLOX-Tiny86.282.590.356.15.16.5122
YOLOv8n88.383.190.255.93.08.1133
YOLOv9n85.583.390.756.52.38.4135
YOLOv10n85.682.790.555.92.78.2131
YOLOv11n86.183.490.955.82.66.3136
YOLOv8-VSC88.688.892.756.32.06.0152
LTSCD-YOLO89.287.891.956.52.49.8144
S-YOLO89.887.993.257.92.68.4127
本研究模型90.289.094.558.81.45.3156
表 6  先进主流模型对比实验
图 8  模型改进前后检测结果的可视化对比
图 9  模型改进前后的缺陷检测热力图对比
模型P/%R/%mAP@0.5/%mAP@0.5-0.95/%Np/MFLOPs/GFPS/(帧·s?1)
YOLOv8n74.671.376.842.63.08.1122
DCS-YOLOv874.971.476.93.37.8277
SDB-YOLOv8s77.472.179.27.216.2146
YOLOv11n76.371.579.642.52.66.3127
本研究模型76.671.779.743.01.45.3129
表 7  在NEU-DET数据集上不同模型的对比实验
图 10  NEU-DET数据集上所提模型与基准模型的检测结果
1 TIAN Y, ZHANG G, YE H, et al Corrosion of steel rebar in concrete induced by chloride ions under natural environments[J]. Construction and Building Materials, 2023, 369: 130504
doi: 10.1016/j.conbuildmat.2023.130504
2 QIU J, ZHANG W, JING Y Quantitative linear correlation between self-magnetic flux leakage field variation and corrosion unevenness of corroded rebars[J]. Measurement, 2023, 218: 113173
doi: 10.1016/j.measurement.2023.113173
3 EDDY I C, UNDERHILL P R, MORELLI J, et al. Pulsed eddy current response to liftoff in different sizes of concrete embedded rebar [C]// Proceedings of the IEEE SENSORS. Montreal: IEEE, 2019: 1–4.
4 LUO Q, SUN Y, LI P, et al Generalized completed local binary patterns for time-efficient steel surface defect classification[J]. IEEE Transactions on Instrumentation and Measurement, 2019, 68 (3): 667- 679
doi: 10.1109/TIM.2018.2852918
5 YIN T, YANG J. Detection of steel surface defect based on faster R-CNN and FPN [C]// Proceedings of the 7th International Conference on Computing and Artificial Intelligence. Tianjin: ACM, 2021: 15–20.
6 胡欣, 周运强, 肖剑, 等 基于改进YOLOv5的螺纹钢表面缺陷检测[J]. 图学学报, 2023, 44 (3): 427- 437
HU Xin, ZHOU Yunqiang, XIAO Jian, et al Surface defect detection of threaded steel based on improved YOLOv5[J]. Journal of Graphics, 2023, 44 (3): 427- 437
7 李相垚, 侯红玲, 杨澳, 等. 面向钢材表面缺陷检测的DCS-YOLOv8算法研究[J/OL]. 机械科学与技术, 2024: 1–10. (2024-10-10) [2025-04-01]. https://link.cnki.net/doi/10.13433/j.cnki.1003-8728.20240128.
LI Xiangyao, HOU Hongling, YANG Ao, et al. Research on DCS-YOLOv8 algorithm for steel surface defect detection [J/OL]. Mechanical Science and Technology for Aerospace Engineering, 2024: 1–10. (2024-10-10) [2025-04-01]. https://link.cnki.net/doi/10.13433/j.cnki.1003-8728.20240128.
8 刘义艳, 郝婷楠, 贺晨, 等 基于DBBR-YOLO的光伏电池表面缺陷检测[J]. 图学学报, 2024, 45 (5): 913- 921
LIU Yiyan, HAO Tingnan, HE Chen, et al Photovoltaic cell surface defect detection based on DBBR-YOLO[J]. Journal of Graphics, 2024, 45 (5): 913- 921
9 LIU G, HU Y, CHEN Z, et al Lightweight object detection algorithm for robots with improved YOLOv5[J]. Engineering Applications of Artificial Intelligence, 2023, 123: 106217
doi: 10.1016/j.engappai.2023.106217
10 王春梅, 刘欢 YOLOv8-VSC: 一种轻量级的带钢表面缺陷检测算法[J]. 计算机科学与探索, 2024, 18 (1): 151- 160
WANG Chunmei, LIU Huan YOLOv8-VSC: lightweight algorithm for strip surface defect detection[J]. Journal of Frontiers of Computer Science and Technology, 2024, 18 (1): 151- 160
11 TANG Z, ZHANG W, LI J, et al LTSCD-YOLO: a lightweight algorithm for detecting typical satellite components based on improved YOLOv8[J]. Remote Sensing, 2024, 16 (16): 3101
doi: 10.3390/rs16163101
12 梁礼明, 龙鹏威, 卢宝贺, 等. EHH-YOLOv8s: 一种轻量级的带钢表面缺陷检测算法[J/OL]. 北京航空航天大学学报, 2024: 1–15. (2024-08-08) [2025-04-01]. https://link.cnki.net/doi/10.13700/j.bh.1001-5965.2024.0426
LIANG Liming, LONG Pengwei, LU Baohe, et al. EHH-YOLOv8s: a lightweight algorithm for strip surface defect detection [J/OL]. Journal of Beijing University of Aeronautics and Astronautics, 2024: 1–15. (2024-08-08) [2025-04-01]. https://link.cnki.net/doi/10.13700/j.bh.1001-5965.2024.0426.
13 PENG H, XIE H, LIU H, et al LGFF-YOLO: small object detection method of UAV images based on efficient local-global feature fusion[J]. Journal of Real-Time Image Processing, 2024, 21 (5): 167
doi: 10.1007/s11554-024-01550-5
14 刘振江, 张会娟, 姬淼鑫, 等. 轻量级多尺度特征融合增强的空间非合作小目标检测算法[J/OL]. 北京航空航天大学学报, 2024: 1–12. (2024-09-20) [2025-04-01]. https://link.cnki.net/doi/10.13700/j.bh.1001-5965.2024.0509.
LIU Zhenjiang, ZHANG Huijuan, JI Miaoxin, et al. Lightweight multi-scale feature fusion enhancement algorithm for spatial non-cooperative small target detection [J/OL]. Journal of Beijing University of Aeronautics and Astronautics, 2024: 1–12. (2024-09-20) [2025-04-01]. https://link.cnki.net/doi/10.13700/j.bh.1001-5965.2024.0509.
15 SHI D. TransNeXt: robust foveal visual perception for vision Transformers [C]// Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. Seattle: IEEE, 2024: 17773–17783.
16 CAI X, LAI Q, WANG Y, et al. Poly kernel inception network for remote sensing detection [C]// Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. Seattle: IEEE, 2024: 27706–27716.
17 CHEN Y, ZHANG C, CHEN B, et al Accurate leukocyte detection based on deformable-DETR and multi-level feature fusion for aiding diagnosis of blood diseases[J]. Computers in Biology and Medicine, 2024, 170: 107917
doi: 10.1016/j.compbiomed.2024.107917
18 王安静, 袁巨龙, 朱勇建, 等 基于改进YOLOv8s的鼓形滚子表面缺陷检测算法[J]. 浙江大学学报: 工学版, 2024, 58 (2): 370- 380
WANG Anjing, YUAN Julong, ZHU Yongjian, et al Drum roller surface defect detection algorithm based on improved YOLOv8s[J]. Journal of Zhejiang University: Engineering Science, 2024, 58 (2): 370- 380
19 LUO X, CAI Z, SHAO B, et al. Unified-IoU: for high-quality object detection [EB/OL]. (2024-08-13) [2025-04-01]. https://arxiv.org/abs/2408.06636.
20 YU W, SI C, ZHOU P, et al MetaFormer baselines for vision[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2024, 46 (2): 896- 912
doi: 10.1109/TPAMI.2023.3329173
21 PATEL I, PATEL S An optimized deep learning model for flower classification using NAS-FPN and faster R-CNN[J]. International Journal of Scientific & Technology Research, 2020, 9 (3): 5308- 5318
22 QIAN X, ZHANG N, WANG W Smooth GIoU loss for oriented object detection in remote sensing images[J]. Remote Sensing, 2023, 15 (5): 1259
doi: 10.3390/rs15051259
23 PENG H, YU S A systematic IoU-related method: beyond simplified regression for better localization[J]. IEEE Transactions on Image Processing, 2021, 30: 5032- 5044
doi: 10.1109/TIP.2021.3077144
24 HAN K, WANG Y, TIAN Q, et al. GhostNet: more features from cheap operations [EB/OL]. (2020-03-13) [2025-04-01]. https://arxiv.org/abs/1911.11907.
25 TANG Y, HAN K, GUO J, et al. GhostNetV2: enhance cheap operation with long-range attention [C]// Proceedings of the 36th International Conference on Neural Information Processing Systems. New Orleans: Curran Associates Inc, 2022: 9969–9982.
26 MEHTA S, RASTEGARI M. MobileViT: light-weight, general-purpose, and mobile-friendly vision Transformer [EB/OL]. (2022-03-04) [2025-04-01]. https://arxiv.org/abs/2110.02178.
27 Howard A, SANDLER M, CHU G, et al. Searching for MobileNetV3 [C]// Proceedings of the IEEE/CVF International Conference on Computer Vision. Seoul: IEEE, 2019: 1314–1324.
28 QIN D, LEICHNER C, DELAKIS M, et al. MobileNetV4: universal models for the mobile ecosystem [C]// European Conference on Computer Vision. Milan: ECVA, 2025: 78–96.
29 YANG H, LIU J, MEI G, et al Research on real-time detection method of rail corrugation based on improved ShuffleNet V2[J]. Engineering Applications of Artificial Intelligence, 2023, 126: 106825
doi: 10.1016/j.engappai.2023.106825
30 梁礼明, 龙鹏威, 金家新, 等 基于改进YOLOv8s的钢材表面缺陷检测算法[J]. 浙江大学学报: 工学版, 2025, 59 (3): 512- 522
LIANG Liming, LONG Pengwei, JIN Jiaxin, et al Steel surface defect detection algorithm based on improved YOLOv8s[J]. Journal of Zhejiang University: Engineering Science, 2025, 59 (3): 512- 522
31 CHEN H, WANG Y, GUO J, et al. VanillaNet: the power of minimalism in deep learning [EB/OL]. (2023-05-23) [2025-04-01]. https://arxiv.org/abs/2305.12972.
32 CHEN J, KAO S, HE H, et al. Run, don’t walk: chasing higher FLOPS for faster neural networks [C]// Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. Vancouver: IEEE, 2023: 12021–12031.
[1] 田卫,周菻鈜,李欣阳,王建明,黄余康. 基于改进YOLOv8的3D打印混凝土表观缺陷检测方法[J]. 浙江大学学报(工学版), 2026, 60(4): 833-843.
[2] 雒伟群,陆敬蔚,吴佳缔,梁钰迎,申传鹏,朱睿. 藏区高原典型环境地形目标的轻量化检测模型[J]. 浙江大学学报(工学版), 2026, 60(3): 594-603.
[3] 刘慧,王防修,王意,黄淄博,苏晨. 轻量级改进RT-DETR的葡萄叶片病害检测算法[J]. 浙江大学学报(工学版), 2026, 60(3): 604-613.
[4] 王彦乐,张瑞峰,李锵. 融合全局信息和对比学习的图神经网络推荐模型[J]. 浙江大学学报(工学版), 2026, 60(2): 351-359.
[5] 刘子豪,张佳欣,薛峰,张俊,陈伟杰,鹿业波. 基于改进YOLO-v8的精密管件表面缺陷检测方法[J]. 浙江大学学报(工学版), 2025, 59(7): 1514-1522.
[6] 鞠文博,董华军. 基于上下文信息融合与动态采样的主板缺陷检测方法[J]. 浙江大学学报(工学版), 2025, 59(6): 1159-1168.
[7] 梁耕良,韩曙光. 基于改进RT-DETR的牛仔面料疵点检测算法[J]. 浙江大学学报(工学版), 2025, 59(6): 1169-1178.
[8] 胡明志,孙俊,杨彪,常开荣,杨俊龙. 基于CNN和Transformer聚合的遥感图像超分辨率重建[J]. 浙江大学学报(工学版), 2025, 59(5): 938-946.
[9] 梁礼明,龙鹏威,金家新,李仁杰,曾璐. 基于改进YOLOv8s的钢材表面缺陷检测算法[J]. 浙江大学学报(工学版), 2025, 59(3): 512-522.
[10] 唐善成,逯建辉,张莹,金子成,赵安新. 修复缺陷嫌疑区域的无监督磁瓦表面缺陷检测[J]. 浙江大学学报(工学版), 2024, 58(4): 718-728.
[11] 刘坤,王丁,王静凯,陈海永,刘卫朋. 基于特征过滤与特征解耦的域泛化模型[J]. 浙江大学学报(工学版), 2024, 58(3): 459-467.
[12] 王安静,袁巨龙,朱勇建,陈聪,吴金津. 基于改进YOLOv8s的鼓形滚子表面缺陷检测算法[J]. 浙江大学学报(工学版), 2024, 58(2): 370-380.
[13] 梁龙学,贺成龙,吴小所,闫浩文. 全局信息提取与重建的遥感图像语义分割网络[J]. 浙江大学学报(工学版), 2024, 58(11): 2270-2279.
[14] 卞佰成,陈田,吴入军,刘军. 基于改进YOLOv3的印刷电路板缺陷检测算法[J]. 浙江大学学报(工学版), 2023, 57(4): 735-743.
[15] 兰欢,余建波. 基于深度学习三维成型的钢板表面缺陷检测[J]. 浙江大学学报(工学版), 2023, 57(3): 466-476.