Improved lightweight and efficient EHH-YOLOv8s algorithm for strip steel surface defect detection
-
摘要:
针对当前钢材表面缺陷检测存在效率低和精度差等问题,以及现有缺陷检测模型参数量庞大、检测精度和实时性较差的挑战,提出一种基于YOLOv8s的轻量级钢材表面缺陷检测算法EHH-YOLOv8s。采用轻量级的EfficientViT网络作为骨干网络,以降低模型复杂度并更好地处理跨尺度特征信息,从而提升检测性能;重构特征交互模块H-C2f,有效保留空间和通道特征,抑制冗余信息,以提高检测精度和速度;采用Haar小波下采样(HWD) 模块,以扩大感受野、降低模型复杂度、提升训练和检测速度。在NEU-DET和Severstal钢材缺陷数据集上进行实验验证,结果表明,相较于YOLOv8s算法,EHH-YOLOv8算法的平均精度均值(mAP)分别提升6.9%和5.4%,参数量和浮点运算量分别降低4.1×106和13.2×109次,检测速度分别达到136帧/s和118帧/s,表明所提算法在检测精度、速度和轻量化方面取得了更好的平衡,为边缘终端设备提供高精度和实时性的可靠参考。在PCB板缺陷数据集上进行验证,结果显示,所提算法具备良好的泛化性能。
-
关键词:
- 缺陷检测 /
- 轻量化YOLOv8s /
- EfficientViT网络 /
- 交换模块H-C2f /
- Haar小波下采样
Abstract:To address the issues of low efficiency, and poor accuracy in current steel surface defect detection, and the challenges of large model parameters, low detection accuracy, and poor real-time performance of existing defect detection models, a lightweight steel defect detection algorithm based on YOLOv8s (EHH-YOLOv8s) is proposed. The reconstruction feature interaction module H-C2f, which successfully preserves spatial and channel features, suppresses redundant information, and improves detection accuracy and speed; the Haar wavelet downsampling (HWD) module, which expands the receptive field, reduces model complexity, and speeds up training and inference; and the lightweight EfficientViT network, which serves as the backbone network to reduce model complexity and better handle cross-scale feature information. Experimental validation on the NEU-DET and Severstal steel defect datasets shows that compared to the YOLOv8s algorithm, the EHH-YOLOv8 algorithm achieves an improvement in mean average precision (mAP) of 6.9% and 5.4%, respectively, with reductions in parameters and computations of 4.1×106 and 13.2×109, and achieves detection speed of 136 frames/s and 118 frames/s. These findings show that the algorithm strikes a superior balance between speed, lightweight design, and detection accuracy, offering a dependable reference for high precision and real-time performance on edge devices. Finally, validation on the PCB board defect dataset shows that the algorithm possesses good generalization performance.
-
Key words:
- defect detection /
- lightweight YOLOv8s /
- EfficientViT /
- H-C2f /
- Haar wavelet downsampling
-
表 1 EfficientViT网络不同版本实验结果
Table 1. Experimental results of different versions of EfficientViT network
模型 mAP% 参数量 浮点运算量/109次 检测速度/(帧·s−1) 基线模型 72.8 11.1×106 28.8 109 V0 76.5 8.3×106 23.9 126 V1 75.0 9.0×106 25.2 113 V2 75.2 10.2×106 26.9 101 V3 76.2 13.0×106 32.8 80 V4 75.3 14.9×106 37.7 75 V5 72.4 18.6×106 42.5 67 表 2 H-C2f模块实验结果
Table 2. Experimental results of H-C2f module
模型 mAP% 参数量 浮点运算量/
109次检测速度/
(帧·s−1)基线模型 72.8 11.1×106 28.8 109 H-C2f 75.7 10.2×106 26.6 116 C2f+SE 75.3 19.8×106 46.2 90 C2f+CBAM 75.2 11.2×106 28.5 105 C2f+Shuffle-Attention 75.6 11.1×106 28.4 108 C2f+CA 74.3 11.1×106 28.5 113 C2f+SimAM 73.6 11.1×106 28.4 109 表 3 消融实验结果
Table 3. Ablation test results
数据集 模型方法 mAP% 参数量 浮点运算量/109次 检测速度/(帧·s−1) P% R% NEU-DET YOLOv8s 72.8 11.1×106 28.8 109 72.8 70.9 YOLOv8s+M1 76.5 8.3×106 23.9 126 68.8 76.1 YOLOv8s+M2 75.7 10.2×106 26.6 116 70.0 73.5 YOLOv8s+M3 74.8 10.7×106 27.9 113 73.5 70.6 YOLOv8s+M1+M2+M3 79.7 7.0×106 15.6 136 77.1 74.6 Severstal YOLOv8s 69.9 11.1×106 28.8 103 71.1 68.4 YOLOv8s+M1 73.2 8.3×106 23.9 108 71.8 64.7 YOLOv8s+M2 72.3 10.2×106 26.6 105 70.8 68.5 YOLOv8s+M3 72.8 10.7×106 27.9 104 67.5 68.2 YOLOv8s+M1+M2+M3 75.3 7.0×106 15.6 118 73.8 68.6 表 4 Severstal数据集扩充前后实验对比
Table 4. Comparison of experiments before and after enrichment of Severstal dataset
数据集 模型方法 mAP% 参数量 浮点运算量/109次 检测速度/(帧·s−1) SeverstalA YOLOv8s 74.3 11.1×106 28.8 120 EHH-YOLOv8s 78.6 7.0×106 15.6 125 SeverstalB YOLOv8s 69.9 11.1×106 28.8 103 EHH-YOLOv8s 75.3 7.0×106 15.6 118 表 5 对比实验结果
Table 5. Compare experimental results
数据集 模型方法 mAP0.5/% 参数量 浮点运算量/109次 检测速度/(帧·s−1) NEU-DET Faster R-CNN 65.7 72.00×106 167.3 17 SSD 61.0 41.10×106 145.3 41 RetinaNet 69.5 18.30×106 45.1 15 YOLOv3-tiny 46.5 8.60×106 12.9 142 YOLOv4-tiny 54.6 5.90×106 16.1 128 YOLOv5s 70.1 7.07×106 16.4 102 YOLOX-s 71.8 8.00×106 21.6 46 YOLOv7-tiny 68.7 6.02×106 13.1 108 YOLOv8s 72.8 11.10×106 28.8 120 文献[15] 74.1 23.90×106 75 文献[16] 78.5 5.80×106 10.9 49 文献[22] 77.2 7.03×106 115 文献[23] 75.5 8.12×106 96 文献[24] 75.2 90.80×106 30 EHH-YOLOv8s(本文) 79.7 7.00×106 15.6 136 Severstal SSD 65.3 41.10×106 145.3 12 RetinaNet 71.2 18.30×106 45.1 11 YOLOv3-tiny 56.4 8.60×106 12.9 117 YOLOv4-tiny 59.6 5.90×106 16.1 103 YOLOv7-tiny 68.7 6.02×106 13.1 108 YOLOv5s 72.4 7.07×106 16.4 59 YOLOv5m 73.2 21.00×106 50.3 52.6 YOLOX-s 73.8 8.00×106 21.6 42 YOLOv8s 69.8 11.10×106 28.8 103 EHH-YOLOv8s(本文) 75.3 7.00×106 15.6 118 表 6 PCB板数据集检测结果对比
Table 6. Comparison of detection results of PCB board dataset
模型方法 mAP% 参数量 浮点运算量/109次 检测速度/(帧·s−1) YOLOv8s 91.8 11.1×106 28.8 101 EHH-YOLOv8s 94.2 7.0×106 15.6 125 -
[1] 梁礼明, 阳渊, 朱晨锟, 等. 融合Mobile Vit和倒置门控编解码的视网膜血管分割算法[J]. 北京航空航天大学学报, 2025, 51(3): 712-723.Liang L M, Yang Y, Zhu C K, et al. Fusion of Mobile Vit and inverted gated codec retinal vessel segmentation algorithm[J]. Journal of Beijing University of Aeronautics and Astronautics, 2025, 51(3): 712-723(in Chinese). [2] 李彬, 汪诚, 丁相玉, 等. 改进YOLOv4的表面缺陷检测算法[J]. 北京航空航天大学学报, 2023, 49(3): 710-717.Li B, Wang C, Ding X Y, et al. Surface defect detection algorithm based on improved YOLOv4[J]. Journal of Beijing University of Aeronautics and Astronautics, 2023, 49(3): 710-717(in Chinese). [3] Singh S A, Desai K A. Automated surface defect detection framework using machine vision and convolutional neural networks[J]. Journal of Intelligent Manufacturing, 2023, 34(4): 1995-2011. [4] Wang C M, Liu H. YOLOv8-VSC: lightweight algorithm for strip surface defect detection[J]. Journal of Frontiers of Computer Science and Technology, 2024, 18(1): 151-160. [5] Liang F T, Zhou Y, Chen X, et al. Review of target detection technology based on deep learning[C]//Proceedings of the 5th International Conference on Control Engineering and Artificial Intelligence. New York: ACM, 2021: 132-135. [6] Girshick R. Fast R-CNN[C]//Proceedings of the IEEE International Conference on Computer Vision. New York: ACM, 2015: 1440-1448. [7] Hu B, Wang J. Detection of PCB surface defects with improved Faster-RCNN and feature pyramid network[J]. IEEE Access, 2020, 8: 108335-108345. [8] He K M, Gkioxari G, Dollár P, et al. Mask R-CNN[C]//Proceedings of the IEEE International Conference on Computer Vision. Piscataway: IEEE Press, 2017: 2980-2988. [9] Qian H M, Wang H L, Feng S, et al. FESSD: SSD target detection based on feature fusion and feature enhancement[J]. Journal of Real-Time Image Processing, 2023, 20(1): 2. [10] Jiang P Y, Ergu D, Liu F Y, et al. A review of YOLO algorithm developments[J]. Procedia Computer Science, 2022, 199: 1066-1073. [11] 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. [12] Zhou S Y, Zeng Y L, Li S C, et al. Surface defect detection of rolled steel based on lightweight model[J]. Applied Sciences, 2022, 12(17): 8905. [13] Qin R B, Chen N J, Huang Y H. EDDNet: an efficient and accurate defect detection network for the industrial edge environment[C]//Proceedings of the IEEE 22nd International Conference on Software Quality, Reliability and Security. Piscataway: IEEE Press, 2022: 854-863. [14] Yang L Y, Huang X B, Ren Y C, et al. Steel plate surface defect detection based on dataset enhancement and lightweight convolution neural network[J]. Machines, 2022, 10(7): 523. [15] 曹义亲, 伍铭林, 徐露. 基于改进YOLOv5算法的钢材表面缺陷检测[J]. 图学学报, 2023, 44(2): 335-345.Cao Y Q, Wu M L, Xu L. Steel surface defect detection based on improved YOLOv5 algorithm[J]. Journal of Graphics, 2023, 44(2): 335-345(in Chinese). [16] 张政超. 改进YOLOv5的轻量级带钢表面缺陷检测[J]. 计算机系统应用, 2023, 32(6): 278-285.Zhang Z C. Lightweight strip steel defect detection based on improved YOLOv5[J]. Computer Systems and Applications, 2023, 32(6): 278-285(in Chinese). [17] 蔡剑锋, 柏俊杰, 张雪, 等. 基于改进Mask R-CNN的金属板材表面缺陷检测[J]. 重庆科技学院学报(自然科学版), 2023(2): 110-116.Cai J F, Bai J J, Zhang X, et al. Research on surface defect recognition of metal sheet based on improved mask R-CNN[J]. Journal of Chongqing University of Science and Technology (Natural Sciences Edition), 2023(2): 110-116(in Chinese). [18] Huang P L, Wang S H, Chen J Y, et al. Lightweight model for pavement defect detection based on improved YOLOv7[J]. Sensors, 2023, 23(16): 7112. [19] Cai H, Li J Y, Hu M Y, et al. EfficientViT: multi-scale linear attention for high-resolution dense prediction[PP/OL]. arXiv (2024-02-06)[2024-06-01]. https://doi.org/10.48550/arXiv.2205.14756. [20] Li G Q, Fang Q, Zha L L, et al. HAM: hybrid attention module in deep convolutional neural networks for image classification[J]. Pattern Recognition, 2022, 129: 108785. [21] Xu G P, Liao W T, Zhang X, et al. Haar wavelet downsampling: a simple but effective downsampling module for semantic segmentation[J]. Pattern Recognition, 2023, 143: 109819. [22] 周彦, 孟江南, 王冬丽, 等. 基于多尺度轻量化注意力的钢材缺陷检测[J]. 控制与决策, 2024, 39(3): 901-909.Zhou Y, Meng J N, Wang D L, et al. Steel defect detection based on multi-scale lightweight attention[J]. Control and Decision, 2024, 39(3): 901-909(in Chinese). [23] 赵林熔, 甄国涌, 储成群, 等. 基于CBE-YOLOv5的钢材表面缺陷检测方法[J]. 电子测量技术, 2023, 46(15): 73-80.Zhao L R, Zhen G Y, Chu C Q, et al. Detection method of steel surface defects based on CBE-YOLOv5[J]. Electronic Measurement Technology, 2023, 46(15): 73-80(in Chinese). [24] Guo Z X, Wang C S, Yang G, et al. MSFT-YOLO: improved YOLOv5 based on transformer for detecting defects of steel surface[J]. Sensors, 2022, 22(9): 3467. [25] 周贤勇, 祝俊辉, 王圆, 等. 基于改进YOLOv7算法的PCB裸板缺陷检测[J]. 无线电工程, 2023, 53(12): 2791-2797.Zhou X Y, Zhu J H, Wang Y, et al. PCB bare board defect detection based on improved YOLOv7 algorithm[J]. Radio Engineering, 2023, 53(12): 2791-2797(in Chinese). -


下载: