PIC2f-YOLO:金属表面缺陷检测轻量化方法

胡依伦,杨俊,许聪源,等. PIC2f-YOLO:金属表面缺陷检测轻量化方法[J]. 光电工程,2025,52(1): 240250. doi: 10.12086/oee.2025.240250
引用本文: 胡依伦,杨俊,许聪源,等. PIC2f-YOLO:金属表面缺陷检测轻量化方法[J]. 光电工程,2025,52(1): 240250. doi: 10.12086/oee.2025.240250
Hu Y L, Yang J, Xu C Y, et al. PIC2f-YOLO: a lightweight method for the detection of metal surface defects[J]. Opto-Electron Eng, 2025, 52(1): 240250. doi: 10.12086/oee.2025.240250
Citation: Hu Y L, Yang J, Xu C Y, et al. PIC2f-YOLO: a lightweight method for the detection of metal surface defects[J]. Opto-Electron Eng, 2025, 52(1): 240250. doi: 10.12086/oee.2025.240250

PIC2f-YOLO:金属表面缺陷检测轻量化方法

  • 基金项目:
    国家自然科学基金项目 (62302197);浙江省自然科学基金项目 (LQ23F020006);嘉兴市科技计划基金项目 (2024AD10045, 2024AY40010);浙江省教育厅一般科研项目 (Y202455539)
详细信息
    作者简介:
    *通讯作者: 邓文斌,wbdeng@zjxu.edu.cn。
  • 中图分类号: TP391.41

  • CSTR: 32245.14.oee.2025.240250

PIC2f-YOLO: a lightweight method for the detection of metal surface defects

  • Fund Project: Project supported by the National Natural Science Foundation Project of China Fund (62302197), the Zhejiang Natural Science Foundation Project Fund (LQ23F020006), the Jiaxing City Science and Technology Project Fund (2024AD10045, 2024AY40010), and the Scientific Research Fund of Zhejiang Provincial Education Department Fund (Y202455539)
