Fabric defect detection algorithm based on improved YOLOv5 - Li, Feng; Xiao, Kang; Hu, Zhengpeng; Zhang, Guozheng (The Visual computer, 2024)
Fabric defect detection is an important part of the textile industry, aiming at the problems of many types of fabric defects, small size defects and unbalanced samples, an improved YOLOv5 fabric defect detection algorithm, FD-YOLOv5, was proposed. First, the coordinate attention module is embedded in the YOLOv5 backbone network structure to replace the bottleneck structure in the original network model. While reducing the amount of parameters and calculation, it enhances the ability of the network to extract features and improves the model's ability to detect small target defects. Secondly, a smoother Mish activation function is used in the original model convolution structure for model training, which improves the nonlinear expression ability of the model; the SIoU loss function considering the direction of the anchor box is used to improve the convergence speed and detection accuracy of the model. Finally, combining the focal loss and GHM loss functions as the target confidence loss function to solve the problem of sample imbalance in the fabric defect dataset. The experimental results based on the public fabric defect dataset of Aliyun TianChi shows that the mAP@.5 and mAP@.5:.95 of the improved algorithm are 65.1% and 30.4%, respectively, which are 8.3% and 3.2% higher than the original model, respectively, and the parameter amount, calculation amount and weight of the model are reduced by 8.4%, 11.2% and 14.3%, respectively, compared with the original model. Even compared with the state-of-the-art YOLOv7 model, the mAP@.5 value of the proposed model is improved by 6.5%. Although the FPS value is lower than YOLOv7 model, it also achieves a detection speed of 79 frames per second, which can meet the real-time demand. The experimental results demonstrate the effectiveness of the method in this paper, which can provide a reference for the automatic detection method of fabric defects.