Please wait a minute...
浙江大学学报(工学版)  2025, Vol. 59 Issue (3): 512-522    DOI: 10.3785/j.issn.1008-973X.2025.03.009
计算机技术     
基于改进YOLOv8s的钢材表面缺陷检测算法
梁礼明(),龙鹏威,金家新,李仁杰,曾璐*()
江西理工大学 电气工程与自动化学院,江西 赣州 341000
Steel surface defect detection algorithm based on improved YOLOv8s
Liming LIANG(),Pengwei LONG,Jiaxin JIN,Renjie LI,Lu ZENG*()
School of Electrical Engineering and Automation, Jiangxi University of Science and Technology, Ganzhou 341000, China
 全文: PDF(1725 KB)   HTML
摘要:

钢材表面缺陷形态多样、结构复杂、小目标占比高,而通用目标检测算法计算量过大且不适合终端设备部署. 针对上述问题,提出基于YOLOv8s的轻量级的钢材缺陷检测算法(SDB-YOLOv8s). 重新设计特征交互模块(S-C2f),抑制空间和通道冗余信息,提高检测精度;引入空洞Transformer模块,增强网络对全局上下文信息的捕获能力和稀疏采样特性,以减少细粒度信息损失,并提升对小目标的特征提取能力;设计BS-ShuffleNetV2轻量化网络作为骨干网络,在降低模型复杂度的同时保证检测精度. 在NEU-DET和Severstal钢材缺陷数据集进行实验验证,结果表明,与基线模型相比,SDB-YOLOv8算法的mAP分别提升6.4和7.0个百分点、参数量和计算复杂度仅为基线模型的64.8%和56.2%. 每秒检测帧数分别达到146帧和121帧、精确度分别提升4.6和6.5个百分点. 实验结果表明,该算法在检测精度、速度和轻量化方面取得了较好的平衡,同时为边缘终端设备提供了较高精度和实时性的参考.

关键词: 缺陷检测轻量化YOLOv8s深度学习特征提取特征交互    
Abstract:

The surface defects of steel are diverse in form, complex in structure, and exhibit a high proportion of small targets, while general object detection algorithms have excessive computational complexity and are not suitable for the deployment on edge devices. To address these issues, a lightweight steel defect detection algorithm based on YOLOv8s, called SDB-YOLOv8s, was proposed. Firstly, a redesigned feature interaction module (S-C2f) was introduced to suppress spatial and channel redundant information, enhancing detection accuracy. Secondly, a dilated Transformer module was incorporated to enhance the network’s ability to capture global contextual information and sparse sampling characteristics, reducing fine-grained information loss and improving feature extraction capabilities for small targets. Finally, a lightweight network, BS-ShuffleNetV2, was designed as the backbone network to reduce model complexity while maintaining detection accuracy. Experimental validation on the NEU-DET and Severstal steel defect datasets showed that compared to baseline models, the SDB-YOLOv8 algorithm achieved an improvement in mAP of 6.4 and 7.0 percentage points, and detection frames per second of 146 and 121, with accuracy improvements of 4.6 and 6.5 percentage points respectively. The number of parameters and computational complexity were only 64.8% and 56.2% of the baseline model. The experimental results demonstrated that this algorithm achieved a better balance in terms of detection accuracy, speed, and lightweight characteristics, while providing a reference for high accuracy and real-time capabilities for edge terminal devices.

Key words: defect detection    lightweight YOLOv8s    deep learning    feature extraction    feature interaction
收稿日期: 2024-01-30 出版日期: 2025-03-10
CLC:  TP 391.4  
基金资助: 国家自然科学基金资助项目(51365017,61463018);江西省自然科学基金资助项目(20192BAB205084);江西省教育厅科学技术研究资助项目(GJJ2200848).
通讯作者: 曾璐     E-mail: 9119890012@jxust.edu.cn;zenglu@jxust.edu.cn
作者简介: 梁礼明(1967—),男,教授,硕导,从事机器学习、模式识别与图像处理研究. orcid.org/0009-0004-5278-5249. E-mail:9119890012@jxust.edu.cn
服务  
把本文推荐给朋友
加入引用管理器
E-mail Alert
作者相关文章  
梁礼明
龙鹏威
金家新
李仁杰
曾璐