More Information
  • 针对金属表面缺陷检测效率低以及检测算法参数量大、精度低的问题,本文提出了一种改进YOLOv8n的金属表面缺陷检测轻量化方法。首先,设计局部卷积倒置交叉融合 (partial inverted bottleneck cross stage partial fusion, PIC2f)模块,该模块通过构造的局部卷积倒置瓶颈 (partial IRMB bottleneck, PIBN)模块替换BottleNeck模块,将部分卷积和倒置残差块组合,从而减少算法的参数量并提升模型的特征提取能力。然后,采用基于注意力尺寸内特征交互 (attention-based intra-scale feature interaction, AIFI)模块,该模块结合位置嵌入和多头注意力机制,增强了模型对小目标的检测能力。最后,使用平均池化下采样 (average pooling down sampling, ADown)模块替换传统卷积作为模型特征缩减模块,通过池化和卷积操作,在不降低检测精度情况下,进一步减少模型的参数量和计算复杂度。实验结果表明,与YOLOv8n算法相比,在NEU-DET钢材缺陷数据集上的PIC2f-YOLO方法的mAP50增加了2.7%,参数量减少了0.403 M。在铝片表面工业缺陷、PASCAL VOC2012和带状合金功能材料表面缺陷数据集上的泛化性实验也验证了PIC2f-YOLO方法的有效性。

  • Overview: Metallic materials, especially steel, are widely used in industry due to their mature manufacturing processes, excellent durability, and significant economic benefits. As a core material in various manufacturing sectors, steel is critical in advancing global industrialization and information technology. In the early stages of industrial metal production, surface defect detection relied primarily on manual visual inspections. However, as production scales expanded and quality demands increased, the limitations of manual inspection methods, such as inefficiency, susceptibility to human error, and high subjectivity, became evident. Thus, quickly and reliably identifying surface defects on metal has become a critical challenge in modern manufacturing processes. Traditional nondestructive testing techniques, such as eddy current testing and infrared inspection, were initially applied to surface defect detection on metal materials. However, these techniques often struggle to detect small defects effectively. Later, machine learning methods were introduced to improve detection accuracy, but limitations in processing power and generalization hindered their performance in large-scale industrial applications. With the rapid development of computing hardware, deep-learning-based methods have become the primary solution for metal surface defect detection. These methods are usually divided into two-stage and one-stage object detection frameworks. Two-stage methods, such as Faster RCNN, are recognized for their high accuracy but have slower processing speeds, limiting their real-time applications. Conversely, one-stage methods, such as YOLO, provide faster detection speeds but often compromise accuracy. To address the low efficiency in metal surface defect detection, as well as problems related to large algorithm parameters and low precision, this paper proposes a lightweight detection method based on the improved YOLOv8n. First, the local convolution inverted cross-stage partial fusion (PIC2f) module was designed. It replaces the BottleNeck module with the constructed local convolution inverted residual bottleneck (PIBN) module, which combines partial convolution and an inverted residual block to reduce algorithm parameters and enhance the model's feature extraction ability. Next, an attention-based intra-scale feature interaction (AIFI) module was adopted. It combines position embedding and multi-head attention to enhance the model's detection capability for small targets. Lastly, average pooling downsampling (ADown) replaced traditional convolution as the feature reduction module, effectively reducing parameters and computational complexity without compromising detection accuracy. Experimental results show that, compared with YOLOv8n, the PIC2f-YOLO method increases mAP50 by 2.7 % on the NEU-DET steel defect dataset and reduces parameters by 0.403 M. Experiments on aluminum sheet surface industrial defects, PASCAL VOC2012, and surface defects of strip alloy functional material datasets also confirm the effectiveness of the PIC2f-YOLO method.

  • 加载中
  • 图 1  PIC2f-YOLO结构

    Figure 1.  PIC2f-YOLO structure

    图 2  PIBN结构

    Figure 2.  PIBN structure

    图 3  PIC2f结构

    Figure 3.  PIC2f structure

    图 4  Conv和PConv结构。(a) Conv;(b) PConv

    Figure 4.  Conv and PConv structure. (a) Conv; (b) PConv

    图 5  IRMB结构

    Figure 5.  IRMB structure

    图 6  AIFI结构

    Figure 6.  AIFI structure

    图 7  ADown结构

    Figure 7.  ADown structure

    图 8  铝片缺陷

    Figure 8.  Aluminum sheet defects

    图 9  带状合金功能材料表面缺陷

    Figure 9.  Surface defects of strip alloy functional material

    图 10  数据集增强前后缺陷mAP50-95值对比

    Figure 10.  Comparison of defect mAP50-95 values before and after dataset augmentation

    图 11  不同方法在NEU-DET数据集下的检测实例。(a)标注的缺陷图像;(b) YOLOv8n;(c) PIC2f-YOLO

    Figure 11.  Detection instance of different methods under the NEU-DET dataset. (a) Annotated defect images; (b) YOLOv8n; (c) PIC2f-YOLO

    图 12  不同方法在带状合金功能材料表面缺陷数据集下的检测实例。(a)标注的缺陷图像;(b)YOLOv8n;(c)PIC2f-YOLO

    Figure 12.  Detection instance of different methods under the surface defects of strip alloy functional materials datasets. (a) Annotated defect images; (b) YOLOv8n; (c) PIC2f-YOLO

    表 1  数据增强前后数据集中各类缺陷标签数

    Table 1.  Number of defect labels for each class in the dataset before and after data augmentation

    DefectsTraining setValidation setTesting set
    Swelling337/64338/10443/73
    Dent493/98162/12065/118
    Scratch1752/3006189/375228/405
    Peeling1145/1981141/244180/237
    Gap417/63252/7139/86
    Perforation131/23911/2017/27
    Weld285/43229/5130/47
    Snake119/25427/3319/30
    下载: 导出CSV

    表 2  消融实验结果

    Table 2.  Ablation results

    MethodsmAP50/%Param/MFLOPs/GFPS/(f/s)
    Baseline75.33.0068.1163
    +M176.92.78811.598
    +M277.13.2388.1128
    +M376.22.5917.2153
    +M1M277.63.01911.584
    +M1M2M378.02.60310.682
    下载: 导出CSV

    表 3  PIC2f 实验结果

    Table 3.  PIC2f experiment results

    PConvIRMBmAP50/%Param/M
    75.33.006
    75.62.589
    k=175.82.783
    k=376.92.788
    k=575.62.797
    k=774.92.811
    k=975.32.829
    下载: 导出CSV

    表 4  铝片表面工业缺陷数据集泛化实验

    Table 4.  Generalization experiment results on the aluminum sheet surface industrial defect dataset

    MethodsmAP50/%Param/MFPS/(f/s)
    YOLOv8n93.83.006190
    PIC2f-YOLO95.02.60388
    下载: 导出CSV

    表 5  PASCAL VOC2012数据集泛化实验

    Table 5.  Generalization experiment results on the PASCAL VOC2012 dataset

    MethodsmAP50/%Param/MFPS/(f/s)
    YOLOv8n58.83.00971
    PIC2f-YOLO59.22.60645
    下载: 导出CSV

    表 6  NEU-DET数据集实验效果对比

    Table 6.  Comparison experiment results on the NEU-DET dataset

    Methods mAP50/% mAP50-95 /% Param/M FLOPs /G FPS /(f/s)
    Faster-RCNN 76.7 36.3 41.37 134.0 32
    YOLOv3-tiny 69.6 35.4 12.13 18.9 235
    YOLOv5n 74.1 40.6 2.50 7.1 160
    YOLOv6n 70.0 36.6 4.23 11.8 180
    YOLOv7-tiny 67.8 31.2 6.03 13.2 102
    YOLOXs 74.6 39.5 8.94 26.8 97
    YOLOv9-tiny 75.2 41.9 2.62 10.7 130
    YOLOv10n 70.9 38.9 2.69 6.7 140
    YOLOv8n 75.3 40.7 3.01 8.1 163
    PIC2f-YOLO 78.0 43.6 2.60 10.6 82
    下载: 导出CSV

    表 7  PASCAL VOC2012数据集实验效果对比

    Table 7.  Comparison experiment results on the PASCAL VOC2012 dataset

    Methods mAP50/% mAP50-95/% Param/M FLOPs/G FPS/(f/s)
    Faster-RCNN 56.0 40.7 41.43 134.0 13
    YOLOv3-tiny 52.6 31.8 12.13 18.9 107
    YOLOv5n 58.0 40.0 2.51 7.1 71
    YOLOv6n 58.9 43.0 4.24 11.8 72
    YOLOv7-tiny 57.9 40.4 6.06 13.2 58
    YOLOXs 57.6 39.5 8.96 26.8 52
    YOLOv9-tiny 59.1 44.8 2.62 10.7 92
    YOLOv10n 58.9 43.1 2.70 6.7 95
    YOLOv8n 58.8 40.9 3.01 8.1 71
    PIC2f-YOLO 59.2 41.6 2.61 10.6 45
    下载: 导出CSV

    表 8  带状合金功能材料表面缺陷数据集实验效果对比

    Table 8.  Comparison experiment results on the surface defects of strip alloy functional material dataset

    Methods mAP50/% mAP50-95/% Param/M FLOPs/G FPS/(f/s)
    Faster-RCNN 57.2 30.6 41.43 134.0 20
    YOLOv3-tiny 63.5 33.7 12.13 18.9 151
    YOLOv5n 72.3 38.6 2.50 7.1 108
    YOLOv6n 68.9 37.4 4.23 11.8 117
    YOLOv7-tiny 69.7 37.4 6.02 13.1 98
    YOLOXs 66.7 34.5 8.94 26.8 95
    YOLOv9-tiny 71.3 37.9 2.62 10.7 105
    YOLOv10n 64.3 36.8 2.69 6.7 110
    YOLOv8n 74.1 42.1 3.01 8.1 113
    PIC2f-YOLO 75.6 42.8 2.61 10.6 60
    下载: 导出CSV
  • [1]

    李国权. 高炉无料钟炉顶设备维护发展现状分析[J]. 设备管理与维修, 2019, (6): 35−36. doi: 10.16621/j.cnki.issn1001-0599.2019.03D.17

    Li G Q. Analysis on the development status of bell-less top equipment maintenance for blast furnaces[J]. Plant Maintenance Eng, 2019, (6): 35−36. doi: 10.16621/j.cnki.issn1001-0599.2019.03D.17

    [2]

    潘晨燕. 基于改进SPIHT算法的钢板表面缺陷漏磁检测海量数据压缩方法研究[D]. 沈阳: 东北大学, 2013.

    Pan C Y. Research on data compression method of massive magnetic flux leakage detection data of surface defects on steel plate based on improved SPIHT algorithm[D]. Shenyang: Northeastern University, 2013.

    [3]

    徐长航, 陈国明, 谢静. 红外图像处理技术在金属表面缺陷检测中的应用[J]. 制造业自动化, 2009, 31(10): 51−54. doi: 10.3969/j.issn.1009-0134.2009.10.015

    Xu C H, Chen G M, Xie J. Application of infrared thermography technology in surface defects detection of products in metal[J]. Manuf Autom Eng, 2009, 31(10): 51−54. doi: 10.3969/j.issn.1009-0134.2009.10.015

    [4]

    Li X D, Mao W J, Jiang W. Image recognition for steel ball's surface quality detecting based on kernel extreme learning machine[C]//Proceedings of the 34th Chinese Control Conference, 2015: 3727–3731. https://doi.org/10.1109/ChiCC.2015.7260217.

    [5]

    Lu J L, Lin M X, Huang Y, et al. A high-accuracy algorithm for surface defect detection of steel based on DAG-SVM[J]. Sens Transducers, 2013, 157(10): 412−418.

    [6]

    Zhang Z B, Lv G H, Zhao G X, et al. BS-YOLOv5s: insulator defect detection with attention mechanism and multi-scale fusion[C]//Proceedings of 2023 IEEE International Conference on Image Processing, 2023: 2365–2369. https://doi.org/10.1109/ICIP49359.2023.10222163.

    [7]

    Ding K Y, Ding Z H, Zhang Z B, et al. SCD-YOLO: a novel object detection method for efficient road crack detection[J]. Multimedia Syst, 2024, 30(6): 351. doi: 10.21203/rs.3.rs-4350707/v1

    [8]

    朱克佳. 基于深度学习的目标检测研究[J]. 现代信息科技, 2024, 8(13): 76−83. doi: 10.19850/j.cnki.2096-4706.2024.13.016

    Zhu K J. Research on object detection based on deep learning[J]. Mod Inf Technol, 2024, 8(13): 76−83. doi: 10.19850/j.cnki.2096-4706.2024.13.016

    [9]

    Ren S Q, He K M, Girshick R, et al. Faster R-CNN: towards real-time object detection with region proposal networks[J]. IEEE Trans Pattern Anal Mach Intell, 2017, 39(6): 1137−1149. doi: 10.1109/TPAMI.2016.2577031

    [10]

    刘琪, 雷景生. 基于改进深度网络的钢材表面缺陷检测[J]. 计算机工程与设计, 2022, 43(9): 2654−2661. doi: 10.16208/j.issn1000-7024.2022.09.033

    Liu Q, Lei J S. Surface defect detection of steel based on improved deep network[J]. Comput Eng Design, 2022, 43(9): 2654−2661. doi: 10.16208/j.issn1000-7024.2022.09.033

    [11]

    Shi X C, Zhou S K, Tai Y C, et al. An improved Faster R-CNN for steel surface defect detection[C]//Proceedings of 2022 IEEE 24th International Workshop on Multimedia Signal Processing, 2022: 1–5. https://doi.org/10.1109/MMSP55362.2022.9949350.

    [12]

    姜菲菲, 李宁, 邱翠翠, 等. 基于改进Faster RCNN的金属丝网缺陷检测方法[J]. 中国科技论文, 2024, 19(2): 153−159. doi: 10.3969/j.issn.2095-2783.2024.02.003

    Jiang F F, Li N, Qiu C C, et al. Defect detection method of wire mesh based on improved Faster RCNN[J]. China Sciencepaper, 2024, 19(2): 153−159. doi: 10.3969/j.issn.2095-2783.2024.02.003

    [13]

    马燕婷, 赵红东, 阎超, 等. 改进YOLOv5网络的带钢表面缺陷检测方法[J]. 电子测量与仪器学报, 2022, 36(8): 150−157. doi: 10.13382/j.jemi.B2205354

    Ma Y T, Zhao H D, Yan C, et al. Strip steel surface defect detection method by improved YOLOv5 network[J]. J Electron Meas Instrum, 2022, 36(8): 150−157. doi: 10.13382/j.jemi.B2205354

    [14]

    Vaswani A, Shazeer N, Parmar N, et al. Attention is all you need[C]//Proceedings of the 31st International Conference on Neural Information Processing Systems, 2017: 6000–6010.

    [15]

    李鑫, 汪诚, 李彬, 等. 改进YOLOv5的钢材表面缺陷检测算法[J]. 空军工程大学学报, 2022, 23(2): 26−33. doi: 10.3969/j.issn.1009-3516.2022.02.005

    Li X, Wang C, Li B, et al. Steel surface defect detection algorithm based on Improved YOLOv 5[J]. J Air Force Eng Univ, 2022, 23(2): 26−33. doi: 10.3969/j.issn.1009-3516.2022.02.005

    [16]

    熊聪, 于安宁, 高兴华, 等. 基于改进YOLOX的钢材表面缺陷检测算法[J]. 电子测量技术, 2023, 46(9): 151−157. doi: 10.19651/j.cnki.emt.2211012

    Xiong C, Yu A N, Gao X H, et al. Steel surface defect detection algorithm based on improved YOLOX[J]. Electron Meas Technol, 2023, 46(9): 151−157. doi: 10.19651/j.cnki.emt.2211012

    [17]

    梁礼明, 龙鹏威, 卢宝贺, 等. 改进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

    [18]

    杨本臣, 李世熙, 李依泽, 等. 改进YOLOv8n的钢材表面缺陷检测算法[J/OL]. 机械科学与技术, 2024: 1–10. [2024-09-20].https://doi.org/10.13433/j.cnki.1003-8728.20240135.

    Yang B C, Li S X, Li Y Z, et al. Improved YOLOv8n algorithm for steel surface defect detection[J/OL]. Mech Sci Technol Aerosp Eng, 2024: 1–10. [2024-09-20].https://doi.org/10.13433/j.cnki.1003-8728.20240135.

    [19]

    Ultralytics. YOLOv8: the latest version of YOLO object detection algorithm[EB/OL]. GitHub, 2023. [2024-08-22].https://github.com/ultralytics/ultralytics.

    [20]

    Chen J R, Kao S H, He H, et al. Run, don't walk: chasing higher FLOPS for faster neural networks[C]//Proceedings of 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2023: 12021–12031. https://doi.org/10.1109/CVPR52729.2023.01157.

    [21]

    Zhang J N, Li X T, Li J, et al. Rethinking mobile block for efficient attention-based models[C]//Proceedings of 2023 IEEE/CVF International Conference on Computer Vision, 2023: 1389–1400. https://doi.org/10.1109/ICCV51070.2023.00134.

    [22]

    Zhao Y, Lv W Y, Xu S J, et al. DETRs beat YOLOs on real-time object detection[C]//Proceedings of 2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2024: 16965–16974. https://doi.org/10.1109/CVPR52733.2024.01605.

    [23]

    Wang C Y, Yeh I H, Liao H Y M, et al. YOLOv9: learning what you want to learn using programmable gradient information[C]//Proceedings of the 18th European Conference on Computer Vision, 2024: 1–21. https://doi.org/10.1007/978-3-031-72751-1_1.

    [24]

    He Y, Song K C, Meng Q G, et al. An end-to-end steel surface defect detection approach via fusing multiple hierarchical features[J]. IEEE Trans Instrum Meas, 2020, 69(4): 1493−1504. doi: 10.1109/TIM.2019.2915404

    [25]

    铝片表面工业缺陷目标检测[EB/OL]. Baidu AI Studio, 2022. [2024-09-25].https://aistudio.baidu.com/datasetdetail/135640.

    Lion C. Surface defect detection for aluminum sheets in iIndustrial applications[EB/OL]. Baidu AI Studio, 2022. [2024-09-25].https://aistudio.baidu.com/datasetdetail/135640. Lion C.

    [26]

    Everingham M, Eslami S M A, Van Gool L, et al. The PASCAL visual object classes challenge: a retrospective[J]. Int J Comput Vision, 2015, 111(1): 98−136. doi: 10.1007/s11263-014-0733-5

    [27]

    带状合金功能材料表面缺陷数据集[EB/OL]. Baidu AI Studio, 2024. [2024-10-22].https://aistudio.baidu.com/datasetdetail/299785.

    Hu Y L. Dataset of surface defects of strip alloy functional materials[EB/OL]. Baidu AI Studio, 2024. [2024-10-22].https://aistudio.baidu.com/datasetdetail/299785. Hu Y L.

    [28]

    易遵辉, 蒋朝辉, 陈晓方, 等. 基于成像区域模型的工业相机视场角优化配置方法[J/OL]. 控制理论与应用, 2023: 1–9. [2024-11-29].http://kns.cnki.net/kcms/detail/44.1240.TP.20231214.0848.038.html.

    Yi Z H, Jiang C H, Chen X F, et al. Optimal configuration method for field angle of industrial cameras based on imaging area model[J/OL]. Control Theory Appl, 2023: 1–9. [2024-11-29].http://kns.cnki.net/kcms/detail/44.1240.TP.20231214.0848.038.html.

    [29]

    帅金晓. 单芯片CMOS图像传感器数字系统的设计与实现[D]. 湖南: 湖南大学, 2009.

    Shuai J X. The design and implementation of the digital system of a System-on-a-Chip CMOS image sensor[D]. Hunan: Hunan University, 2009.

    [30]

    Redmon J, Farhadi A. YOLOv3: an incremental improvement[Z]. arXiv: 1804.02767, 2018. https://arxiv.org/abs/1804.02767.

    [31]

    Li C Y, Li L L, Jiag H L, et al. YOLOv6: a single-stage object detection framework for industrial applications[Z]. arXiv: 2209.02976, 2022. https://arxiv.org/abs/2209.02976.

    [32]

    Wang C Y, Bochkovskiy A, Liao H Y M. YOLOv7: trainable bag-of-freebies sets new state-of-the-art for real-time object detectors[C]//Proceedings of 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2023: 7464–7475. https://doi.org/10.1109/CVPR52729.2023.00721.

    [33]

    Ge Z, Liu S T, Wang F, et al. YOLOX: exceeding YOLO series in 2021[Z]. arXiv: 2107.08430, 2021. https://arxiv.org/abs/2107.08430.

    [34]

    Wang A, Chen H, Liu L H, et al. YOLOv10: real-time end-to-end object detection[Z]. arXiv: 2405.14458, 2024. https://arxiv.org/abs/2405.14458.

  • 加载中

(13)

(8)

计量
  • 文章访问数: 
  • PDF下载数: 
  • 施引文献:  0
出版历程
收稿日期:  2024-10-23
修回日期:  2024-12-15
录用日期:  2024-12-16
刊出日期:  2025-01-25

目录

/

返回文章
返回