A fabric defect detection algorithm based on improved YOLOv5 was proposed in this paper to address the challenges of low accuracy in fabric defect detection caused by the complexity of fabric surface textures and the difficulty in detecting small targets.Firstly,the CBAM attention mechanism was added to the backbone network of YOLOv5 to enhance useful feature information while reducing irrelevant information.Secondly,the Path Aggregation Network(PANet)in the Neck layer was replaced with the Weighted Bi-directional Feature Pyramid Network(Bi-FPN)to better balance multi-scale feature information and improve the detection capability of small targets.Finally,the loss function was improved by introducing the Focal EIOU Loss function,which replaces the CIOU Loss function,not only accelerates the convergence speed but also effectively addresses the issue of imbalanced difficult and easy samples.Practice shows that the mAP for improved training model is 84.5%,a 4.7%increase compared to the non-improved model,meeting the fabric defect detection requirements in actual production.
YOLOv5defect detectionattention mechanismBi-directional Feature Pyramid NetworkFocal EIOU Loss