Fiber fabric defect detection method and device

By constructing the SRSE-YOLO model, combining SCConv_BS, RL-SPPF, SCE-C2f and EMA modules, feature fusion and bounding box regression are optimized, and the problems of low robustness and accuracy in textile defect detection are solved, and efficient and lightweight defect detection is achieved.

CN120451057APending Publication Date: 2025-08-08ZHEJIANG SCI-TECH UNIV
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510481872.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-17
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

Existing textile defect detection methods are relatively robust and accurate when dealing with complex backgrounds, small size defects or extreme aspect ratio defects, and are difficult to take into account both lightweight and detection performance.

Method used

The SRSE-YOLO model is constructed, and by introducing the SCConv_BS module, RL-SPPF module, SCE-C2f module and EMA module, a small object detection head is added, and the Inner-DIoU loss function is used to optimize feature fusion and bounding box regression.

Benefits of technology

It improves the accuracy and robustness of fiber fabric defect detection, reduces the calculation amount and parameter amount, improves the detection performance of small or irregular shape defects, and enhances the adaptability and consistency of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120451057A_ABST
    Figure CN120451057A_ABST
Patent Text Reader

Abstract

The invention discloses a fiber fabric defect detection method and device, relates to the technical field of fiber fabric defect detection, and solves the problems that in the prior art, a model is low in robustness and accuracy when processing complex backgrounds, small-size defects or extreme length-width ratio defects, and light weight and detection performance are difficult to consider at the same time. The method comprises the steps that a data set and an SRSE-YOLO model are constructed, an SCConvBS module, an RL-SPPF module, an SCE-C2f module and an Inner-DIOU loss function are introduced into the SRSE-YOLO model on the basis of a YOLOv8 model, a small target detection head with the scale of 160 * 160 is added, then model training and application are carried out, the capturing capacity of complex textures and detail features can be enhanced, and the capturing efficiency of the SRSE-YOLO model is improved. Compared with the prior art, the method has the advantages that the calculation amount and the parameter amount are reduced while the detection precision is improved, effective fusion of multi-scale features of the model is realized, the detection performance of small or irregular-shaped defects is improved, and the recognition rate of the small defects and the precision of a detection frame are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of fiber fabric defect detection, and in particular to a fiber fabric defect detection method and device. Background Art

[0002] With the increasing automation in the textile industry, textile companies are placing increasing demands on quality control during the production process. Fabric defect detection has become an indispensable quality control step in fabric manufacturing. Fabric defects refer to surface imperfections on fabrics caused by various reasons during the weaving process, such as warp hangs, knots, oil stains, and holes. Fabric defects not only affect the aesthetic appearance of the fabric but can also reduce its performance, severely impacting the product's market acceptance and the company's economic benefits. Traditional methods for detecting fabric defects rely primarily on manual visual inspection, a method that is not only inefficient and labor-intensive, but also susceptible to subjective factors affecting the inspector, resulting in a lack of consistency and reliability. Furthermore, due to the diverse morphology, random distribution, and varying sizes of fabric defects, traditional methods for detecting fabric defects are no longer able to meet the needs of modern large-scale production. Therefore, developing an efficient and accurate method for detecting fabric defects has become a critical issue that needs to be addressed urgently in the textile industry.

[0003] In order to address the shortcomings of traditional detection methods, researchers have been committed to studying automatic fabric defect detection technology in recent years. Among them, machine vision technology has become a research hotspot in the field of fabric defect detection due to its advantages such as non-contact, fast speed, and accuracy. With the rise of deep learning technology, deep learning-based fabric defect detection methods have also made significant progress, providing a new approach to achieve efficient and accurate fabric defect detection. QuHao et al. proposed a new network called U-SMRNet, which combines ResNet-50 and SwinTransformer modules. It improves the accuracy of fabric defect detection and the clarity of edge detection through multi-scale feature extraction, dual-branch pyramid module (DBPM), and recursive multi-level residual decoding blocks. Suryarasmi et al. proposed a lightweight CNN architecture FN-Net, combined with an adaptive threshold classification method, for fabric defect detection. It achieves a higher F1 score than existing advanced models while maintaining low computing resource requirements. Zhou et al. proposed a series of efficient defect detectors called Efficient Defect Detectors (EDDs), which are specifically optimized for fabric quality inspection. They improve computational efficiency through a lightweight backbone network and an L-shaped feature pyramid network (L-FPN), and achieve a good balance between accuracy and speed under different resource constraints. Chen et al. proposed an efficient fabric defect detection method based on a Siamese network. This method uses normal and defective images to identify texture features and detects defective areas through overlapping block recognition, ensuring a good recognition rate. Shi et al. proposed a fast and accurate fabric defect detection model called YOLO-GFD. This model significantly improves detection accuracy and speed by introducing G-bottleneck, a new feature fusion network, and a DSE-Block module.

[0004] Although the above-mentioned fabric defect detection methods have made significant progress in improving detection accuracy and speed, they also have some common limitations. First, most of these methods rely on a large amount of high-quality annotated data for training, while defect samples in actual production may be scarce and of poor quality, which limits the generalization ability of the model. Second, the robustness and accuracy of these models when dealing with complex backgrounds, small-sized defects or defects with extreme aspect ratios still need to be improved. In addition, the demand for computing resources is also a problem. Although some methods such as FN-Net and EDDs have made efforts in lightweighting, it remains a challenge to further reduce computing requirements while maintaining high performance. The adaptability of these methods to different types of fabric textures and defect types still needs to be enhanced to ensure reliability and consistency in actual industrial applications. Summary of the Invention

[0005] The purpose of this application is to overcome the problems of low robustness and accuracy of the existing models when dealing with complex backgrounds, small-sized defects or defects with extreme aspect ratios, as well as the difficulty in balancing lightweight and detection performance, and to provide a fiber fabric defect detection method and device.

[0006] In a first aspect, a method for detecting defects in a fiber fabric is provided, comprising:

[0007] Obtain annotated images of fabrics and construct a dataset;

[0008] The SRSE-YOLO model is constructed, which includes the following steps: based on the YOLOv8 model, the SCConv_BS module is introduced to replace some convolution modules, the RL-SPPF module is used in the spatial pyramid pooling fusion module, the SCE-C2f module is introduced in the Neck module, EMA is added after the multi-scale feature fusion module to smooth the update of feature map gradients, the Detect_Inner structure is adopted in the detection head, the Inner-DIoU loss function is used instead of the CIoU loss function, and a 160×160 small object detection head is added to form a multi-scale detection head;

[0009] Using the data set to train the SRSE-YOLO model to obtain a defect detection model;

[0010] The defect detection model is used to detect fiber fabric defects.

[0011] In some possible implementations, the SRSE-YOLO model includes a backbone network, a feature fusion layer and a detection head, wherein the backbone network includes a first SCConv_BS module, a first Conv_BS module, a first C2f layer, a second SCConv_BS module, a second C2f layer, a third SCConv_BS module, a third C2f layer, a second Conv_BS module, a fourth C2f layer and an RL_SPPF module connected in sequence, and the feature fusion layer includes a first upsampling layer, a first splicing layer, a first SCE-C2f module, a second upsampling layer, a second splicing layer, a second SCE-C2f module, a third upsampling layer, a third splicing layer, a third SCE-C2f module, a first EMA module, a third Conv_BS module, a fourth splicing layer, a fourth SCE-C2f module, a second EMA module, a fourth Conv_BS module, a fifth splicing layer, and a fifth SCE-C2f module connected in sequence. , a third EMA module, a fifth Conv_BS module, a sixth splicing layer, a sixth SCE-C2f module and a fourth EMA module, the detection head includes a first Detect_Inner, a second Detect_Inner, a third Detect_Inner and a fourth Detect_Inner, the first C2f layer is also connected to the third splicing layer, the second C2f layer is also connected to the second splicing layer, the third C2f layer is also connected to the first splicing layer, the first SCE-C2f module is also connected to the fifth splicing layer, the second SCE-C2f module is also connected to the fourth splicing layer, the first EMA module is also connected to the first Detect_Inner, the second ENA module is also connected to the second Detect_Inner, the third EMA module is also connected to the third Detect_Inner, and the fourth EMA module is also connected to the fourth Detect_Inner.

