Fancy textile defect detection method based on channel optimization and knowledge distillation

By fusing the two-channel feature extraction module of Transformer and CNN in the Yolov11 model, introducing partial convolution PConv and detail-enhanced convolution DEConv, and combining knowledge distillation technology, the defect detection model of color textiles is optimized, which solves the problems of high error detection rate and complex calculations in complex backgrounds, and efficient and accurate defect detection is achieved.

CN120495181APending Publication Date: 2025-08-15HUAIYIN INSTITUTE OF TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510492564.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-18
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

The existing flaw detection models of color textile defect detection are high in complex backgrounds, complex calculations and slow detection speed, making it difficult to meet the real-time detection needs of industrial production.

Method used

Using Yolov11 as the benchmark model, a dual-channel feature extraction module that fuses Transformer and CNN, a partial convolution PConv and detailed enhanced convolution DEConv are introduced, and combined with knowledge distillation technology, the model structure and parameters are optimized to improve detection accuracy and efficiency.

Benefits of technology

While keeping the detection speed unchanged, the accuracy and accuracy of defect recognition are significantly improved, the error detection rate is reduced, the calculation efficiency and generalization ability of the model are enhanced, and it is suitable for industrial-grade textile quality inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120495181A_ABST
    Figure CN120495181A_ABST
Patent Text Reader

Abstract

The invention relates to a flower-color textile defect detection method based on channel optimization and knowledge distillation, which comprises the following steps: S1, constructing a flower-color chemical fiber textile surface defect detection model: taking Yolov11 as a reference model, and fusing a Transform and CNN dual-channel feature extraction module; a partial convolution PConv is introduced to reconstruct a C3K2 module, and an improved PC3K2 module is obtained; constructing a detail perception detection head based on a shared convolution structure; the performance of the model is further optimized through knowledge distillation, and an improved model DA-TCD-Yolov11 is obtained; s2, acquiring a public heaven pool competition design and color textile data set, and preprocessing the data set; s3, a DA-TCD-Yolov11 model is trained by means of the data set, and parameters are debugged; and S4, using the trained DA-TCD-Yolov11 model to detect the pattern chemical fiber textile image, and outputting a detection result. According to the DA-TCD-Yolov11 model constructed by the method, on the premise that the detection speed is kept unchanged, the detection performance can be remarkably improved, the average accuracy rate of defect recognition is improved by 5.7%, and the accuracy rate is improved by 15.9%; the method can achieve the efficient and accurate recognition of the surface flaws of the colored chemical fiber textiles.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of visual target detection, and in particular to a method for detecting defects in patterned textiles based on channel optimization and knowledge distillation. Background Art

[0002] As an essential material in daily life and industrial production, textile quality directly impacts product performance and user experience. However, during the textile production process, defects such as holes, seams, and stains often occur due to equipment failure, operational errors, and material quality issues.

[0003] Existing models for defect detection in patterned textiles, such as the Faster R-CNN texture defect detection model, typically use a candidate region generation network (RPN) to extract potential defect regions and employ regional convolutional neural networks for classification and regression. However, these models struggle to effectively separate normal texture from actual defects when faced with complex patterned backgrounds, resulting in a high false detection rate. Furthermore, this method is computationally complex and slow, making it difficult to meet the real-time detection requirements of industrial production. Summary of the Invention

[0004] In response to the above technical problems, this technical solution provides a method for detecting defects in patterned textiles based on channel optimization and knowledge distillation. It uses Yolov11 as the benchmark network model and obtains the improved DA_TCD_Yolov11 detection model, which can effectively remove the influence of background patterns on defects. While ensuring that the detection speed is not reduced, the detection accuracy is improved, and while ensuring the detection accuracy, the computational efficiency and generalization ability of the model are effectively improved; it can effectively solve the above problems.

[0005] The present invention is achieved through the following technical solutions:

[0006] A method for detecting defects in patterned textiles based on channel optimization and knowledge distillation, comprising the following steps:

[0007] Step 1: Using Yolov11 as the benchmark model, build a surface defect detection model for patterned textiles. The specific steps include:

[0008] Step 1.1: Integrate the Transformer and CNN dual-channel feature extraction modules into the Yolov11 backbone feature extraction network to generate the TCD-CFE module;

[0009] Step 1.2: In the Yolov11 feature fusion C3K2 module, introduce partial convolution PConv for enhancement to form a PC3K2 module;

