计算机工程与应用 ›› 2024, Vol. 60 ›› Issue (18): 88-102.DOI: 10.3778/j.issn.1002-8331.2312-0155

• YOLOv8 改进及应用专题 • 上一篇    下一篇

改进YOLOv8的轻量级瓷砖表面缺陷检测

余松森,薛国鹏,何皇,赵桂,文火生   

  1. 华南师范大学 软件学院,广东 佛山 528225
  • 出版日期:2024-09-15 发布日期:2024-09-13

Lightweight Detection of Ceramic Tile Surface Defects on Improved YOLOv8

YU Songsen, XUE Guopeng, HE Huang, ZHAO Gui, WEN Huosheng   

  1. School of Software, South China Normal University, Foshan, Guangdong 528225, China
  • Online:2024-09-15 Published:2024-09-13

摘要: 在瓷砖表面缺陷检测方面,在保证一定检测速度的前提下,对于小目标缺陷的检测较为困难,总体检测精度依然较低。提出了一种改进YOLOv8的瓷砖表面缺陷检测方法。第一,对原始的大幅面瓷砖数据集进行数据预处理,通过切片操作得到适合YOLOv8输入尺寸的瓷砖数据,防止瓷砖缺陷在缩放的过程中丢失;第二,考虑到瓷砖表面存在小目标缺陷的占比较大问题,使用SPD-Conv的结构代替传统的下采样方式,能够完整地保留通道维度中的所有信息,从而提高对小目标缺陷的检测能力;第三,对YOLOv8中原有的C2f模块进行改造,加入了Efficient Channel Attention注意力机制,设计了C2f_ECA模块,并在backbone网络中进行替换,使得网络在特征提取的过程中能够更为关注缺陷信息,减少背景信息的干扰;第四,添加了微小目标检测头在第二次下采样后进行检测,提高YOLOv8对微小目标的检测能力。该方法在天池瓷砖瑕疵检测数据集上进行实验验证,改进后的模型分别在mAP50-95、mAP50和mAP75上达到57.7%、86.6%、60.6%,比基础网络YOLOv8s分别提升了9.4、5、14.3个百分点。同时,高于YOLOv8m的精度和远低于YOLOv8m的复杂度,属于轻量级模型,符合工业化的需求。

关键词: 深度学习, 目标检测, 瓷砖表面缺陷检测, YOLOv8, 注意力机制

Abstract: In terms of tile surface defect detection, under the premise of ensuring a certain detection speed, it is more difficult to detect small target defects, and the overall detection accuracy is still low. This paper proposes an improved tile surface defect detection method for YOLOv8. Firstly, data preprocessing is performed on the original large-format tile dataset, and tile data suitable for the input size of YOLOv8 is obtained through slicing operation to prevent tile defects from being lost in the process of scaling. Secondly, taking into account that there is a large proportion of small target defects on the tile surface, the structure of SPD-Conv is used instead of the traditional downsampling method, which can completely retain all the information in the channel dimension, so as to improve the detection ability of small target defects. Thirdly, the original C2f module in YOLOv8 is modified by adding the efficient channel attention (ECA) mechanism, designing the C2f_ECA module, and replacing it in the backbone network, so that the network can pay more attention to the defect information and reduce the interference of background information in the process of feature extraction  Fourthly, the tiny target detection head is added to detect after the second downsampling to improve the detection ability of YOLOv8 on tiny targets. The method is experimentally validated on the Tianchi tile defect detection dataset, and the improved model achieves 57.7%, 86.6%, and 60.6% on mAP50-95, mAP50, and mAP75, respectively, which are 9.4, 5, and 14.3 percentage points higher than the base network YOLOv8s, respectively. Meanwhile, there are higher accuracy and much lower complexity than YOLOv8m, which is a lightweight model and meets the needs of industrialization.

Key words: deep learning, target detection, surface defect detection of ceramic tiles, YOLOv8, attention mechanism