Computer Engineering and Applications ›› 2024, Vol. 60 ›› Issue (18): 126-135.DOI: 10.3778/j.issn.1002-8331.2405-0099

• Special Issue on YOLOv8 Improvements and Applications • Previous Articles     Next Articles

Research on O-Ring Surface Defect Detection Algorithm Based on Improved YOLOv8n

LI Qi, SHI Yan, FAN Tao   

  1. School of Mechanical Engineering, Sichuan University of Science & Engineering, Yibin, Sichuan 644000, China
  • Online:2024-09-15 Published:2024-09-13

改进YOLOv8n的O型密封圈表面缺陷检测算法研究

李淇,石艳,范桃   

  1. 四川轻化工大学 机械工程学院,四川 宜宾 644000

Abstract: Aiming at the problems such as small surface defect scale, high similarity between defect features and background, difficulty in feature extraction and the needs of industrial real-time detection, an improved YOLOv8n YOLO-Oring algorithm is proposed. On the basis of convolution calculation, a new CBLGhost module is designed by incorporating linear changes to reduce the computational resources required for calculating feature graphs. In view of the high similarity between defects and background, the DySample dynamic up-sampling module is introduced to make the sampling points concentrate in the target area and ignore the background part, so as to realize the effective identification of defects. In order to improve the detection efficiency, the C2f-OREPA module is designed to convert the complex structural reparameters into a single convolution layer, which can reduce a lot of training time while maintaining the feature expression ability. In order to improve the  ability of algorithm to identify small-scale defects, DyHead-DCNv3 detection head is designed to identify multi-scale targets, and make up for the shortcomings of traditional standard convolution in long-distance modeling ability and adaptive spatial aggregation ability, so as to better complete the detection task. Due to the lack of O-ring detection dataset, 1?734 datasets including 3 types of defects, such as scratches, dents and burrs, are established. Experimental results show that the mAP of YOLO-Oring algorithm reaches 94.1%, increasing by 1.3 percentage points, and FLOPs has decreased by 16%. Compared with mainstream target detection algorithms, the results show that YOLO-Oring algorithm has better detection performance for O-ring surface defects and is more conducive to industrial real-time detection.

Key words: defect detection, YOLOv8, O-ring, DySample

摘要: 针对O型密封圈表面缺陷尺度小且缺陷特征与背景相似性高,存在特征提取困难等问题与工业实时检测的需求,提出一种改进YOLOv8n的YOLO-Oring算法。在卷积计算的基础上,融入线性变化,设计新的CBLGhost模块,减小计算特征图所需的计算资源;针对缺陷与背景相似度高,引入DySample轻量动态上采样模块,使采样点集中在目标区域而忽略背景部分,实现缺陷的有效识别;为提高检测效率,设计C2f-OREPA模块,将复杂的结构重参数转为单卷积层,在保持特征表达能力的同时降低大量训练耗时;为提高算法对小尺度缺陷识别能力,设计DyHead-DCNv3检测头,用于识别多尺度目标,弥补传统标准卷积在长距离建模能力和自适应空间聚合能力上的不足,从而更好地完成检测任务。由于O型密封圈检测数据集缺乏,建立了包括划痕、凹陷、毛刺3类缺陷的1?734张数据集,实验结果表明,YOLO-Oring算法的mAP达到了94.1%,提升了1.3个百分点,FLOPs降低了16%。通过与主流目标检测算法进行比较,结果表明YOLO-Oring算法对O型密封圈表面缺陷有较好的检测性能,更利于工业实时检测。

关键词: 缺陷检测, YOLOv8, O型密封圈, DySample