作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2023, Vol. 49 ›› Issue (11): 302-310. doi: 10.19678/j.issn.1000-3428.0066734

• 开发研究与工程应用 • 上一篇    下一篇

基于改进YOLOv7的液压阀块表面微小缺陷检测

季娟娟1, 王佳1, 陈亚杰2, 卢道华1,3   

  1. 1. 江苏科技大学 机械工程学院, 江苏 镇江 212100
    2. 中国船舶重工集团公司 上海船舶设备研究所, 上海 200031
    3. 江苏科技大学 海洋装备研究院, 江苏 镇江 212003
  • 收稿日期:2023-01-11 出版日期:2023-11-15 发布日期:2023-11-08
  • 作者简介:

    季娟娟(1997—),女,硕士研究生,主研方向为机器视觉、深度学习

    王佳,副教授、硕士

    陈亚杰,高级工程师、硕士

    卢道华,教授、博士、博士生导师

  • 基金资助:
    国家重点研发计划(2018YFC0309100); 江苏省重点研发计划(BE2022062)

Detection of Minor Defects on the Surface of Hydraulic Valve Block Based on Improved YOLOv7

Juanjuan JI1, Jia WANG1, Yajie CHEN2, Daohua LU1,3   

  1. 1. School of Mechanical Engineering, Jiangsu University of Science and Technology, Zhenjiang 212100, Jiangsu, China
    2. Shanghai Marine Equipment Research Institute, China Shipbuilding Industry Group Co., Ltd., Shanghai 200031, China
    3. Marine Equipment and Technology Institute, Jiangsu University of Science and Technology, Zhenjiang 212003, Jiangsu, China
  • Received:2023-01-11 Online:2023-11-15 Published:2023-11-08

摘要:

针对液压阀块表面缺陷尺寸微小、对比度低、周围干扰信息多导致的漏检率高、识别准确率低等问题,提出一种基于改进YOLOv7的液压阀块表面微小缺陷检测算法。在多尺度特征融合模块后引入CA注意力机制来提高对微小缺陷特征信息的关注度。使用改进的UpC多支路上采样结构代替多尺度特征融合模块中的最近邻插值上采样UpSampling模块,以丰富微小缺陷的特征信息。利用改进的ELAN-RepConv结构代替多尺度特征融合模块中的ELAN_2结构,使模型在训练过程中可以学习到更多的特征信息。为了进一步提高算法的鲁棒性与收敛速度,使用离线数据增强融合Mosaic数据增强的数据增广技术与K-means++锚框聚类算法来提高算法性能。实验结果表明:该算法在液压阀块表面微小缺陷数据集中平均精度达到97.6%,较原YOLOv7算法提高8.4个百分点,检测速度达到55.2 frame/s;相较于YOLOv7系列中检测精度最高的YOLOv7-E6E算法,该算法在参数量减少75.4%的情况下,平均精度值提高1.8个百分点。所提算法在保证实时性的前提下能够有效提高检测精度。

关键词: YOLOv7算法, 液压阀块, 缺陷检测, 深度学习, 注意力机制

Abstract:

To address issues such as the extremely small size of hydraulic valve block surface defects, low contrast, and significant surrounding interference information, which lead to a high leakage detection rate and low recognition accuracy, a detection algorithm of minor defects on the surface of a hydraulic valve block based on improved YOLOv7 algorithm is proposed. First, a CA attention mechanism is introduced after the multi-scale feature fusion module to improve attention to the feature information of minor defects. Then, the improved UpC multi-branch upsampling structure is used to replace the nearest-neighbor interpolation UpSampling in the multi-scale feature fusion module to enrich the feature information of minor defects. Finally, an improved ELAN-RepConv structure is used to replace the ELAN_2 structure in the multi-scale feature fusion module, so that the model can learn more feature information during the training process. To improve the robustness and convergence speed of the algorithm further, offline data augmentation, fusing Mosaic data augmentation, and the K-means++ clustering anchor box algorithm are used to enhance the performance of the algorithm. The experimental results indicate that the Average Precision(AP) value of this algorithm on the dataset of minor defects on the surface of the hydraulic valve block is 97.6%, 8.4 percentage points higher than the original YOLOv7 algorithm, and the detection speed reaches 55.2 frame/s. Compared with the YOLOv7-E6E algorithm, which has the highest detection accuracy in the YOLOv7 series, the AP value is improved by 1.8 percentage points when the number of parameters is reduced by 75.4%. The experimental results show that the improved algorithm can improve detection precision on the premise of ensuring real-time.

Key words: YOLOv7 algorithm, hydraulic valve block, defect detection, deep learning, attention mechanism