[0012] In some possible implementations, the first Conv_BS module, the second Conv_BS module, the third Conv_BS module, the fourth Conv_BS module, and the fifth Conv_BS module each include a first convolutional layer, a two-dimensional batch normalization layer, and a first SiLU activation function layer connected in sequence.

[0013] In some possible implementations, the first SCConv_BS module, the second SCConv_BS module, and the third SCConv_BS module each include a first SCConv module, a two-dimensional batch normalization layer, and a second SiLU activation function layer connected in sequence.

[0014] In some possible implementations, the SCConv module includes a spatial reconstruction unit and a channel reconstruction unit, wherein the spatial reconstruction unit is used to split the input into multiple parts, process each part independently, and then reconstruct it to form a refined output, and the channel reconstruction unit is used to use a split-transform-fusion strategy to reduce channel redundancy.

[0015] In some possible implementations, the RL_SPPF module includes a first Conv_BR module, a first maximum pooling layer, a second maximum pooling layer, a third maximum pooling layer, a seventh splicing layer, an LSKA module, and a second Conv_BR module connected in sequence, wherein the outputs of the first Conv_BR module, the first maximum pooling layer, and the second maximum pooling layer are all connected to the seventh splicing layer, the first Conv_BR module and the second Conv_BR module each include a two-dimensional convolutional layer, a two-dimensional batch normalization layer, and a first ReLU activation function layer connected in sequence, and the LSKA module includes a first Standard depth convolution, second standard depth convolution, first expanded depth convolution, second expanded depth convolution and 1*1 convolution layer, and perform Hadamard product operation on the input of the first standard depth convolution and the output of the 1*1 convolution layer, wherein the expansion parameter of the first standard depth convolution is d, and the convolution kernel size is 1*(2d-1), the expansion parameter of the second standard depth convolution is d, and the convolution kernel size is (2d-1)*1, the intrinsic parameter of the first expanded depth convolution is k, and the convolution kernel size is 1*(k / d), and the intrinsic parameter of the second expanded depth convolution is k, and the convolution kernel size is (k / d)*1.

[0016] In some possible implementations, the first SCE-C2f module and the second SCE-C2f module both include a second convolutional layer, a Split layer, n SCE_Bottleneck modules, an eighth splicing layer and a third convolutional layer connected in sequence, the Split layer and the SCE_Bottleneck module are both connected to the eighth splicing layer, and the output of the Split layer is connected to the eighth splicing layer, wherein the SCE_Bottleneck module includes a second SCConv module, a weighted fusion module and a fourth convolutional layer connected in sequence, the input of the second SCConv module is also connected to the EdgeNet module, the output of the EdgeNet module is connected to the weighted fusion module, the input of the second SCConv module is added to the output of the fourth convolutional layer, and the EdgeNet module includes a fifth convolutional layer, a second ReLU activation function layer, a sixth convolutional layer and a Sigmoid layer connected in sequence.

[0017] In some possible implementations, in the first EMA module, the second EMA module, the third EMA module, and the fourth EMA module, the input feature map is processed at multiple scales through channel grouping, spatial structure information is extracted through horizontal and vertical average pooling, and attention weights are generated through 1×1 convolution. Specifically, the cross-space learning mechanism introduces normalization and soft attention processes in the feature map, and realizes information interaction between channels through global pooling and matrix multiplication. The generated attention weights are activated by the Sigmoid function and then reweighted element-by-element with the original features to finally obtain the enhanced output feature map.

[0018] In some possible implementations, the first Detect_Inner is a small target detection head with a size of 160*160. The sizes of the first Detect_Inner, the second Detect_Inner, the third Detect_Inner and the fourth Detect_Inner are different and are used to capture defects of different sizes to form a multi-scale detection mechanism. The first Detect_Inner, the second Detect_Inner, the third Detect_Inner and the fourth Detect_Inner share the feature map extracted by the backbone network.

[0019] In a second aspect, a fiber fabric defect detection device is provided, comprising:

[0020] A dataset construction module is used to obtain annotated images containing fiber fabrics and then construct a dataset;

[0021] The model construction module is used to build the SRSE-YOLO model. Specifically, it includes the following steps: based on the YOLOv8 model, the SCConv_BS module is introduced to replace some convolution modules, the RL-SPPF module is adopted in the spatial pyramid pooling fusion module, the SCE-C2f module is introduced in the Neck module, EMA is added after the multi-scale feature fusion module to smooth the update of feature map gradients, the Detect_Inner structure is adopted in the detection head, the Inner-DIoU loss function is used instead of the CIoU loss function, and a 160×160 small object detection head is added to form a multi-scale detection head;

[0022] A training module, configured to train the SRSE-YOLO model using the data set to obtain a defect detection model;

[0023] The detection module is used to perform fiber fabric defect detection using the defect detection model.

[0024] This application has the following beneficial effects:

[0025] 1. This application uses SCConv (Split Convolution and Concatenation) to replace some traditional convolution layers to enhance the network's ability to capture complex textures and detailed features, improve overall detection accuracy, and reduce the amount of calculation and parameters.

[0026] 2. This application proposes an improved spatial pyramid pooling fusion module RL-SPPF combined with the LSKA (Local Spatial Kernel Aggregation) mechanism, which achieves effective fusion of multi-scale features of the model and improves the detection performance of small or irregularly shaped defects;

[0027] 3. This application proposes a new SCE-C2f (Spatial Channel Enhancement-CrossStage) module to further promote cross-stage feature interaction and enhance long-distance information transmission, effectively improving the overall detection performance of the model;

[0028] 4. This application embeds the EMA (Exponential Moving Average) attention mechanism in the Neck part, enabling the model to dynamically adjust the importance of each channel during inference and better adapt to the characteristics of different types of defects;

[0029] 5. This application adds a small target detection branch with a resolution of 160×160 on the detection head, and improves the loss function to introduce Inner-DIoU, which greatly improves the recognition rate of tiny defects and the accuracy of the detection frame. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The drawings that constitute a part of this application are used to provide a further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute an improper limitation on this application.

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0032] Figure 1 is a flow chart of the fiber fabric defect detection method of Example 1 of the present application;

[0033] Figure 2 This is the technical roadmap of the SRSE-YOLO model in the fiber fabric defect detection method of Example 1 of the present application;

[0034] FIG3( a ) is a structural diagram of the SRSE-YOLO model in the fiber fabric defect detection method of Example 1 of the present application;

[0035] FIG3( b ) is a structural diagram of the Conv_BS module in the fiber fabric defect detection method of Example 1 of the present application;

[0036] FIG3( c ) is a structural diagram of the SCConv_BS module in the fiber fabric defect detection method of Example 1 of the present application;

[0037] Figure 4 1 is a structural diagram of the SCConv module in the fiber fabric defect detection method of Example 1 of the present application;

[0038] Figure 5 1 is a structural diagram of the RL_SPPF module in the fiber fabric defect detection method of Example 1 of the present application;

[0039] FIG6( a ) is a structural diagram of the SCE-C2f module in the fiber fabric defect detection method of Example 1 of the present application;

[0040] FIG6( b ) is a structural diagram of the SCE_Bottleneck module in the fiber fabric defect detection method of Example 1 of the present application;

[0041] FIG6( c ) is a structural diagram of the EdgeNet module in the fiber fabric defect detection method of Example 1 of the present application;

[0042] Figure 7 1 is a structural diagram of the EMA module in the fiber fabric defect detection method of Example 1 of the present application;

[0043] Figure 8 Schematic diagram of Inner-DIoU in the fiber fabric defect detection method of Example 1 of the present application;

[0044] Figure 9 1 is a structural diagram of the SRSE-YOLO model detection head in the fiber fabric defect detection method of Example 1 of the present application;

[0045] FIG10( a ) is a visual diagram of defects in the Alibaba Cloud Tianchi dataset in the fiber fabric defect detection method of Example 1 of the present application;

[0046] FIG10( b ) is a visual diagram of defects in the TILDA dataset in the fiber fabric defect detection method according to Example 1 of the present application;

[0047] FIG11( a ) is a graph showing different loss function iterations in the fiber fabric defect detection method of Example 1 of the present application;

[0048] FIG11( b ) is a histogram of the last epoch loss value in the fiber fabric defect detection method of Example 1 of the present application;

[0049] FIG12( a ) is a diagram showing the detection effect of the YOLOv8 model method in Example 1 of the present application;

[0050] Figure 12(b) is a diagram showing the detection effect of the FasterR-CNN model method in Example 1 of the present application;

