Computer Engineering and Applications ›› 2024, Vol. 60 ›› Issue (20): 302-311.DOI: 10.3778/j.issn.1002-8331.2306-0142

• Engineering and Applications • Previous Articles     Next Articles

Fabric Defect Detection Method with Improved YOLOv5

ZHU Lei, WANG Qianqian, YAO Lina, PAN Yang, ZHANG Bo   

  1. College of Electronics and Information, Xi’an Polytechnic University, Xi’an 710048, China
  • Online:2024-10-15 Published:2024-10-15

改进YOLOv5的织物缺陷检测方法

朱磊,王倩倩,姚丽娜,潘杨,张博   

  1. 西安工程大学 电子信息学院,西安 710048

Abstract: In order to improve the accuracy of deep learning method for fabric defect detection without increasing the amount of network parameters, a fabric defect detection method based on improved YOLOv5 is proposed. Firstly, the channel attention is transformed by depthwise convolution, the maximum pooling of clipping is used to optimize the spatial attention, and the feature extraction sub-network is built through the double-cascade attention mechanism constructed by the two, so as to improve the network’s ability to extract the texture and semantic features of the defect area. Secondly, the ghost-shuffle convolution is used to improve the feature fusion sub-network to strengthen the screening of extracted features, which reduces the amount of model parameters and improves the problem of defect information loss and invalid information redundancy. Finally, a new loss function SIOU with angular loss is introduced at the detection end to promote the fitting of the real box and the prediction box and improve the accuracy of defect prediction. The results show that the improved YOLOv5 method can reduce the complexity and calculation amount of YOLOv5 benchmark model, and can obtain higher detection accuracy compared with six advanced methods such as YOLOv7, which increases the mAP@0.5 value by 2.6 percentage points and the mAP@0.5:0.9 value by 1.3 percentage points compared with the original model.

Key words: fabric defect detection, convolutional neural networks, YOLOv5, dual cascade attention mechanism, loss function

摘要: 为了在不增加网络参数量的条件下提升深度学习方法对织物缺陷检测的精度,提出了一种基于改进YOLOv5的织物缺陷检测方法。通过深度卷积改造通道注意力,剪裁最大池化优化空间注意力,并通过二者构建的双级联注意力机制来搭建特征提取子网络,从而提高网络对缺陷区域纹理和语义特征的提取能力;采用鬼影混洗卷积改进特征融合子网络,强化对提取特征的筛选,在降低模型参数量的同时,改善缺陷信息丢失和无效信息冗余问题;在检测端引入具有角度损失的新型损失函数SIOU,来促进真实框和预测框的拟合并提升对缺陷预测的准确性。实验结果表明:改进的YOLOv5方法在降低YOLOv5基准模型复杂度和计算量的同时,与YOLOv7等六种先进方法相比,可获得更高的检测精度,相较原模型mAP@0.5值提高了2.6个百分点,mAP@0.5:0.9值提高了1.3个百分点。

关键词: 织物缺陷检测, 卷积神经网络, YOLOv5, 双级联注意力机制, 损失函数