[0010] Step 1.3: Based on detail enhancement convolution (DEConv), a lightweight detail-aware detection head with a shared convolutional structure is constructed. This can reduce the number of parameters without reducing detection accuracy, effectively extracting and enhancing detail features in textile defects, and obtain the improved model DA-TCD-Yolov11.

[0011] Step 2: Perform knowledge distillation on the logits output and the key layers 16, 19, and 22 of the Neck part of the model to further optimize the model performance and enhance the model's ability to perceive textile defects;

[0012] Step 3: Obtain the public Tianchi competition pattern textile dataset, convert the json file into Yolo training format, and divide the dataset into training set, validation set, and test set according to the proportion;

[0013] Step 4: Use the dataset to train and debug the surface defect detection model for patterned textiles, and obtain the optimal model parameters through debugging;

[0014] Input the training set obtained in step 3 into the improved DA_TCD_Yolov11 model for training, save the model with the highest average accuracy, and name its weight file best.pt;

[0015] Step 5: Use the trained patterned textile surface defect detection model to detect the image to be detected and output the detection results.

[0016] Furthermore, the specific operation method of step 1.1 is as follows: in the TCD-CFE module, the input features are first segmented into channels through a 1x1 convolutional layer, and then sent to the parallel CNN and Transformer branches for processing respectively; the CNN branch extracts local feature information, and the Transformer branch captures global feature information; after multiple iterations, the features of the two branches are fused in the channel dimension and integrated into the final output features through another 1x1 convolutional layer; the channel segmentation parameters are set, and a certain number of channels are selected to enter the Transformer branch.

[0017] This architecture not only fully leverages the advantages of CNN in local feature extraction, but also leverages the powerful global modeling capabilities of the Transformer to achieve feature complementarity and enhancement. At the same time, the introduction of this architecture effectively reduces the increased computational effort and parameter redundancy brought about by the Transformer, thereby improving the computational efficiency of the model.

[0018] Furthermore, the channel division parameter is set to 0.75, that is, 75% of the feature information is sent to the Transformer branch and 25% of the feature information is sent to the CNN branch.

[0019] Furthermore, step 1.2 is to optimize the Bottleneck structure in the C3K2 module by introducing partial convolution PConv; the specific operation is as follows:

[0020] Step 1.21: Divide the input feature map into multiple dynamic sub-regions, use PConv to perform convolution operations only on the valid regions, and mask the invalid or low-confidence regions to reduce the interference of irrelevant information;

[0021] Step 1.22: During the convolutional computation, a dynamic mask update mechanism is introduced to ensure that the mask is continuously adjusted during the forward propagation process. Feature learning is performed only on high-confidence areas, increasing the model's focus on target defect areas.

[0022] Step 1.23: Based on the effective feature regions after mask screening, perform normalization operations so that the convolution output maintains the same numerical scale as the standard convolution to ensure the stability and trainability of subsequent network layers;

[0023] Step 1.24: In the feature fusion stage, PConv outputs at different scales are combined to enable the model to capture both global and local information, improving the detection capabilities of complex backgrounds and subtle defects.

[0024] Furthermore, the specific operation method of step 1.3 is:

[0025] Step 1.31: Use the three common convolutional layers in the DAHead detection head to receive feature maps of different scales, namely high resolution, medium resolution, and low resolution, extract basic feature information, and generate multi-channel feature maps to ensure that the model can effectively learn target features at different scales.

[0026] Step 1.32: Introduce three parallel detail enhancement convolutions to further extract fine-grained information to highlight the outlines of small objects and optimize texture information in complex backgrounds, thereby improving the model's ability to perceive key details;

[0027] Step 1.33: All feature maps of different scales are processed through the same shared convolutional structure to reduce the number of model parameters and improve computational efficiency. Since different detection heads are responsible for detecting targets of different scales, in the final stage, a scale layer is introduced to dynamically scale the features to adapt to targets of different scales, improving the model's generalization ability and detection accuracy.

[0028] Furthermore, the specific operation method of step 2 is:

[0029] Step 2.1: Use Yolov11m as the teacher model in the knowledge distillation process, and DA_TCD_Yolov11 obtained in step 1 as the student model;

[0030] Step 2.2: The teacher model performs a forward pass on the input data and generates logits output, which is the distribution of class predictions without softmax normalization.

[0031] Step 2.3: The student model receives the same input data and calculates the corresponding logits prediction value through its network structure;

[0032] Step 2.4: Use the L1 norm to calculate the difference between the student model and the teacher model logits. By minimizing this error, the student model is guided to fit the output distribution of the teacher model more accurately.