[0051] Figure 12(c) is a diagram showing the detection effect of the YOLOv7-Tiny model method in Example 1 of the present application;

[0052] Figure 12(d) is a diagram showing the detection effect of the YOLOv9t model method in Example 1 of the present application;

[0053] Figure 12(e) is a diagram showing the detection effect of the YOLOv10s model method in Example 1 of the present application;

[0054] FIG12( f ) is a diagram showing the detection effect of the SRSE-YOLO model in the fiber fabric defect detection method of Example 1 of the present application;

[0055] FIG13( a ) is a diagram showing the detection effect of the YOLOv8 model on the TILDA dataset in Example 1 of the present application;

[0056] FIG13( b ) is a diagram showing the detection effect of the SRSE-YOLO model on the TILDA dataset in the fiber fabric defect detection method of Example 1 of the present application;

[0057] Figure 14 This is a structural block diagram of the fiber fabric defect detection device of Example 2 of the present application.

[0058] Reference numerals:

[0059] 100, dataset construction module; 200, model construction module; 300, training module; 400, detection module. DETAILED DESCRIPTION

[0060] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.

[0061] Example 1

[0062] like Figure 1 As shown, a fiber fabric defect detection method involved in Example 1 of the present application includes:

[0063] S100, obtaining and annotating images containing fiber fabrics and constructing a data set;

[0064] First, it is necessary to use cameras and other shooting equipment to collect samples in the textile production workshop. The collected samples should include as many types of fiber fabrics and various types of defects as possible, such as: lint, warp knots, hanging warps, loose warps, weft shrinkage, broken spandex, knots, holes, oil stains, etc. Then, use the annotation tool to annotate the collected image samples, marking whether there are defects and the type of defects. It is best to make the annotated images into a data set and divide the data set into training set, validation set and test set in the ratio of 8:0.8:1.2. In addition, to ensure the consistency of input and the efficient use of computing resources, the image size in all data sets is adjusted to 640x640 pixels.

[0065] S200, constructing the SRSE-YOLO model, specifically including the following steps: based on the YOLOv8 model, introducing the SCConv_BS module to replace part of the convolution module, adopting the RL-SPPF module in the spatial pyramid pooling fusion module, introducing the SCE-C2f module in the Neck module, adding EMA after the multi-scale feature fusion module to smooth the update of the feature map gradient, adopting the Detect_Inner structure in the detection head, adopting the Inner-DIoU loss function instead of the CIoU loss function, and adding a 160×160 scale small target detection head to form a multi-scale detection head;

[0066] Specifically, the technical route of the SRSE-YOLO model is as follows Figure 2The architecture of the SRSE-YOLO model is shown in Figure 3(a). In the backbone, the SRSE-YOLO model introduces the SCConv_BS module (Split-Context Convolution with Batch Normalization and SiLU activation) to replace some traditional convolutional modules, enabling the model to extract richer global and local features. A new RL-SPPF module is used in the spatial pyramid pooling fusion module, further improving the model's detection accuracy and robustness. In the neck, the SCE-C2f (Split-Context Enhancement with C2f) module is introduced to optimize the expressiveness of feature fusion. Furthermore, EMA (Exponential Moving Average) is added after multi-scale feature fusion to improve detection stability and accuracy by smoothing feature map gradient updates. In the head, the detection head adopts an improved Detect_Inner structure and uses the Inner-DIoU loss function instead of the original CIoU loss function, improving the accuracy of bounding box regression and classification tasks. Finally, a 160×160 small object detection head is added to enhance the model's detection capabilities for small objects and subtle features.

[0067] As shown in Figure 3(a), the SRSE-YOLO model includes a backbone network, a feature fusion layer and a detection head, wherein the backbone network includes the first SCConv_BS module, the first Conv_BS module, the first C2f layer, the second SCConv_BS module, the second C2f layer, the third SCConv_BS module, the third C2f layer, the second Conv_BS module, the fourth C2f layer and the RL_SPPF module connected in sequence, and the feature fusion layer includes the first upsampling layer (i.e., Upsample), the first splicing layer (i.e., Concat), the first SCE-C2f module, the second upsampling layer, the second splicing layer, the second SCE-C2f module, the third upsampling layer, the third splicing layer, the third SCE-C2f module, the first EMA module, the third Conv_BS module, the fourth splicing layer, the fourth SCE-C2f module, the second EMA module, the fourth Conv_BS module, the first Five splicing layers, the fifth SCE-C2f module, the third EMA module, the fifth Conv_BS module, the sixth splicing layer, the sixth SCE-C2f module and the fourth EMA module, the detection head includes the first Detect_Inner, the second Detect_Inner, the third Detect_Inner and the fourth Detect_Inner, the first C2f layer is also connected to the third splicing layer, the second C2f layer is also connected to the second splicing layer, the third C2f layer is also connected to the first splicing layer, the first SCE-C2f module is also connected to the fifth splicing layer, the second SCE-C2f module is also connected to the fourth splicing layer, the first EMA module is also connected to the first Detect_Inner, the second ENA module is also connected to the second Detect_Inner, the third EMA module is also connected to the third Detect_Inner, and the fourth EMA module is also connected to the fourth Detect_Inner.

[0068] As shown in Figure 3(b), the first Conv_BS module, the second Conv_BS module, the third Conv_BS module, the fourth Conv_BS module and the fifth Conv_BS module all include a first convolutional layer (i.e., Conv), a two-dimensional batch normalization layer (i.e., BatchNorm2d) and a first SiLU activation function layer (i.e., SiLU) connected in sequence. As shown in Figure 3(c), the first SCConv_BS module, the second SCConv_BS module and the third SCConv_BS module all include a first SCConv module, a two-dimensional batch normalization layer and a second SiLU activation function layer connected in sequence.

[0069] For the Backbone part, some traditional convolution modules are replaced with SCConv modules (spatial and channel reconstruction convolution modules). The SCConv module reconstructs the convolution module by compressing spatial and channel redundancy, improving the model's expressiveness and computational efficiency during feature extraction. By jointly optimizing the spatial and channel dimensions, the SCConv module can effectively enhance the diversity and hierarchy of feature representation while reducing the amount of computation and the number of parameters. In addition, this improvement not only enhances the model's feature extraction capabilities, but also effectively suppresses interference from background noise and irrelevant features, thereby further improving real-time performance and efficiency while maintaining high performance.

[0070] The SCConv module is mainly composed of two modules: the spatial reconstruction unit (SRU) and the channel reconstruction unit (CRU). The specific structure of the SCConv module is as follows Figure 4 As shown in Figure 2, the SRU suppresses spatial redundancy and enhances feature expression through separation and reconstruction operations. It splits the input into multiple parts, processes each part independently, and then reconstructs it to produce a refined output. The CRU, on the other hand, uses a split-transform-fusion strategy to reduce channel redundancy. This approach optimizes computational cost and storage requirements.

[0071] In SRU, the input feature map X is first normalized by group normalization GN, which is standardized by the following formula:

[0072]

[0073] Among them, μ and σ are the mean and standard deviation of the feature map, ∈ is a small positive value to ensure the stability of the value, and γ and β are trainable parameters. out By normalizing the relevant weight W γ Evaluate the importance of different feature maps:

[0074]

[0075] These weights are mapped to the range (0, 1) and processed by the Sigmoid function and threshold gating to generate information-rich weights W1 and W2. The entire process of obtaining W can be expressed as:

[0076] W=Gate(Sigmoid(W γ (GN(X)))) (3)

[0077] Finally, the original feature map X is divided into two parts and Through the cross reconstruction operation, we further combine and finally generate the spatially refined feature map X w , specifically:

[0078]

[0079] In CRU, the feature map X after spatial refinement w It is divided into two parts according to the ratio α, and 1×1 convolution is used to reduce the number of channels. up After grouped convolution (GWC) and pointwise convolution (PWC), high-level representative information Y1 is extracted. low Then, a feature map Y2 with shallow hidden details is generated by 1×1 PWC, and X is reused. low Generate more feature maps. Finally, use the simplified SKNet (selective kernel networks, SKNet) method to adaptively fuse Y1 and Y2 to obtain the final channel refined feature map Y. The specific process is as follows:

[0080]

[0081] Y=β1Y1+β2Y2 (7)

