In the process of fabric production, various types of defects affect the quality of a fabric. However, due to the wide variety of fabric defects, the complexity of fabric textures, and the concealment of small target defects, current fabric defect detection algorithms suffer from issues such as having a slow detection speed, low detection accuracy, and a low recognition rate of small target defects. Therefore, developing an efficient and accurate fabric defect detection system has become an urgent problem that needs to be addressed in the textile industry. Addressing the aforementioned issues, this paper proposes an improved YOLOv8n-LAW algorithm based on the YOLOv8n algorithm. First, LSKNet attention mechanisms are added to both ends of the C2f module in the backbone network to provide a broader context area, enhancing the algorithm’s feature extraction capability. Next, the PAN-FPN structure of the backbone network is replaced by the AFPN structure, so that the different levels of features of the defects are closer to the semantic information in the progressive fusion. Finally, the CIoU loss is replaced with the WIoU v3 loss, allowing the model to dynamically adjust gradient gains based on the features of fabric defects, effectively focusing on distinguishing between defective and non-defective regions. The experimental results show that the improved YOLOv8n-LAW algorithm achieved an accuracy of 97.4% and a detection speed of 46 frames per second, while effectively increasing the recognition rate of small target defects.
Read full abstract