[0033] Furthermore, the training set, validation set, and test set described in step 3 are divided in a ratio of 8:1:1.

[0034] Furthermore, the public sample dataset adopts the open source Tianchi competition pattern and color fabric defect detection dataset, totaling 4371 pictures; it contains 15 categories of pattern and color textile defect datasets, including types: no defects, insect sticking, wrong patterns, seam ends, seam head prints, flower hairs, wax spots, missing prints, holes, color difference, watermarks, mesh folds, stains, wrinkles, and weaving defects.

[0035] Furthermore, the image size of the training set input in step 4 is set to 640*640, the batch size is 16, the number of training iterations is 300, the initial learning rate is 0.01, the learning rate momentum is 0.937, the weight decay coefficient is 0.0005, and the optimizer uses SGD. After the training is completed, the model saves the weight file with the best training result, best.pt.

[0036] Furthermore, when the image to be detected is detected in step five, the best.pt obtained in step four is used as a weight file for detecting surface defects of patterned chemical fiber textiles to detect the patterned image.

[0037] (3) Beneficial effects

[0038] The present invention proposes a method for detecting defects in patterned textiles based on channel optimization and knowledge distillation. Compared with the existing technology, it has the following beneficial effects:

[0039] (1) Based on the Yolov11 model, the present invention customizes the fusion of CNN and Transformer dual-channel feature extraction branches, fully combining the local perception ability of CNN with the global modeling ability of Transformer, effectively integrating global and local features, and improving the accuracy of defect recognition under complex backgrounds. It also introduces partial convolution PConv, which only performs convolution operations on specific channels, reduces redundant calculations, improves the lightweight degree of the model, and reduces computational costs. It also adopts an adaptive detail-aware detection head, which enhances the sensitivity to textile defect areas while suppressing the model's interference with the pattern background and reducing the false detection rate. The improved DA-TCD-Yolov11 model provides an efficient and stable solution for the intelligent detection of patterned textiles.

[0040] (2) The present invention establishes a dynamic feature control mechanism between local feature extraction and global feature modeling, which enables the model to adaptively adjust the weight distribution of local and global features according to the complexity of the pattern background and the significance of the defect area, thereby optimizing feature expression and improving detection accuracy. The core is that the TCD-CFE module does not independently strengthen local or global features, but through the feature interaction mechanism, local feature extraction strengthens the edge information of details while providing context constraints from global features to avoid misdetection of background texture as defects. At the same time, global feature modeling optimizes the discrimination of defect areas with the help of local detail information in the process of capturing the overall texture distribution, thereby improving robustness under complex backgrounds. Compared with traditional methods, this method enables the detection network to have stronger adaptive capabilities, not only to accurately distinguish defects in regular pattern backgrounds, but also to reduce misjudgments in asymmetric, irregular and complex backgrounds, thus having higher stability in actual industrial applications.

[0041] (3) The present invention reconstructs the C3K2 structure in the original network, proposes the PC3K2 module, and uses partial convolution to optimize the feature fusion method. PConv only performs conventional convolution operations on some input channels, thereby reducing computational redundancy and model complexity while ensuring the effective extraction of key feature areas. During the feature learning process, this method can enhance the perception of non-uniform morphological defects, making it easier for the model to capture defect areas with irregular morphology and blurred boundaries. In addition, by dynamically adjusting the allocation of computing resources, the PC3K2 module can optimize the information flow between channels, so that the detection model can still highlight key defect features in a complex background, effectively improving detection accuracy and stability.

[0042] (4) The present invention proposes a detail-aware detection head DAHead based on detail-enhanced convolution, which aims to improve the model's ability to detect minor defects. The detection head adopts a lightweight design to reduce redundant calculations, and at the same time strengthens the learning of texture details through detail-enhanced convolution, so that the model has stronger resolution capabilities when dealing with complex backgrounds and low-contrast defects. In addition, the detection head integrates a dynamic anchor point adjustment mechanism that can adaptively adjust the distribution of the detection frame according to the target size, making it more accurate in detecting minor defects and avoiding the problems of false detection and missed detection caused by traditional fixed anchor point methods. Through these optimization strategies, DAHead reduces the computational complexity while maintaining high detection accuracy, making the model more suitable for industrial-grade textile quality inspection tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 It is a schematic diagram of the overall process of the present invention.

[0044] Figure 2 It is the network structure diagram of DA_TCD_Yolov11 in the present invention.

[0045] Figure 3 This is the network structure diagram of the TCD-CFE module in the present invention.