[0082] In this embodiment, the spatial pyramid pooling fusion (SPPF) module in YOLOv8 is innovatively improved for the fabric defect detection task, and the improved module is named RL-SPPF module. Figure 5As shown, the RL_SPPF module includes a first Conv_BR module, a first maximum pooling layer (i.e., MaxPool2d), a second maximum pooling layer, a third maximum pooling layer, a seventh splicing layer (i.e., Concat), an LSKA module, and a second Conv_BR module connected in sequence, wherein the outputs of the first Conv_BR module, the first maximum pooling layer, and the second maximum pooling layer are all connected to the seventh splicing layer, and the first Conv_BR module and the second Conv_BR module both include a two-dimensional convolutional layer (i.e., Conv2d), a two-dimensional batch normalization layer (i.e., BatchNorm2d), and a first ReLU activation function connected in sequence. Layer (ReLU), the LSKA module includes the first standard depth convolution, the second standard depth convolution, the first expansion depth convolution, the second expansion depth convolution and the 1*1 convolution layer connected in sequence, and the input of the first standard depth convolution is performed with the output of the 1*1 convolution layer. Hadamard product operation, wherein the expansion parameter of the first standard depth convolution is d, the convolution kernel size is 1*(2d-1), the expansion parameter of the second standard depth convolution is d, the convolution kernel size is (2d-1)*1, the intrinsic parameter of the first expansion depth convolution is k, the convolution kernel size is 1*(k / d), the intrinsic parameter of the second expansion depth convolution is k, and the convolution kernel size is (k / d)*1.

[0083] During the improvement process, the original SiLU activation function in the convolutional block was replaced with the ReLU activation function. The characteristic of the ReLU activation function is that it maintains the original value when the input is positive and outputs zero when the input is negative. This nonlinear mapping method not only simplifies the model structure but also ensures that the network gradient will not saturate during training, thereby enabling faster convergence. In addition, the simple calculation form of the ReLU activation function improves computational efficiency, thereby increasing the overall operation speed of the algorithm, which is particularly important for fabric defect detection applications with high real-time requirements.

[0084] To further enhance the model's ability to capture subtle features and complex spatial relationships in fabric images, the Large Separable Kernel Attention (LSKA) mechanism was introduced into the RL-SPPF module. The LSKA module effectively aggregates multi-scale information by employing depthwise separable convolutional kernels of varying sizes, enhancing the model's sensitivity to defects of varying sizes and shapes. This combined strategy aims to improve the model's detection accuracy and robustness, particularly in identifying subtle fabric defects. This results in the model demonstrating stronger feature representation and higher detection performance in fabric defect detection tasks.

[0085] The core of the LSKA module lies in its unique structural design, which combines depthwise separable convolution and spatially dilated attention mechanisms to enhance the model's ability to capture multi-scale features. The input feature map undergoes a standard depthwise convolution (DW_Conv) with a dilation parameter d and kernel sizes of and, a dilated depthwise convolution (DW_D_Conv) with a kernel parameter k and kernel sizes of and, and a 1×1 convolution layer. It can decompose the two-dimensional (2D) depthwise convolution kernel and the depthwise dilated convolution kernel into one-dimensional (1D) horizontal (horizontal) and vertical (vertical) convolution kernels. These decomposed convolution kernels are executed in series in a predetermined order, ensuring effective information transmission and fusion. The output of the LSKA module is as follows:

[0086]

[0087] A C =W 1×1 *Z C (10)

[0088]

[0089] Among them, H, W, C are feature map sizes; is the output of the standard depth convolution; Z C is the output of the expanded depthwise convolution; F C is the input feature map; A C is the attention map; Output feature map for LSKA; [·] indicates rounding down operation; *, Represent the convolution operation and Hadamard product respectively.

[0090] In order to improve the performance of the YOLOv8 network in the fabric defect detection task, an improved SCE-C2f module is proposed in this embodiment to enhance the network's perception of edge features and subtle defects. The specific structure is shown in Figure 6(a). The first SCE-C2f module and the second SCE-C2f module both include a second convolutional layer (i.e., Conv), a Split layer, n SCE_Bottleneck modules, an eighth splicing layer (i.e., Concat) and a third convolutional layer (i.e., Conv) connected in sequence. The Split layer and the SCE_Bottleneck module are both connected to the eighth splicing layer, and the output of the Split layer is connected to the eighth splicing layer. The SCE-C2f module structurally inherits the design idea of the C2f module in YOLOv8, and introduces a new bottleneck structure: SCE_Bottleneck. Through edge detection and feature weighted fusion, it effectively makes up for the shortcomings of traditional modules in processing small textures and edge features. The specific structure of SCE_Bottleneck is shown in Figure 6(b). The SCE_Bottleneck module includes a second SCConv module, a weighted fusion module (i.e., Weighted integration), and a fourth convolutional layer (i.e., Conv) connected in sequence. The input of the second SCConv module is also connected to the EdgeNet module, and the output of the EdgeNet module is connected to the weighted fusion module. The input of the second SCConv module is added to the output of the fourth convolutional layer.

[0091] The input feature map of the SCE-C2f module first passes through a convolution module for channel compression. The Split operation then divides the feature map into two parts. One part is directly concatenated, while the other serves as the input to the SCE_Bottleneck module. In SCE_Bottleneck, the feature map is passed through the EdgeNet module for edge detection, extracting significant edge response information. Simultaneously, another branch processes the feature map using SCConv and performs a weighted fusion of the two, resulting in a fusion result that includes both edge information and deep features. The fused feature map is further integrated through a convolution module to enhance feature expression. This structural design enables the network to more sensitively capture subtle defect edges and texture changes on the fabric surface.

[0092] The EdgeNet module is a lightweight learning-based edge detection module consisting of feature extraction and edge mapping output. Figure 6(c) shows the detailed structure of the EdgeNet module, which consists of a fifth convolutional layer, a second ReLU activation function layer, a sixth convolutional layer, and a Sigmoid layer. The purpose of adding the EdgeNet branch network is to automatically learn edge features through a shallow convolutional neural network, leveraging this learning capability to improve the quality of edge features and enhance the model's ability to capture fabric defect edges.

[0093] For the Weighted integration module, the outputs of the two are fused through adaptively learned weights to improve the feature representation capability. First, input the feature map X∈R H×W×C After being processed by SCConv and edge detection network EdgeNet respectively, two feature maps F SCConv and F EdgeNet ,in:

[0094] F SCConv =SCConv(X) (12)

[0095] F EdgeNet =EdgeNet(X) (13)

[0096] By setting a learnable weight parameter α (range [0,1]) to perform weighted fusion of the two, the output feature F is obtained after fusion fuse Expressed as:

[0097] F fuse =α·F SCConv +(1-α)·F EdgeNet (14)

[0098] Among them, α is obtained through adaptive learning of a 1×1 convolution kernel and Sigmoid activation function, and the value of α is constrained to [0,1], specifically:

[0099] α=sigmoid(Conv 1×1 (X)) (15)

[0100] Finally, the fused feature F fuse It is used for subsequent feature extraction and information representation. This weighted fusion mechanism enables the network to adaptively adjust the contribution ratio of SCConv and EdgeNet edge features according to the characteristics of different input images, thereby improving the synergy between edge detection and semantic extraction.

[0101] The Efficient Multi-scale Attention (EMA) attention mechanism can significantly improve the model's feature expression capabilities and detection accuracy. By introducing the EMA module at the key level of the Neck part and dynamically adjusting the feature weights of different spatial scales and channels, it can more accurately capture small and complex defect areas in the fabric. Its introduction enables the model to effectively extract the local detail features of the defects, while integrating global context information to optimize the model's detection performance for multi-scale targets. Compared with traditional attention mechanisms, the EMA module achieves higher detection efficiency at a lower computational cost, showing significant advantages for tasks such as fabric defect detection that are sensitive to details and require real-time response.