引用本文:

梁礼明,龙鹏威,金家新,李仁杰,曾璐. 基于改进YOLOv8s的钢材表面缺陷检测算法[J]. 浙江大学学报(工学版), 2025, 59(3): 512-522.

Liming LIANG,Pengwei LONG,Jiaxin JIN,Renjie LI,Lu ZENG. Steel surface defect detection algorithm based on improved YOLOv8s. Journal of ZheJiang University (Engineering Science), 2025, 59(3): 512-522.

链接本文:

https://www.zjujournals.com/eng/CN/10.3785/j.issn.1008-973X.2025.03.009        https://www.zjujournals.com/eng/CN/Y2025/V59/I3/512

图 1  SDB-YOLOv8s网络结构
图 2  S-C2f和ScConv网络结构
图 3  SRU网络结构
图 4  CRU网络结构
图 5  DilateFormer网络结构
图 6  BS-ShuffleNetV2网络结构
图 7  钢材表面各类缺陷图像
图 8  数据增强前后图像示例
TmAP/%Params/106FLOPs/109FPS/帧
基线模型72.811.128.8109
0.174.410.326.9112
0.274.910.326.9117
0.377.210.326.9119
0.474.410.326.9119
0.575.210.326.9129
0.674.210.326.9119
0.773.310.326.9121
0.875.010.326.9123
0.975.210.326.9120
表 1  SRU不同权重阈值对比实验
位置mAP/%Params/106FLOPs/109FPS/帧
基线模型72.811.128.8109
B74.810.326.5108
C77.210.326.9129
D73.69.324.5101
表 2  S-C2f模块不同位置实验
rmAP/%Params/106FLOPs/109FPS/帧
基线模型72.811.128.8109
175.812.328.7104
275.312.328.7101
374.712.328.799
表 3  DilateFormer系数调节实验
模型mAP/%Params/106FLOPs/109FPS/帧
A72.811.128.8109
E73.06.416.4183
F72.56.215.6217
本研究74.06.416.5217
表 4  改进BS-ShuffleNetV2对比实验
数据集模型方法mAP/%Params/106FLOPs/109FPS/帧P/%R/%
NEU-DETYOLOv8s72.811.128.810972.870.9
YOLOv8s+M177.210.326.912977.170.4
YOLOv8s+M275.812.328.710476.770.2
YOLOv8s+M374.06.416.521771.576.0
YOLOv8s+M1+M2+M379.27.216.214677.472.1
SeverstalYOLOv8s69.911.128.810371.168.4
YOLOv8s+M174.210.326.911270.069.7
YOLOv8s+M271.112.328.78868.870.9
YOLOv8s+M372.16.416.519665.170.3
YOLOv8s+M1+M2+M376.97.216.212177.670.4
表 5  NEU-DET和Severstal数据集消融实验结果
图 9  本研究算法与原模型对各类缺陷AP的对比
数据集模型方法mAP/%Params/106FLOPs/109FPS/帧
SeverstalAYOLOv8s74.311.128.8120
YOLOv8s+M1+M2+M377.97.216.2146
SeverstalBYOLOv8s69.911.128.8103
YOLOv8s+M1+M2+M376.97.216.2121
表 6  Severstal数据集扩充前后实验对比
数据集模型方法mAP/%Params/106FLOPs/109FPS/帧
NEU-DETFaster R-CNN65.772.0167.317
SSD61.041.1145.341
YOLOv367.061.5155.031
YOLOv3-tiny46.58.612.9142
YOLOv451.052.5119.845
YOLOv4-tiny54.65.916.1128
YOLOv5s70.17.0716.4102
YOLOX-s71.88.021.646
YOLOv770.037.2104.836
YOLOv7-tiny68.76.0213.1108
YOLOv8s72.811.128.8120
文献[11]78.55.810.949
文献[18]74.123.975
SDB-YOLOv8s(本研究)79.27.216.2146
SeverstalSSD65.341.1145.312
YOLOv3-tiny56.48.612.9117
YOLOv4-tiny59.65.916.1103
YOLOv7-tiny68.76.0213.1108
YOLOv5s72.47.0716.459
YOLOv5m73.221.050.352.6
YOLOX-s73.88.021.642
YOLOv8s69.811.128.8103
SDB-YOLOv8s(本研究)76.97.216.2121
表 7  不同算法在NEU-DET和Severstal数据集上的对比实验结果
图 10  SDB-YOLOv8s算法和YOLOv8s算法可视化结果对比
1 王安静, 袁巨龙, 朱勇建, 等 基于改进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
2 袁天乐, 袁巨龙, 朱勇建, 等 基于改进YOLOv5的推力球轴承表面缺陷检测算法[J]. 浙江大学学报: 工学版, 2022, 56 (12): 2349- 2357
YUAN Tianle, YUAN Julong, ZHU Yongjian, et al Surface defect detection algorithm of thrust ball bearing based on improved YOLOv5[J]. Journal of Zhejiang University: Engineering Science, 2022, 56 (12): 2349- 2357
3 GIRSHICK R, DONAHUE J, DARRELL T, et al. Rich feature hierarchies for accurate object detection and semantic segmentation [C]// Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition . Columbus: IEEE, 2014: 580–587.
4 REN S, HE K, GIRSHICK R, et al Faster R-CNN: towards real-time object detection with region proposal networks[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017, 39 (6): 1137- 1149
doi: 10.1109/TPAMI.2016.2577031
5 LIU W, ANGUELOV D, ERHAN D, et al. SSD: single shot multibox detector [C]// European Conference on Computer Vision . Heideberg: Springer, 2016: 21−37.
6 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
7 CARION N, MASSA F, SYNNAEVE G, et al. End-to-end object detection with transformers [C]// European Conference on Computer Vision . Cham: Springer, 2020: 213–229.
8 ZHOU S, ZENG Y, LI S, et al Surface defect detection of rolled steel based on lightweight model[J]. Applied Sciences, 2022, 12 (17): 8905
doi: 10.3390/app12178905
9 QIN R, CHEN N, HUANG Y. EDDNet: An efficient and accurate defect detection network for the industrial edge environment [C]// IEEE 22nd International Conference on Software Quality, Reliability and Security . Guangzhou: IEEE, 2022: 854–863.
10 YANG L, HUANG X, REN Y, et al Steel plate surface defect detection based on dataset enhancement and lightweight convolution neural network[J]. Machines, 2022, 10 (7): 523
doi: 10.3390/machines10070523
11 张政超 改进YOLOv5的轻量级带钢表面缺陷检测[J]. 计算机系统应用, 2023, 32 (6): 278- 285
ZHANG Zhengchao Lightweight strip steel defect detection based on improved YOLOv5[J]. Computer System Applications, 2023, 32 (6): 278- 285
12 蔡剑锋, 柏俊杰, 张雪, 等 基于改进Mask R-CNN 的金属板材表面缺陷检测[J]. 重庆科技学院学报: 自然科学版, 2023, 25 (2): 110- 116
CAI Jianfeng, BAI Junjie, ZHANG Xue, et al Research on surface defect recognition of metal sheet based on improved Mask R-CNN[J]. Journal of Chongqing Institute of Science and Technology: Natural Science Edition, 2023, 25 (2): 110- 116
13 阎馨, 杨月川, 屠乃威 基于改进SSD的钢材表面缺陷检测[J]. 现代制造工程, 2023, (5): 112- 120
YAN Xin, YANG Yuechuan, TU Naiwei Steel surface defect detection based on improved SSD[J]. Modern Manufacturing Engineering, 2023, (5): 112- 120
14 LI J, WEN Y, HE L. Scconv: spatial and channel reconstruction convolution for feature redundancy [C]// Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition . Vancouver: IEEE, 2023: 6153–6162.
15 JIAO J, TANG Y M, LIN K Y, et al. Dilateformer: multi-scale dilated transformer for visual recognition [J]. IEEE Transactions on Multimedia , 2023, 25: 8906–8919.
16 MA N, ZHANG X, ZHENG H T, et al. Shufflenet v2: practical guidelines for efficient cnn architecture design [C]// Proceedings of the European Conference on Computer Vision . Cham: Springer, 2018: 116–131.
17 SANDLER M, HOWARD A, ZHU M, et al. Mobilenetv2: inverted residuals and linear bottlenecks [C]// Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition . Salt Lake City: IEEE, 2018: 4510–4520.
18 曹义亲, 伍铭林, 徐露 基于改进YOLOv5算法的钢材表面缺陷检测[J]. 图学学报, 2023, 44 (2): 335- 345
CAO Yiqin, WU Minglin, XU Lu Steel surface defect detection based on improved YOLOv5 algorithm[J]. Journal of Graphics, 2023, 44 (2): 335- 345
[1] 姚明辉,王悦燕,吴启亮,牛燕,王聪. 基于小样本人体运动行为识别的孪生网络算法[J]. 浙江大学学报(工学版), 2025, 59(3): 504-511.
[2] 陈智超,杨杰,李凡,冯志成. 基于深度学习的列车运行环境感知关键算法研究综述[J]. 浙江大学学报(工学版), 2025, 59(1): 1-17.
[3] 刘登峰,陈世海,郭文静,柴志雷. 基于轻量残差网络的高效半色调算法[J]. 浙江大学学报(工学版), 2025, 59(1): 62-69.
[4] 赵顗,安醇,李铭浩,马健霄,怀硕. 城市快速路互通交织区车辆的换道持续距离选择[J]. 浙江大学学报(工学版), 2025, 59(1): 205-212.
[5] 李凡,杨杰,冯志成,陈智超,付云骁. 基于图像识别的弓网接触点检测方法[J]. 浙江大学学报(工学版), 2024, 58(9): 1801-1810.
[6] 肖力,曹志刚,卢浩冉,黄志坚,蔡袁强. 基于深度学习和梯度优化的弹性超材料设计[J]. 浙江大学学报(工学版), 2024, 58(9): 1892-1901.
[7] 林俊杰,朱雅光,刘春潮,刘昊洋. 面向移动作业的腿足机器人数字孪生系统[J]. 浙江大学学报(工学版), 2024, 58(9): 1956-1969.
[8] 王海军,王涛,俞慈君. 基于递归量化分析的CFRP超声检测缺陷识别方法[J]. 浙江大学学报(工学版), 2024, 58(8): 1604-1617.
[9] 吴书晗,王丹,陈远方,贾子钰,张越棋,许萌. 融合注意力的滤波器组双视图图卷积运动想象脑电分类[J]. 浙江大学学报(工学版), 2024, 58(7): 1326-1335.
[10] 李林睿,王东升,范红杰. 基于法条知识的事理型类案检索方法[J]. 浙江大学学报(工学版), 2024, 58(7): 1357-1365.
[11] 马现伟,范朝辉,聂为之,李东,朱逸群. 对失效传感器具备鲁棒性的故障诊断方法[J]. 浙江大学学报(工学版), 2024, 58(7): 1488-1497.
[12] 宋娟,贺龙喜,龙会平. 基于深度学习的隧道衬砌多病害检测算法[J]. 浙江大学学报(工学版), 2024, 58(6): 1161-1173.
[13] 韩康,战洪飞,余军合,王瑞. 基于空洞卷积和增强型多尺度特征自适应融合的滚动轴承故障诊断[J]. 浙江大学学报(工学版), 2024, 58(6): 1285-1295.
[14] 钟博,王鹏飞,王乙乔,王晓玲. 基于深度学习的EEG数据分析技术综述[J]. 浙江大学学报(工学版), 2024, 58(5): 879-890.
[15] 魏翠婷,赵唯坚,孙博超,刘芸怡. 基于改进Mask R-CNN与双目视觉的智能配筋检测[J]. 浙江大学学报(工学版), 2024, 58(5): 1009-1019.