[0046] Figure 4 This is the network structure diagram of the PC3K2 module in the present invention.

[0047] Figure 5 This is the network structure diagram of the DAHead module in the present invention.

[0048] Figure 6 This is the thermal comparison result of the DA_TCD_Yolov11 and Yolov11 models of the present invention.

[0049] Among them, the left 1 is the original image, the left 2 is Yolov11, and the left 3 is DA_TCD_Yolov11.

[0050] Figure 7 This is the comparison result of the receptive fields of DA_TCD_Yolov11 and Yolov11 in the present invention.

[0051] Among them, the left 1 is Yolov11, and the left 2 is DA_TCD_Yolov11. DETAILED DESCRIPTION

[0052] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. The described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Under the premise of not departing from the design concept of the present invention, various modifications and improvements made by ordinary persons in this field to the technical solutions of the present invention should fall within the scope of protection of the present invention.

[0053] Example 1:

[0054] like Figure 1 As shown, a method for detecting defects in patterned textiles based on channel optimization and knowledge distillation includes the following steps:

[0055] Step 1: Optimize the Yolov11 target detection algorithm, build and improve the Yolov11 model, and obtain the surface defect detection model of colored chemical fiber textiles; the improved network structure is as follows Figure 2 As shown in the figure, the TCD-CFE module replaces the original backbone network layers 7 and 9 for feature extraction; PC3K2 optimizes layers 14, 17, 20, and 23; and DAHead replaces the original detection head. The specific steps for building and improving the Yolov11 model are as follows:

[0056] Step 1.1: Integrate the Transformer and CNN dual-channel feature extraction modules into the Yolov11 backbone feature extraction network to generate a TCD-CFE module.

[0057] The network structure of the TCD-CFE module is as follows Figure 3 As shown in the figure, it includes an input convolutional layer, a partitioning operation, a Transformer channel branch, a CNN channel branch, and a fusion module. After the input data is processed by the convolutional layer to extract low-level features, it is adapted to the Transformer branch through the partitioning operation. The Transformer module includes a normalization layer, a multi-head self-attention mechanism, Droppath regularization, and ACGLU, and retains information through residual connections. The CNN module consists of multiple convolutional layers to extract local features and uses residual connections to enhance information transfer. Finally, the outputs of the Transformer and CNN modules are spliced together by the fusion module to obtain a representation that integrates global and local features.

[0058] The specific operation method is as follows: in the TCD-CFE module, the input features are first segmented into channels through a 1x1 convolution layer, and then sent to the parallel CNN and Transformer branches for processing; the CNN branch extracts local feature information, and the Transformer branch captures global feature information; after multiple iterations, the features of the two branches are fused in the channel dimension and integrated into the final output features through another 1x1 convolution layer; the channel division parameter is set, and a certain number of channels are selected to enter the Transformer branch. In this embodiment, the channel division parameter is set to 0.75, that is, 75% of the feature information is sent to the Transformer branch, and 25% of the feature information is sent to the CNN branch. Not only does it make full use of the advantages of CNN in local feature extraction, but it also uses the powerful global modeling capabilities of the Transformer to achieve feature complementarity and enhancement. At the same time, the introduction of this structure effectively reduces the increase in computational complexity and parameter redundancy brought about by the Transformer, and improves the computational efficiency of the model.

[0059] The core of this module lies in splitting the feature map into two parallel channel branches: a CNN branch and a Transformer branch. The CNN branch utilizes the traditional Bottleneck architecture for local feature extraction, while the Transformer branch performs global feature modeling. This module incorporates the multi-head self-attention mechanism Mutil-Head-Self-Attention and the gated linear unit Convolutional Luminary Unit (GLU) augmented with AKConv convolutions. These mechanisms capture long-range dependencies between features while enhancing the nonlinear representation of features. Regularization and normalization further enhance the stability and robustness of feature extraction. The core expression of this module is as follows:

[0060] y cv1 =Conv(W cv1 *x+b cv1 )

[0061] y0,y1=split(y cv1 ,dim=1)

[0062] Among them, y cv1 is the output feature map, W cv1 is the convolution kernel weight, b cv1 is the bias term, x is the input feature map; y0, y1 represent the feature maps after segmentation along the channel dimension.

[0063] y cnn_out =Bottleneck(y0)

[0064] y trans_out =MHSA_CGLU(y1)

[0065] y out =Conv(concat(y cnn_out ,y trans_out ))

[0066] Among them, y cnn_out Represents the result after CNN branch processing, y trans_out Represents the result after Transformer branch processing, y out Represents the final output result.