[0102] like Figure 7 As shown, the EMA module includes a Groups module, the output end of the Groups module is connected to the X_Avgpool module, the Y_Avgpool module, the conv(3*3) layer and the Re_weight module, the output ends of the X_Avgpool module and the Y_Avgpool module are connected to the Concat+conv(1*1) module, the output end of the Concat+conv(1*1) module is connected to two first Sigmoid modules, the output ends of the first Sigmoid modules are connected to the Re-weight module, the output end of the Re-weight module is connected to the GroupNorm module, and the output end of the GroupNorm module is connected to the first AvgPool module And the first Matmul module, the output end of the first AvgPool module is connected to the first Softmax module, the output end of the first Softmax module is connected to the second Matmul module, the output end of the conv(3*3) layer is connected to the second Matmul module, the output end of the conv(3*3) layer is also connected to the second AvgPool module, the output end of the second AvgPool module is connected to the second Softmax module, the output end of the second Softmax module is connected to the first Matmul module, the first Matmul module and the second Matmul module perform addition operation and then connect to the second Sigmoid module, and the output end of the second Sigmoid module is connected to the Re-weight module.

[0103] The core principle of the EMA module is to combine the interactive attention mechanism of space and channel to enhance the selectivity and representation ability of features. First, the input feature map is processed at multiple scales through channel grouping. Subsequently, the module extracts spatial structural information through horizontal and vertical average pooling (X_Avg Pool and Y_Avg Pool), and generates attention weights through 1×1 convolution. In addition, the cross-space learning mechanism introduces normalization and soft attention processes in the feature map, and realizes information interaction between channels through global pooling and matrix multiplication. After these generated attention weights are activated by the Sigmoid function, they are element-wise reweighted with the original features to finally obtain the enhanced output feature map. This design makes full use of the complementarity of spatial and channel attention, enabling the model to have stronger feature expression capabilities in complex backgrounds, thereby improving the performance of defect detection.

[0104] To enhance the model's ability to detect small defects, a customized 160×160 small target detection head was introduced into the existing model framework. This 160×160 small target detection head is specifically optimized for smaller defects, enabling the model to better adapt to fine structural features commonly found on fabrics, such as subtle fiber defects or closely spaced pattern elements. This helps the model learn more detailed feature representations, thereby improving fabric defect recognition. This design not only improves the detection accuracy for defects that fall within this size range, reducing false positives and missed detections, but also enhances the model's ability to learn diverse features, improving its generalization performance. Within the model architecture, the 160×160 small target detection head collaborates with three other detection heads responsible for capturing defects of different sizes, forming a multi-scale detection mechanism for comprehensive and detailed defect detection. Each detection head focuses on targets within a specific size range, and the heads complement each other to ensure that defects of all possible sizes are accurately identified and classified. The multi-scale detection heads share the feature maps extracted by the backbone network, which not only ensures the effective transmission of information but also avoids the redundant use of computing resources.

[0105] YOLOv8 uses the CIoU (Complete Intersection-over-Union) border loss function to calculate the IoU loss, realize gradient propagation, and accelerate model convergence. However, the traditional CIoU loss function may not be able to fully adapt to the specific challenges in the fabric defect detection task, such as small targets, dense distribution, and irregular shapes. Although the CIoU loss function takes into account the position and scale similarity of the bounding box, its fixed form is difficult to adjust according to different detection tasks, resulting in insufficient generalization ability, especially when processing low IoU samples. The regression effect is not ideal. In order to solve the above problems, the Inner-DIoU loss function is introduced in this embodiment to improve the YOLOv8 model. The Inner-DIoU loss function introduces auxiliary bounding boxes and calculates the loss with different scaling factor ratios, thereby accelerating the bounding box regression process. Specifically, using smaller auxiliary bounding boxes for high IoU samples can speed up convergence; while for low IoU samples, larger auxiliary bounding boxes are used. The calculation method and related parameters of the Inner-DIoU loss function at different scales are as follows: Figure 8 As shown in the figure. By improving the loss function, the model can achieve a better balance between samples of different difficulty levels, reduce false positives and missed detections, effectively solve the regression problem of low IoU samples, and make model training more stable. The model detection head structure constructed using the Inner-DIoU loss function is shown in the figure. Figure 9 shown.

[0106] The specific calculation process of Inner-DIoU is: first calculate the left boundary x value of the real auxiliary box Right boundary x value Upper boundary y value and the lower boundary y value

[0107]

[0108] Secondly, calculate the left boundary x value b of the predicted auxiliary box l , right boundary x value b r , upper boundary y value b t and the lower boundary y value b b :

[0109]

[0110] Then calculate the union inter and intersection union of the real auxiliary box and the predicted auxiliary box:

[0111]

[0112] union=(w gt *h gt )*(ratio) 2 +(w*h)*(ratio) 2 -inter (21)

[0113] Finally, calculate the ratio IoU between the two inner , through the Euclidean distance ρ between the two bounding boxes 2 (b,b gt ) Calculate the penalty term L DIoU , the final loss value L is obtained by the IoU method inner-DIoU :

[0114]

[0115] L Inner-IoU =1-IoU inner (twenty three)

[0116]

[0117] L inner-DIoU =L DIoU +IoU-IOU inner (25)

[0118] S300, using the data set to train the SRSE-YOLO model to obtain a defect detection model;

[0119] Specifically, the labeled dataset is divided into training set, validation set and test set according to the ratio of 8:0.8:1.2 and input into the SRSE-YOLO model to complete the training and testing of the model, thereby obtaining a defect detection model capable of detecting defects in fiber fabrics.

[0120] S400: Detect fiber fabric defects using a defect detection model.

[0121] In this embodiment, an improved spatial pyramid pooling fusion module RL-SPPF combined with the LSKA (Local Spatial Kernel Aggregation) mechanism is proposed to achieve effective fusion of multi-scale features of the model and improve the detection performance of small or irregularly shaped defects. A new SCE-C2f (Spatial Channel Enhancement-Cross Stage) module is proposed to further promote cross-stage feature interaction and enhance long-distance information transmission, effectively improving the overall detection performance of the model. By embedding the EMA (Exponential Moving Average) attention mechanism in the Neck part, the model can dynamically adjust the importance of each channel during the inference process and better adapt to the characteristics of different types of defects. By adding a small target detection branch with a resolution of 160×160 to the detection head and improving the loss function to introduce Inner-DIoU, the recognition rate of tiny defects and the accuracy of the detection frame are greatly improved.

[0122] To validate the effectiveness of the proposed model, experiments were conducted using two publicly available datasets: the Alibaba Cloud Tianchi Fabric Defect Dataset and the TILDA Fabric Defect Dataset. The Alibaba Cloud Tianchi Fabric Defect Dataset was collected by the Alibaba team in-depth in-depth textile production workshops. It covers a wide range of fabric types and contains the vast majority of defect samples in the textile industry, such as warp hangs, spandex breakage, and knots, demonstrating its high diversity and complexity. Furthermore, because the data collection process takes into account the influence of varying lighting conditions and shooting angles, the Alibaba Cloud Tianchi dataset provides challenges closer to real-world applications, helping to improve the robustness and generalization of the model. In contrast, the TILDA Fabric Defect Dataset was created by a research team at University College Dublin in Ireland in a laboratory setting. It focuses on frequently occurring defect types in the textile industry, such as holes and oil stains. The high-quality images in this dataset provide a valuable resource for evaluating the model's detection performance for specific defect types, helping to improve the model's detection accuracy for these critical defects. Combining these two datasets allows for a comprehensive evaluation of the model's real-world performance and ensures its effectiveness and robustness under a wide range of conditions.

[0123] Visual analysis of two datasets, Alibaba Cloud Tianchi and TILDA, yields the results shown in Figures 10(a) and 10(b). These results reveal significant differences and concentration trends in the distribution of fabric defects. Defects exhibit a distinct characteristic of large aspect ratios. The distribution of scattered points in Figures 10(a) and 10(b) shows a high density along the coordinate axes, and the defect shapes tend to be elongated. Furthermore, the scattered points are highly concentrated near the origin, reflecting the preponderance of small defects, resulting in a high-density distribution pattern.

[0124] The experimental environment is configured with 13th generation hardware. Core TM The i9-13900KF processor, NVIDIA GeForce RTX 4090 graphics card (with 24GB of video memory), and 64GB of system memory ensure powerful computing power and efficient processing speed. The software environment is based on the Windows 10 Professional operating system, using PyCharm 2023.2.3 as the development platform. To support deep learning tasks, this experiment uses PyTorch 2.3.13 as the main framework, CUDA 11.8 to accelerate the training process, and Python 3.8 as the programming language environment. This configuration is designed to provide an efficient and stable experimental platform to support model training and evaluation.

