## 5 Conclusions and Future Work  
Considering the complexity of yarn hairiness detection and characterization, a novel approach based on an optimized algorithm YOLOv586-Yarn Hairiness was proposed. First, the C2f function was introduced into the backbone structure before the \"SPPF\" block. This insertion allowed the model to capture important contextual and spatial information at different scale levels. It enabled the detection network to extract higher-level features and reduce interference from non-essential feature information. Second, by adding the Bot-Transformer module in the Neck, which incorporates the self-attention mechanism, the network learned more complex and contextual relationships between different parts of the images. This led to richer and more discriminative feature representations beneficial for detecting fine and subtle details and improving the detection of overlapping objects. Third, the training data were enhanced using the GeLU activation function which provided a more complex non-linear representation compared to SiLU. This was advantageous for capturing more complex patterns and high-resolution image information in the input data. Finally, the hyperparameters such as anchor_t and scale were adjusted to improve the performance on the dataset as the input images had a very high resolution of 1280 \(\times\) 1280 pixels. This required adjusting the detection process for loop fibers and protruding fibers which have smaller dimensions. Through the experiments, it was possible to conclude that the proposed YOLOv586-Yarn Hairiness algorithm improved the mAP0.5:0.95 by 11.55%, the mAP0.5 by 5.43%, and the recall by 7.36% compared to the standard YOLOv586 algorithm. Additionally, the algorithm demonstrated a 3.71% increase in the F1-score, a 1.11% increase in accuracy, and a minor improvement of 0.39% in precision. These results are very promising and demonstrate a good performance. In summary, the proposed optimized method showed better object detection accuracy than the original YOLOv5, making it a more efficient and high-performing neural network for the detection of yarn hairiness. The enhanced YOLOv586-Yarn Hairiness structure exhibited a good performance in the detection of protruding fibers and, most importantly, showed a very good performance in the detection of loop fibers, which is a highly complex class due to its irregularity and spatial distribution. The complexity of loop fiber detection arises from several critical factors. First, their irregular shape, defined by loop-like structures with varying sizes and orientations, poses significant challenges for consistent detection. Second, their unpredictable arrangement along the surface of the yarn core adds another layer of difficulty. This non-uniform arrangement affects both loop fibers and protruding fibers, as their positioning on the yarn surface can obscure their visibility in images. Finally, loop fibers often blend into the yarn structure, overlapping and intertwining with other fibers, including protruding fibers, further complicating their detection. As a future work, there is potential to further improve the enhancement methods for detecting loop fibers aiming to reduce noise or false detections in this class. It would be important to investigate the reasons for false negatives in more detail and seek model improvements to reduce such errors in loop fibers detection. One of the next steps in this work will be to expand the dataset to include a greater diversity of yarn types, textures, and environmental conditions, which will further validate the generalization of the model. In addition, exploring more suitable and novel blocks to improve the network structure and improve the accuracy of loop fibers detection should be considered.