[0067] Step 1.2: In the Yolov11 feature fusion C3K2 module, introduce partial convolution PConv for enhancement to form the PC3K2 module. The specific operation is as follows:

[0068] Step 1.21: Optimize the Bottleneck structure in the C3K2 module to divide the input feature map into multiple dynamic sub-regions. Use PConv to perform convolution operations only on the valid regions and mask the invalid or low-confidence regions to reduce the interference of irrelevant information.

[0069] Step 1.22: During the convolutional computation, a dynamic mask update mechanism is introduced to ensure that the mask is continuously adjusted during the forward propagation process. Feature learning is performed only on high-confidence areas, increasing the model's focus on target defect areas.

[0070] Step 1.23: Based on the effective feature regions after mask screening, perform normalization operations so that the convolution output maintains the same numerical scale as the standard convolution to ensure the stability and trainability of subsequent network layers;

[0071] Step 1.24: In the feature fusion stage, PConv outputs at different scales are combined to enable the model to capture both global and local information, improving the detection capabilities of complex backgrounds and subtle defects.

[0072] Among them, the PC3K2 module network structure is as follows Figure 4As shown in the figure. This module first extracts low-level features from the input data through the convolution layer, and then splits the feature map into multiple parts through the Split operation. The segmented data flows to different branches based on the conditions: when the condition is True, the data enters the P3K module for further processing; when the condition is False, the data directly enters the PBottleneck module. The PBottleneck module contains partial convolution and convolution operations, which are used to compress and decompress features to extract higher-level feature representations, and retain the original information through residual connections to help gradient flow. Residual connections are also used within and between modules to ensure the effective transmission of information and the stable flow of gradients. The processed feature map passes through the convolution layer again to generate the final feature representation for subsequent defect detection tasks.

[0073] PConv convolution is introduced to replace the ordinary convolution layer, and the feature map is divided into multiple sub-regions for convolution operations; it can more effectively focus on and extract key information in the input features, while ignoring unimportant parts. PConv convolution reduces the amount of calculation and memory access by performing convolution operations on only part of the channels. This module combines PConv with multi-branch feature fusion, and is suitable for efficient processing of complex defect detection in textiles. Its core design is to balance computational complexity and feature expression capabilities through a segmentation-processing-fusion process. This optimization not only reduces the number of model parameters, but also improves the model's expression ability and detection performance for textile defect features. The C3K2 module can extract multi-scale features through variable convolution kernel design and feature segmentation and splicing. PConv performs convolution operations on some channels, retains information from other channels, and allows feature information to flow in all channels. The core expression of this module is as follows:

[0074] y cv1 =Conv(BN(W cv1 *x+b cv1 ))

[0075] y0,y1=split(y cv1 ,dim=1)

[0076] y k+1 =M k (y k ),k=1,2,3,…,n

[0077] y cat =Concaty0,y1,y2,…,y n+1 , dim=1)

[0078] y out =Conv(BN(W cv2 *y cat +b cv2 ))

[0079] Among them, y cv1 is the output feature map; W cv1 , W cv2 is the convolution kernel weight; b cv1 , b cv2 is the bias term; x is the input feature map; y0, y1 represent the feature maps after segmentation along the channel dimension; M k is the kth processing module, which applies n modules to y in sequence, generates a new feature map and adds it to the list y; cat is the result of concatenating all features along the channel dimension; y out is the final output result.

[0080] Step 1.3: Based on detail enhancement convolution DEConv, a lightweight detail perception detection head DAHead based on shared convolution structure is constructed; the network structure diagram of the DAHead module is as follows: Figure 5 As shown in the figure, it is possible to reduce the number of parameters without reducing the detection accuracy, effectively extract and enhance the detailed features of textile defects, and obtain the improved model DA-TCD-Yolov11. The specific operation method is as follows:

[0081] Step 1.31: Use the three common convolutional layers in the DAHead detection head to receive feature maps of different scales, namely high resolution, medium resolution, and low resolution, extract basic feature information, and generate multi-channel feature maps to ensure that the model can effectively learn target features at different scales.

[0082] Step 1.32: Introduce three parallel detail enhancement convolutions to further extract fine-grained information to highlight the outlines of small objects and optimize texture information in complex backgrounds, thereby improving the model's ability to perceive key details;

[0083] Step 1.33: All feature maps of different scales are processed through the same shared convolutional structure to reduce the number of model parameters and improve computational efficiency. Since different detection heads are responsible for detecting targets of different scales, in the final stage, a scale layer is introduced to dynamically scale the features to adapt to targets of different scales, improving the model's generalization ability and detection accuracy.