[0125] In terms of experimental parameters, the input image size is 640×640, the optimizer uses the SGD stochastic gradient descent optimizer with a momentum coefficient value of 0.937, the number of iterations epoch is set to 200, the batch size batch is set to 16, the initial learning rate lr is set to 0.01, the weight decay coefficient is 0.0005, and Mosaic image enhancement is turned off after 10 rounds of training.

[0126] To evaluate the model's performance in fabric defect detection, we used a variety of standard evaluation metrics to comprehensively measure the model's accuracy and reliability. These metrics include not only traditional classification accuracy metrics but also evaluation criteria specific to object detection. The following are the evaluation metrics used in this application:

[0127] Precision measures the proportion of samples that are actually positive among all samples predicted by the model to be positive (defective). The calculation formula is:

[0128]

[0129] Recall measures the proportion of samples that are actually positive (defective) and are correctly detected by the model. The calculation formula is:

[0130]

[0131] The mean average precision (mAP) comprehensively considers the accuracy and completeness of the detection results and is obtained by averaging the precision under different confidence thresholds. The experiment selects the mean average precision mAP@0.5:0.95 with an IoU threshold of 0.5 to 0.95 (with a step size of 0.05) and the mean average precision mAP@0.5 with an IoU threshold of 0.5 as the key evaluation indicators of the experiment. Its calculation formula is:

[0132]

[0133] In addition, to further evaluate the real-time performance and computational complexity of the model, we use parameters (params), computational complexity (Giga Floating Point Operations Per Second, GFLOPS), and frames per second (FPS) to comprehensively measure the model's inference speed and computational performance. The formula for calculating FPS is:

[0134]

[0135] Among them, TP means positive prediction of positive class, FP means negative prediction of positive class, FN means positive prediction of negative class, N is the total number of categories, AP i represents the average precision of the i-th category, N sample is the total number of test samples, T sample is the total time for testing samples.

[0136] To verify the effectiveness of introducing EMA into the model, a comparative experiment explored the YOLOv8 model as a baseline to evaluate the impact of combining different attention mechanisms on the fabric defect detection task. Five different attention mechanisms were used in the experiment: SE (Squeeze-and-Excitation), SimAM (Simultaneous Attention Module), CA (Channel Attention), CBAM (Convolutional Block Attention Module), and EMA (Enhanced Multi-scale Attention, EMA).

[0137] Experimental results for several different attention mechanisms are shown in Table 1. These results demonstrate that the EMA attention mechanism exhibits unique advantages in fabric defect detection, particularly in terms of two key performance metrics: precision and mAP@0.5. In terms of precision, EMA achieves a P-value of 87.1%, a 1.7% improvement over the baseline model, achieving the best performance among all models with an attention mechanism. In terms of mAP@0.5, EMA achieves a value of 87.3%, a 1.3% improvement over the baseline model, also the best performance among all attention mechanisms. Although EMA's R-value (88.0%) is second only to CBAM (88.2%) in terms of recall, it still achieves a 0.3% improvement over the baseline model's 87.7%. While EMA requires slightly more parameters (params) and computational overhead (GFLOPs) than other attention mechanisms, it achieves significant improvements in detection accuracy and mAP@0.5, demonstrating that EMA strikes a good balance between efficiency and effectiveness. EMA can enhance the model's attention to multi-scale information in the feature graph, reduce false detections and missed detections, thereby improving the overall detection performance and making it more suitable for fabric defect detection tasks.

[0138] Table 1: Comparison of different attention mechanisms

[0139] Model P / % R / % mAP@0.5 / % <![CDATA[Params / 10 6 ]]> GFLOPs / G Baseline 85.6 87.7 86.2 3.00 8.1 +SE 86.5 88.4 85.9 3.01 8.1 +SimAM 86.3 87.7 86.8 3.02 8.2 +CA 85.9 88.5 86.5 3.03 8.2 +CBAM 86.9 88.2 87.0 3.02 8.3 +EMA 87.1 88.0 87.3 3.02 8.2

[0140] To verify the effectiveness of Inner-DIoU in fabric defect detection, the performance of various loss functions in fabric defect detection under the YOL0v8 framework was evaluated. Six different loss functions were used in the experiment: CIoU, GIoU, Wise-IoU, Focaler-IoU, Inner-IoU, and Inner-DIoU.

[0141] As shown in Figure 11(a), the iterative graphs of different loss functions show that Inner-DIoU exhibits the fastest rate of decline in the early stages of training, demonstrating its superior optimization capabilities in the early stages. Wise-IoU and Inner-IoU converge only slowly in the early stages. CIoU, GIoU, and Focaler-IoU converge relatively slowly in the early stages. As the number of iterations increases, Inner-DIoU reaches the critical point of convergence first and exhibits a relatively stable convergence trend. Figure 11(b) shows that Inner-DIoU achieves the lowest loss value in the final stages of training, indicating that the difference between its predicted results and the true values at the end of training is minimal. Table 2 shows the performance metrics of different loss functions on the fabric defect detection task. Inner-DIoU differs only 0.2% from the best-performing Wise-IoU in terms of P (precision) and significantly outperforms other loss functions in terms of R (recall), mAP@0.5, and mAP@0.5:0.95.

[0142] Table 2: Comparison of different loss functions

[0143]

[0144] Comprehensive experimental results demonstrate that choosing Inner-DIoU as a loss function achieves high precision and recall, enabling more accurate identification of fabric defects while reducing false positives. Furthermore, using Inner-DIoU enables the model to achieve the lowest loss value after training and demonstrates superior overall performance across all evaluation metrics, making it more suitable for fabric defect detection.

[0145] By comparing the performance of the original C2f, SC-C2f, and SCE-C2f modules, we further explored the impact of different C2f module improvements on model performance. The SC-C2f module indeed reduces the number of model parameters and computational complexity, thanks to the efficiency gains achieved by replacing the original convolutional layers with SConv. However, while reducing resource consumption, the SC-C2f module also sacrifices some detection performance. As shown in Table 3, its performance falls short of the original C2f module in key metrics such as precision (P), recall (R), and mean average precision (mAP). In contrast, the proposed SCE-C2f module introduces an edge detection mechanism based on the SC-C2f module. While this modification results in a slight increase in the number of parameters and computational complexity, it significantly improves detection performance. Experimental data shows that the SCE-C2f module not only outperforms the SC-C2f module in all evaluation metrics, but also achieves particularly significant performance gains, particularly in mAP@0.5 and mAP@0.5:0.95, comprehensive metrics reflecting overall model performance. A heat map visualization analysis was performed on several C2f modules, and the results are shown in Figure 11(a) and Figure 11(b). It can be seen that adding the edge detection module helps the model to more accurately locate and identify defects in the fabric, which can effectively improve the model's ability to perceive defects, thereby enhancing the model's robustness and accuracy.

[0146] Table 3: C2f module comparison

[0147]

[0148] While the SC-C2f module achieves model lightweighting, it also results in a decrease in detection performance. The SCE-C2f module, however, effectively compensates for this shortcoming by modestly increasing computing resources, further improving the model's detection capabilities. Therefore, the SCE-C2f module demonstrates superior applicability for fabric defect detection scenarios.

[0149] To validate the effectiveness of our improved algorithm, we conducted comprehensive comparative experiments against a variety of mainstream fabric defect detection algorithms, including baseline models YOLOv8, FasterR-CNN, YOLOv7-Tiny, YOLOv9t, YOL0v10s, and YOLO-DD, as well as the proposed model. The experimental results are shown in Table 4. First, in terms of precision (P) and recall (R), our model achieved 90.3% and 91.2%, respectively, representing improvements of 5.5% and 4.0%, respectively, compared to the baseline YOLOv8 model. This demonstrates that our model not only accurately identifies fabric defects but also effectively captures the majority of actual defects. Second, in terms of mAP@0.5% and mAP@0.5∶0.95%, we achieved 89.4% and 59.7%, respectively, significantly exceeding those of other models. This further demonstrates our model's robustness in handling complex fabric defect detection tasks.

[0150] From the perspective of efficiency and resource consumption, our model demonstrates excellent operational efficiency while maintaining high accuracy. In terms of the number of parameters (Params), our model's index is lower than YOLOv8's 3.00 and YOLO-DD's 7.91, which helps reduce the model's storage requirements and improve deployment flexibility. In terms of computational complexity (GFLOPs / G), our model achieves 8.0GFLOPs, significantly lower than other models, which helps reduce computing resource consumption. In addition, our model's frame rate (FPS) performance is second only to YOLOv10s, reaching 122, which shows that the model can achieve efficient detection speed while maintaining high accuracy, fully demonstrating the advancement and practicality of our model in the field of fabric defect detection.