[0084] By learning an adjustable scaling factor, the feature map can be scaled up or down based on the actual size of the object. During the inference phase, the predicted bounding boxes and class probabilities are decoded and integrated to generate the final detection results. Through a dynamic anchor point generation mechanism, the module can flexibly adjust the size and position of anchor points based on the input image size and feature distribution, thereby better adapting to defects of varying sizes and shapes. This flexibility enables the model to maintain high detection accuracy and robustness when dealing with the same defect in different forms.

[0085] Step 2: Perform knowledge distillation on the logits output and the key layers 16, 19, and 22 of the Neck part of the model to further optimize the model performance and enhance the model's ability to perceive textile defects. The specific operation is as follows:

[0086] Step 2.1: Use Yolov11m as the teacher model in the knowledge distillation process, and DA_TCD_Yolov11 obtained in step 1 as the student model;

[0087] Step 2.2: The teacher model performs a forward pass on the input data and generates logits output, which is the distribution of class predictions without softmax normalization.

[0088] Step 2.3: The student model receives the same input data and calculates the corresponding logits prediction value through its network structure;

[0089] Step 2.4: Use the L1 norm to calculate the difference between the student model and the teacher model logits. By minimizing this error, the student model is guided to fit the output distribution of the teacher model more accurately.

[0090] During the distillation process, we combine logits distillation and feature distillation, and use the output distribution and intermediate layer features of the teacher model to optimize the learning method of the student model, so that it can be as close to the detection ability of the teacher model as possible while maintaining efficient reasoning. The distillation loss function is calculated as follows:

[0091]

[0092] Where x and y represent the predicted outputs of the student model and the teacher model in the corresponding tasks, respectively; n represents the total number of predictions in the sample; MAE(x,y) represents the mean absolute error between the input variables, which is used to measure the numerical proximity between the two.

[0093] The final logits distillation loss is defined as follows:

[0094] l reg =λ(MAE(s reg , t reg )t scale )

[0095] l cls =μ(MAE(s cls , t cls )t scale )

[0096]

[0097] Among them, sreg With t reg Represents the output results of the student model and the teacher model on the regression branch; s cls With t cls Represents the output result on the classification branch; t scale is the temperature scaling factor, which is used to soften the output of the teacher model and enhance the distinguishability of information transfer; λ and μ are loss weighted hyperparameters, which are used to adjust the weight ratio of regression loss and classification loss in the total loss; B represents the batch size during training, that is, the number of samples used in each round of training; the final distillation loss L res It is the weighted average of classification loss and regression loss, which is used to measure the overall fitting effect of the student model on the teacher model knowledge.

[0098] Step 3: Obtain the public Tianchi competition pattern textile dataset, convert the json file into Yolo training format, and divide the dataset into training set, validation set, and test set according to the ratio; the training set, validation set, and test set are divided in an 8:1:1 ratio.

[0099] The dataset required for the experiment was constructed using a public dataset. The Tianchi patterned fabric defect detection dataset of the 2019 Guangdong Industrial Intelligent Manufacturing Innovation Competition was obtained, totaling 4,371 images. It contains 15 categories of patterned textile defect datasets, including: no defects, insect sticking, wrong patterns, seam ends, seam end prints, flower hairs, wax spots, missing prints, holes, color difference, watermarks, net folds, stains, wrinkles, and weaving defects.

[0100] Step 4: Use the dataset to train and debug the surface defect detection model for patterned textiles. Input the training set obtained in step 3 into the improved DA_TCD_Yolov11 model for training. Obtain the optimal model parameters through debugging. Save the model with the highest average accuracy and name its weight file best.pt.

[0101] The image size of the training set input is set to 640*640, the batch size is 16, the number of training iterations is 300, the initial learning rate is 0.01, the learning rate momentum is 0.937, the weight decay coefficient is 0.0005, and the optimizer uses SGD. After training is completed, the model saves the best weight file best.pt.

[0102] In order to test the performance of the improved model, the indicators for evaluating superiority include: mAP (average AP of each category), Precision (precision / precision), and Recall (recall / recall) as evaluation indicators of the model algorithm. With recall as the x-axis and precision as the y-axis, a PR curve is drawn. The area under the PR curve is defined as AP. The calculation formulas for each evaluation indicator are as follows:

[0103]

[0104]

[0105] Among them, TP is the number of samples correctly predicted as positive samples, FN is the number of samples that the model fails to correctly identify in the actual positive samples, FP is the number of negative samples that are mistakenly identified as positive by the model, AP is the area under the precision-recall curve for a single category, P(R)dR is the integral term under the precision-recall curve, n is the total number of categories, and P(R)D(R) is the average precision of the Rth category.

[0106] Step 5: Use the trained patterned textile surface defect detection model to detect the image to be detected. When detecting the image to be detected, use the best.pt obtained in step 4 as the weight file for detecting patterned chemical fiber textile surface defects, and detect the patterned image; output the detection result.

[0107] Experimental verification:

[0108] In order to verify the feasibility and advantages of this solution, the inventors conducted ablation experiments on the improved DA_TCD_Yolov11 model and the original Yolov11 model in this solution. The test results of the ablation experiments of this embodiment and the Yolov11 are shown in Table 1:

[0109] Table 1 Ablation experiment results

[0110] Group PC3K2 DAHead TCD-CFE mAP0.5 mAP0.95 R P one × × × 0.393 0.193 0.398 0.529 two √ × × 0.405 0.195 0.362 0.513 three √ √ × 0.408 0.222 0.381 0.583 Four √ √ √ 0.46 0.25 0.416 0.688

[0111] The data in the table above shows that the DA-TCD-Yolov11 model significantly improves detection results after optimizing the network based on the Yolov11 model. At mAP@0.5%, the DA-TCD-Yolov11 model outperforms the original Yolov11 model by 6.7%; at mAP@0.95%, the DA-TCD-Yolov11 model outperforms the original Yolov11 model by 5.7%; in recall, the DA-TCD-Yolov11 model improves by 1.8%; and in precision, the DA-TCD-Yolov11 model outperforms the original Yolov11 model by 15.9%.

[0112] Figure 6A heatmap diagram of the original Yolov11 and DA-TCD-Yolov11 models on the Tianchi patterned textile dataset is shown. In the heatmap, red areas represent key areas of interest to the model, i.e., the locations of defects. Darker colors indicate a higher degree of model attention. Conversely, blue areas correspond to less important areas, typically background areas, to which the model pays less attention.

[0113] Figure 7 A schematic diagram of the receptive fields of the original Yolov11 and DA-TCD-Yolov11 models for the Tianchi floral textile dataset is shown. Darker and denser green colors represent larger receptive fields. This comparison clearly demonstrates that the DA-TCD-Yolov11 model of our invention has a significantly larger receptive field during the feature extraction phase.

[0114] The above is a detailed introduction to the deep learning-based long-term prediction and dynamic intervention system for Alzheimer's disease provided by the examples of the present invention. The description of the above embodiments is only intended to help understand the method and core concept of the present invention; at the same time, those skilled in the art will find that the specific implementation methods and application scopes may vary based on the concepts of the present invention. In summary, the contents of this specification should not be construed as limiting the present invention.

Claims

1. A method for detecting defects in patterned textiles based on channel optimization and knowledge distillation, characterized by: Including steps: Step 1: Using Yolov11 as the benchmark model, build a surface defect detection model for patterned textiles. The specific steps include: Step 1.1: Integrate the Transformer and CNN dual-channel feature extraction modules into the Yolov11 backbone feature extraction network to generate the TCD-CFE module; Step 1.2: In the Yolov11 feature fusion C3K2 module, introduce partial convolution PConv for enhancement to form a PC3K2 module; Step 1.3: Based on detail enhancement convolution DEConv, a lightweight detail-aware detection head based on a shared convolutional structure is constructed; the improved model DA-TCD-Yolov11 is obtained; Step 2: Perform knowledge distillation on the logits output and the key layers 16, 19, and 22 of the Neck part of the model; Step 3: Obtain the public Tianchi competition pattern textile dataset, convert the json file into Yolo training format, and divide the dataset into training set, validation set, and test set according to the proportion; Step 4: Input the training set obtained in step 3 into the improved DA_TCD_Yolov11 model for training, save the model with the highest average accuracy, and name its weight file best.pt; Step 5: Use the trained patterned textile surface defect detection model to detect the image to be detected and output the detection results.

2. The method for detecting defects in patterned textiles based on channel optimization and knowledge distillation according to claim 1, characterized in that: The specific operation of step 1.1 is as follows: in the TCD-CFE module, the input features are first segmented into channels through a 1x1 convolutional layer, and then sent to the parallel CNN and Transformer branches for processing; the CNN branch extracts local feature information, and the Transformer branch captures global feature information; after multiple iterations, the features of the two branches are fused in the channel dimension and integrated into the final output features through another 1x1 convolutional layer; Set the channel division parameters and select a certain number of channels to enter the Transformer division.