[0151] Table 4: Comparison of mainstream fabric defect detection algorithms

[0152] Model P / % R / % mAP@0.5 / % mAP@0.5: 0.95 / % <![CDATA[Params / 10 6 ]]> GFLOPs / G FPS YOLOv8 85.6 87.7 86.2 47.5 3.00 8.1 116 Faster R-CNN 81.6 82.9 79.8 40.5 135.69 41.2 20 YOLOv7-Tiny 83.5 89.1 84.3 43.6 6.01 13.1 106 YOLOv9t 84.9 87.8 85.7 44.1 2.73 12.6 98 YOLOv10s 85.7 84.6 85.6 44.9 8.12 24.3 143 YOLO-DD 91.1 89.2 88.9 55.1 7.91 16.5 112 Ours 90.3 91.2 89.4 59.7 2.97 8.0 122

[0153] The detection results of several model methods are visualized and analyzed to further demonstrate the effectiveness of the proposed model. The detection results are shown in Figures 12(a), 12(b), 12(c), 12(d), 12(e), and 12(f). Although these models each have unique advantages, they still lag behind the proposed model in terms of detection accuracy. Existing models are prone to varying degrees of missed detection and false detection when faced with complex fabric textures. This is primarily due to their lack of sensitivity to small or hidden defects and their limited ability to filter background noise. In contrast, the proposed model significantly improves the accuracy of localizing fabric defect areas by introducing innovative algorithmic improvements and optimization strategies. This enables the model to not only more accurately capture defect features but also effectively reduce the false alarm rate, achieving significant improvements in detection accuracy.

[0154] To evaluate the contribution of each improved module to the fabric defect detection method, detailed ablation experiments were conducted. The effectiveness of the SCConv, SPPL-RL, SCE-C2f, EMA, and Detection Head modules was tested. The specific experimental results are shown in Table 5. Introducing the SCConv and SPPL-RL modules to the baseline model (Group 2) improved the model's precision and recall to 86.3% and 88.1%, respectively. The SPPL-RL module demonstrated significant improvement in optimizing multi-scale feature representation. Incorporating the SCE-C2f module (Group 3) further improved the model across all metrics, particularly achieving 88.2% mAP@0.5. In Group 5, the introduction of the EMA and improved Detection Head modules resulted in optimal performance. Furthermore, the gradual improvement of the modules reduced the number of parameters and computational complexity, improving the model's practical performance. This significant improvement in fabric defect detection performance demonstrates the effectiveness and rationality of each module.

[0155] Table 5: Comparison of ablation experiment results

[0156]

[0157] In this application, an in-depth analysis of different types of improved modules was conducted to compare the detection performance of conventional improved modules with defect-specific improved models. The experimental results are shown in Table 6. The experimental results show that the conventional improved module (SCConv+EMA+Inner_DIoU) significantly improves the detection of detailed defects (such as Thick Pick and Oil Stain) and small defects (such as Neps and Warp Knot), with mAP@0.5 reaching 88.7% and 89.0%, respectively, which are 2.5% and 2.8% higher than the baseline model. However, this improved approach has limited optimization for defects with texture variations (such as Tight End and Weft Kink) and defects with complex edge features (such as Foreign Fibers and Broken Spandex), with mAP@0.5 only increasing to 86.5% and 85.8%. Further analysis shows that the local non-uniformity of texture variations and the multi-scale structural differences of complex edge defects lead to the insufficient feature expression capability of the general improved model. To this end, the team introduced the RL-SPPF feature capture enhancement module, the SCE-C2f edge feature discrimination module, and a 160x160 detection head targeted enhancement model to optimize the feature fusion and classification decision mechanisms. After these improvements, the mAP@0.5 for texture-varying and edge-complex defects increased to 89.3% and 89.1%, respectively, representing increases of 2.8% and 3.3% compared to the conventional enhancement model. Precision and recall were also significantly improved. Experiments further verified that RL-SPPF effectively captures regions of texture abrupt changes (such as local distortions in slack ends) through its large separable kernel attention, while the 160x160 detection head further captures finer defect features. Furthermore, the SCE-C2f edge detection network and weighted fusion mechanism enhance the discrimination of ambiguous edge features (such as fracture contours in broken spans). These results demonstrate that the design of the improved modules fully meets the specific requirements of texture and edge defects, achieving a technological leap from general optimization to targeted enhancement.

[0158] Table 6: Experimental results of conventional improvement and defect-targeted improvement models

[0159]

[0160] To further validate the effectiveness and generalization ability of the proposed model, generalization experiments were conducted using the TILDA dataset. The experimental results are shown in Table 7. In this experiment, the proposed model (Ours) was compared with the original YOLOv8 model. Specifically, compared with the baseline YOLOv8 model, our model improved precision (P) by 3.9% and recall (R) by 2.8%, demonstrating that our model is more accurate and comprehensive in identifying fabric defects. At mAP@0.5%, our model achieved 91.2%, a 2.2% improvement over YOLOv8's 89.2%. Under the more stringent mAP@0.5:0.95% evaluation criterion, our model increased from 54.9% to 61.2%, an 11.3% improvement. This significant improvement further demonstrates the superior generalization performance of our model at different thresholds. Furthermore, our model offers advantages in parameter count and processing speed, enabling faster completion of fabric defect detection tasks. Figures 13(a) and 13(b) show the detection results of the baseline model and the proposed SRSE-YOLO model. Compared to the baseline model, the SRSE-YOLO model more accurately locates model defects and is more sensitive to fabric defect characteristics, effectively improving the classification accuracy and detection rate of fabric defects. Generalization experimental results fully demonstrate the effectiveness of the proposed model in fabric defect detection tasks, further validating the model's generalization capabilities and practical application value.

[0161] Table 7: Generalization Experiment Results

[0162] Model P / % R / % mAP@0.5% mAP@0.5: 0.95% <![CDATA[Params / 10 6 ]]> GFLOPs / G FPS YOLOv8 90.3 92.1 89.2 54.9 3.02 8.1 124 Ours 93.8 94.7 91.2 61.2 2.94 8.0 127

[0163] In this application, in response to the challenges in the field of fabric defect detection, such as low detection accuracy and missed detection caused by complex backgrounds, rich textures, and small defect sizes, this application proposes a model SRSE-YOLO for fabric defect detection based on YOLOv8. By replacing the convolution module of the Backbone part with the SCConv_BS module, the feature extraction capability of the model is improved; the RL-SPPF module is proposed to make innovative improvements to the spatial pyramid module to promote faster convergence of the model network; the SCE-C2f module is used to improve some C2f modules in Neck to enhance the network's ability to extract edge features of fabric defects; the EMA attention mechanism is added before the detection head to improve the detection accuracy of the model and better capture complex defect areas. Finally, a 160*160 detection head is added to the model and the loss function is improved to further enhance the model's detection performance for small target defects. The model proposed in this application was verified on the Alibaba Cloud Tianchi dataset and the TILDA dataset. The experimental results show that compared with the baseline model YOLOv8, SRSE-YOLO’s mAP@0.5 on the two datasets increased by 3.71% and 2.24% respectively, while mAP@0.5∶0.95 increased by 25.68% and 11.48% respectively. At the same time, the precision and recall rates also improved to varying degrees. In addition, while maintaining high accuracy, the model of this application also has obvious advantages in computational efficiency and real-time performance, which makes it more suitable for deployment in practical application scenarios. The model SRSE-YOLO proposed in this application provides an efficient and accurate solution for fabric defect detection, which helps to improve the level of automation and product quality control in the textile industry.

[0164] Example 2

[0165] like Figure 14 As shown, a fiber fabric defect detection device involved in Example 2 of the present application includes:

[0166] A data set construction module 100 is used to obtain and annotate pictures containing fiber fabrics and then construct a data set;

[0167] The model construction module 200 is used to construct the SRSE-YOLO model, specifically comprising the following steps: based on the YOLOv8 model, introducing the SCConv_BS module to replace some convolution modules, adopting the RL-SPPF module in the spatial pyramid pooling fusion module, introducing the SCE-C2f module in the Neck module, adding EMA after the multi-scale feature fusion module to smooth the update of the feature map gradient, adopting the Detect_Inner structure in the detection head, adopting the Inner-DIoU loss function instead of the CIoU loss function, and adding a 160×160 scale small object detection head to form a multi-scale detection head;