3. The method for detecting defects in patterned textiles based on channel optimization and knowledge distillation according to claim 2, characterized in that: The channel division parameter is set to 0.75, that is, 75% of the feature information is sent to the Transformer branch and 25% of the feature information is sent to the CNN branch.

4. The method for detecting defects in patterned textiles based on channel optimization and knowledge distillation according to claim 1, characterized in that: Step 1.2 is to optimize the Bottleneck structure in the C3K2 module by introducing partial convolution PConv; the specific operation is as follows: Step 1.21: Divide the input feature map into multiple dynamic sub-regions, use PConv to perform convolution operations only on the valid regions, and mask the invalid or low-confidence regions to reduce the interference of irrelevant information; Step 1.22: During the convolutional computation, a dynamic mask update mechanism is introduced to ensure that the mask is continuously adjusted during the forward propagation process. Feature learning is performed only on high-confidence areas, increasing the model's focus on target defect areas. Step 1.23: Based on the effective feature regions after mask screening, perform normalization operations so that the convolution output maintains the same numerical scale as the standard convolution to ensure the stability and trainability of subsequent network layers; Step 1.24: In the feature fusion stage, PConv outputs at different scales are combined to enable the model to capture both global and local information, improving the detection capabilities of complex backgrounds and subtle defects.

5. The method for detecting defects in patterned textiles based on channel optimization and knowledge distillation according to claim 1, characterized in that: The specific operation method of step 1.3 is: Step 1.31: Use the three common convolutional layers in the DAHead detection head to receive feature maps of different scales, namely high resolution, medium resolution, and low resolution, extract basic feature information, and generate multi-channel feature maps to ensure that the model can effectively learn target features at different scales. Step 1.32: Introduce three parallel detail enhancement convolutions to further extract fine-grained information to highlight the outlines of small objects and optimize texture information in complex backgrounds, thereby improving the model's ability to perceive key details; Step 1.33: All feature maps of different scales are processed through the same shared convolutional structure to reduce the number of model parameters and improve computational efficiency. Since different detection heads are responsible for detecting targets of different scales, in the final stage, a scale layer is introduced to dynamically scale the features to adapt to targets of different scales, improving the model's generalization ability and detection accuracy.

6. The method for detecting defects in patterned textiles based on channel optimization and knowledge distillation according to claim 1, characterized in that: The specific operation method of step 2 is: Step 2.1: Use Yolov11m as the teacher model in the knowledge distillation process, and DA_TCD_Yolov11 obtained in step 1 as the student model; Step 2.2: The teacher model performs a forward pass on the input data and generates logits output, which is the distribution of class predictions without softmax normalization. Step 2.3: The student model receives the same input data and calculates the corresponding logits prediction value through its network structure; Step 2.4: Use the L1 norm to calculate the difference between the student model and the teacher model logits. By minimizing this error, the student model is guided to fit the output distribution of the teacher model more accurately.

7. The method for detecting defects in patterned textiles based on channel optimization and knowledge distillation according to claim 1, characterized in that: The training set, validation set, and test set described in step 3 are divided in a ratio of 8:1:

1.

8. The method for detecting defects in patterned textiles based on channel optimization and knowledge distillation according to claim 1 or 7, characterized in that: The public sample dataset adopts the open source Tianchi competition pattern and color fabric defect detection dataset, which consists of 4,371 images. It contains 15 categories of pattern and color textile defect datasets, including: no defects, insect sticking, wrong patterns, seam ends, seam head prints, flower hairs, wax spots, missing prints, holes, color difference, watermarks, mesh folds, stains, wrinkles, and weaving defects.

9. The method for detecting defects in patterned textiles based on channel optimization and knowledge distillation according to claim 1, characterized in that: The image size of the training set input described in step 4 is set to 640*640, the batch size is 16, the number of training iterations is 300, the initial learning rate is 0.01, the learning rate momentum is 0.937, the weight decay coefficient is 0.0005, and the optimizer uses SGD. After training is completed, the model saves the best weight file best.pt.

10. The method for detecting defects in patterned textiles based on channel optimization and knowledge distillation according to claim 1, characterized in that: When the image to be detected is detected in step five, the best.pt obtained in step four is used as a weight file for detecting surface defects of patterned chemical fiber textiles to detect the patterned image.