[0168] A training module 300 is used to train the SRSE-YOLO model using the data set to obtain a defect detection model;

[0169] The detection module 400 is used to perform fiber fabric defect detection using a defect detection model.

[0170] It should be noted that, for other specific implementations of the fiber fabric defect detection device in this embodiment, reference can be made to the specific implementations of the fiber fabric defect detection method described above, and will not be described again here to avoid redundancy.

[0171] The above are only preferred specific implementations of this application; however, the scope of protection of this application is not limited thereto. Any person skilled in the art who, within the technical scope disclosed in this application, makes equivalent substitutions or modifications based on the technical solutions and improved concepts of this application shall be covered by the scope of protection of this application.

Claims

1. A method for detecting defects in fiber fabrics, characterized in that: include: Obtain annotated images of fabrics and construct a dataset; The SRSE-YOLO model is constructed, which includes the following steps: based on the YOLOv8 model, the SCConv_BS module is introduced to replace some convolution modules, the RL-SPPF module is used in the spatial pyramid pooling fusion module, the SCE-C2f module is introduced in the Neck module, EMA is added after the multi-scale feature fusion module to smooth the update of feature map gradients, the Detect_Inner structure is adopted in the detection head, the Inner-DIoU loss function is used instead of the CIoU loss function, and a 160×160 small object detection head is added to form a multi-scale detection head; Using the data set to train the SRSE-YOLO model to obtain a defect detection model; The defect detection model is used to detect fiber fabric defects.

2. The fiber fabric defect detection method according to claim 1, characterized in that: The SRSE-YOLO model includes a backbone network, a feature fusion layer and a detection head, wherein the backbone network includes a first SCConv_BS module, a first Conv_BS module, a first C2f layer, a second SCConv_BS module, a second C2f layer, a third SCConv_BS module, a third C2f layer, a second Conv_BS module, a fourth C2f layer and an RL_SPPF module connected in sequence, and the feature fusion layer includes a first upsampling layer, a first splicing layer, a first SCE-C2f module, a second upsampling layer, a second splicing layer, a second SCE-C2f module, a third upsampling layer, a third splicing layer, a third SCE-C2f module, a first EMA module, a third Conv_BS module, a fourth splicing layer, a fourth SCE-C2f module, a second EMA module, a fourth Conv_BS module, a fifth splicing layer, a fifth SCE-C2f module, a third EMA Module, the fifth Conv_BS module, the sixth splicing layer, the sixth SCE-C2f module and the fourth EMA module, the detection head includes the first Detect_Inner, the second Detect_Inner, the third Detect_Inner and the fourth Detect_Inner, the first C2f layer is also connected to the third splicing layer, the second C2f layer is also connected to the second splicing layer, the third C2f layer is also connected to the first splicing layer, the first SCE-C2f module is also connected to the fifth splicing layer, the second SCE-C2f module is also connected to the fourth splicing layer, the first EMA module is also connected to the first Detect_Inner, the second ENA module is also connected to the second Detect_Inner, the third EMA module is also connected to the third Detect_Inner, and the fourth EMA module is also connected to the fourth Detect_Inner.

3. The fiber fabric defect detection method according to claim 2, characterized in that: The first Conv_BS module, the second Conv_BS module, the third Conv_BS module, the fourth Conv_BS module and the fifth Conv_BS module each include a first convolutional layer, a two-dimensional batch normalization layer and a first SiLU activation function layer connected in sequence.

4. The fiber fabric defect detection method according to claim 2, characterized in that: The first SCConv_BS module, the second SCConv_BS module and the third SCConv_BS module each include a first SCConv module, a two-dimensional batch normalization layer and a second SiLU activation function layer connected in sequence.

5. The fiber fabric defect detection method according to claim 4, characterized in that: The SCConv module includes a spatial reconstruction unit and a channel reconstruction unit, wherein the spatial reconstruction unit is used to split the input into multiple parts, process each part independently, and then reconstruct it to form a refined output, and the channel reconstruction unit is used to use a split-transform-fusion strategy to reduce channel redundancy.

6. The fiber fabric defect detection method according to claim 2, characterized in that: The RL_SPPF module includes a first Conv_BR module, a first maximum pooling layer, a second maximum pooling layer, a third maximum pooling layer, a seventh splicing layer, an LSKA module and a second Conv_BR module connected in sequence, wherein the outputs of the first Conv_BR module, the first maximum pooling layer and the second maximum pooling layer are all connected to the seventh splicing layer, the first Conv_BR module and the second Conv_BR module each include a two-dimensional convolutional layer, a two-dimensional batch normalization layer and a first ReLU activation function layer connected in sequence, and the LSKA module includes a first standard depth convolution layer connected in sequence. , a second standard depth convolution, a first expanded depth convolution, a second expanded depth convolution and a 1*1 convolution layer, and perform a Hadamard product operation on the input of the first standard depth convolution and the output of the 1*1 convolution layer, wherein the expansion parameter of the first standard depth convolution is d, and the convolution kernel size is 1*(2d-1), the expansion parameter of the second standard depth convolution is d, and the convolution kernel size is (2d-1)*1, the intrinsic parameter of the first expanded depth convolution is k, and the convolution kernel size is 1*(k / d), and the intrinsic parameter of the second expanded depth convolution is k, and the convolution kernel size is (k / d)*1.

7. The fiber fabric defect detection method according to claim 1, characterized in that: The first SCE-C2f module and the second SCE-C2f module both include a second convolutional layer, a Split layer, n SCE_Bottleneck modules, an eighth splicing layer and a third convolutional layer connected in sequence, the Split layer and the SCE_Bottle-neck module are both connected to the eighth splicing layer, and the output of the Split layer is connected to the eighth splicing layer, wherein the SCE_Bottleneck module includes a second SCConv module, a weighted fusion module and a fourth convolutional layer connected in sequence, the input of the second SCConv module is also connected to the EdgeNet module, the output of the EdgeNet module is connected to the weighted fusion module, the input of the second SCConv module is added to the output of the fourth convolutional layer, and the EdgeNet module includes a fifth convolutional layer, a second ReLU activation function layer, a sixth convolutional layer and a Sigmoid layer connected in sequence.

8. The fiber fabric defect detection method according to claim 1, characterized in that: In the first EMA module, the second EMA module, the third EMA module and the fourth EMA module, the input feature map is processed at multiple scales through channel grouping, the spatial structure information is extracted through horizontal and vertical average pooling, and the attention weights are generated through 1×1 convolution. Among them, the cross-space learning mechanism introduces normalization and soft attention processes in the feature map, and realizes information interaction between channels through global pooling and matrix multiplication. The generated attention weights are activated by the Sigmoid function and then reweighted element-by-element with the original features to finally obtain the enhanced output feature map.

9. The fiber fabric defect detection method according to claim 1, characterized in that: The first Detect_Inner is a small target detection head with a size of 160*160. The sizes of the first Detect_Inner, the second Detect_Inner, the third Detect_Inner and the fourth Detect_Inner are different and are used to capture defects of different sizes to form a multi-scale detection mechanism. The first Detect_Inner, the second Detect_Inner, the third Detect_Inner and the fourth Detect_Inner share the feature map extracted by the backbone network.

10. A fiber fabric defect detection device, characterized in that: include: A dataset construction module is used to obtain annotated images containing fiber fabrics and then construct a dataset; The model construction module is used to build the SRSE-YOLO model. Specifically, it includes the following steps: based on the YOLOv8 model, the SCConv_BS module is introduced to replace some convolution modules, the RL-SPPF module is adopted in the spatial pyramid pooling fusion module, the SCE-C2f module is introduced in the Neck module, EMA is added after the multi-scale feature fusion module to smooth the update of feature map gradients, the Detect_Inner structure is adopted in the detection head, the Inner-DIoU loss function is used instead of the CIoU loss function, and a 160×160 small object detection head is added to form a multi-scale detection head; A training module, configured to train the SRSE-YOLO model using the data set to obtain a defect detection model; The detection module is used to perform fiber fabric defect detection using the defect detection model.

Citation Information

Cited By

  • Method and device for detecting pile in construction drawing

    CN120876485A

  • A method and device for detecting a pile in construction drawings

    CN120876485B