Semi-supervised printed fabric defect segmentation method based on ST + +
By combining the ST++ semi-supervised training framework with a multi-scale feature selective fusion module and a triple attention module, the problem of scarce defect images of printed fabrics and high annotation costs is solved, achieving stable segmentation results and improved generalization ability under limited data.
Patent Information
- Application Number
- CN202510995096.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-18
- Publication Date
- 2025-10-21
AI Technical Summary
Images of defects in printed fabrics are scarce and difficult to obtain. Traditional supervised defect segmentation methods have insufficient generalization ability under limited data, and pixel-level annotation is costly and difficult to adapt to complex scenarios.
A semi-supervised training framework based on ST++ is adopted, which combines a segmentation network with a multi-scale feature selective fusion module and a triple attention module. By performing pseudo-label annotation on unlabeled images and multi-scale feature fusion, the generalization ability and stability of the model are improved.
With limited data, relatively stable defect segmentation of printed fabrics was achieved, reducing annotation costs and improving the segmentation effect and generalization ability of the model in complex scenarios.
Smart Images

Figure CN120823191A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of printed fabric defect segmentation, and particularly relates to a semi-supervised printed fabric defect segmentation method based on ST++. Background Art
[0002] Textile and apparel fabrics are widely used in all aspects of our lives. As high-value-added printed fabrics, they are in high demand in military supplies, medical protection, clothing, high-end home textiles, and home decor. However, during the printed fabric production process, various factors, such as the ink pad, scraper, ink color, scraping, movement, inkjet printing, and post-processing, inevitably lead to various printing defects. These defects have a direct impact on the quality and price of the final fabric product. Therefore, fabric defect detection is an indispensable step in the automated identification and location of defects in the textile production process.
[0003] While traditional supervised defect segmentation methods can achieve stable segmentation when sufficient data is available, images of printed fabric defects are scarce and difficult to obtain. Pixel-level labeling requires specialized knowledge and significant labor, resulting in a scarcity of labeled data. Furthermore, the diversity and complexity of defects further complicate detection. Traditional methods lack generalization capabilities with limited data and struggle to adapt to complex scenarios. Compared to images of other industrial products, images of printed fabric defects are not only scarce but also more challenging to obtain due to their unique characteristics. This is because printed fabric defects are often diverse and complex, encompassing different types, shapes, and colors, making it difficult to establish a unified standard for image data collection and analysis. Furthermore, the quality of defect image labeling is a significant issue. Pixel-level labeling requires meticulous and accurate labeling of each pixel's category, which not only requires specialized knowledge and skills but also places higher demands on the labelers. In practice, this meticulous labeling effort often consumes significant labor and material resources, resulting in high labeling costs. To ensure high-quality labeling results, multiple rounds of review and revision are often required, placing a significant burden in terms of both time and financial costs. Therefore, how to complete a relatively stable defect segmentation task with limited data is an adjustable topic. Summary of the Invention
[0004] The purpose of the present invention is to provide a semi-supervised printed fabric defect segmentation method based on ST++, which solves the problems of high labeling cost of printed fabric defect samples and insufficient generalization ability under limited data.
[0005] The technical solution adopted by the present invention is a semi-supervised printed fabric defect segmentation method based on ST++, comprising the following steps: Step 1: Collect printed fabric defect images, preprocess the images, and construct a printed fabric defect dataset; Step 2: Build a segmentation network that includes the ST++ semi-supervised training framework, a multi-scale feature selective fusion module, and a triple attention module; Step 3: Input the printed fabric defect dataset into the segmentation network for training and output the defect segmentation results.
[0006] The present invention is also characterized in that: In step 1, the printed fabric defect image is collected by an industrial camera.
[0007] The preprocessing in step 1 specifically includes: adding different degrees of Gaussian noise, salt and pepper noise and mixed noise to the image, expanding the amount of original data, and achieving better noise resistance performance.
[0008] Gaussian noise is specifically: Generate a random noise matrix that matches the size of the original printed fabric defect image according to the image size, as shown in formula (1); (1); in, and represent the noise matrix and the original printed fabric defect image respectively, and represents the image position, represents a normal distribution, and represents the mean and variance of the normal distribution; The noise matrix generated Superimpose the defect image on the original printed fabric On the surface, Gaussian noise is formed, as shown in formula (2); (2); in, Represents matrix addition.
[0009] Salt and pepper noise is specifically: Setting the signal-to-noise ratio , represents the proportion of pixels in the image to be replaced by noise, generating a random number matrix that matches the size of the original printed fabric defect image R , the range of random numbers is 0 to 1, and the random number matrix is falsified to obtain the salt and pepper noise shown in formula (3); (3); in, is the value of the random number matrix corresponding to the pixel position.
[0010] The mixed noise is specifically: Gaussian noise and salt and pepper noise are mixed and superimposed to obtain the mixed noise, as shown in formula (4); (4).
[0011] The ST++ semi-supervised training framework in step 2 is as follows: first, the teacher model is trained on the labeled images. Then, the reliable unlabeled images selected by the mIOU score are annotated with pseudo labels using the professor network. The academic network is trained a second time on the original and filtered images. Finally, the remaining images are pseudo-labeled and the final model training is performed on all images. The selection process of reliable unlabeled images is as follows: for an unlabeled image , using the saved Model parameters in the image The pseudo labels predicted above and The prediction results of the model parameters are used to calculate mIOU, as shown in formula (5); (5); in, We measure the unlabeled images stability and reliability, Indicates in The pseudo labels predicted based on the model parameters.
[0012] In step 2, the multi-scale feature selective fusion module uses the MSP Block module. The MSP Block module performs weighted fusion of the global features output by the four dilated convolution branches with different dilation rates in P1block in different spatial and channel dimensions to achieve more stable printed fabric defect segmentation. The MSP Block module consists of four dilated convolution branches with different dilation rates and the MSF. The MSP Block module is specifically: Represents the four feature maps of the same size but different scales in the P1 Block. They are activated in the spatial dimension through global average pooling, convolution processing with a convolution kernel size of 1, and Sigmoid function to obtain the gain vector in the channel dimension, as shown in Equation (6); (6); in, Indicates the The first stage output results of each branch; The above process extracts the global representation of the spatial dimension in each branch and generates the gain vector of the channel dimension. In order to achieve multi-scale feature fusion between branches, MSF concatenates the gain features of different branches and obtains the weight representation of each branch through the Softmax function, as shown in Equation (7). (7); in, Represents the channel gain vector after interaction; Will Split into the gain vectors of each channel, multiply with the original features, and perform feature fusion, as shown in formula (8); (8).
[0013] In step 2, the triple attention module adopts the TA module. The triple attention module consists of three branches with different dimensions of enhancement. The first dimension mainly performs selective feature enhancement fusion in the channel and horizontal dimensions. The second and third branches mainly perform feature fusion in the channel-vertical and spatial dimensions. The TA module is specifically as follows: In the first feature enhancement branch, Represents the output feature map, whose size is , rotate the first feature enhancement branch 90 degrees counterclockwise along the H axis to obtain , at this time the dimension of the first feature enhancement branch is converted to , perform Z-Pool aggregation in sequence The maximum pooling feature and average pooling feature representation of the dimension are concatenated to obtain , whose dimensions are , as shown in formula (9); (9); Through a convolution of size 1, Dimension is mapped to one dimension to obtain the gain vector , the gain vector Perform matrix multiplication with the original features to achieve The gain in dimension, and finally the output feature is converted into , as shown in formula (10); (10); in, represents the first feature enhancement branch; The second branch of dimension transformation is The dimension of the feature gain vector of the second branch is , output features are used Indicates that the third branch does not perform dimension conversion, and the processing process is Dimension, the output features are used express; The output features of the three dimensions are fused by adding and averaging, and the output features of the three dimensions are kept consistent with the input features in terms of dimensions, as shown in formula (11); (11).
[0014] The beneficial effects of the present invention are: The semi-supervised printed fabric defect segmentation method provided by this invention, based on ST++, introduces an ST++ training strategy to improve the performance of the traditional self-training paradigm. It employs a multi-scale feature selection and fusion method to enhance the model's generalization and stability, reducing the impact of channel dimensionality differences on segmentation results. It also employs a triple attention module to improve the model's ability to capture edges and fine features of printed fabric defects. This invention effectively addresses the issues of a limited number of printed fabric defect image samples and the high cost of data labeling. It achieves relatively stable segmentation results using only a small amount of labeled data, essentially completing the printed fabric defect segmentation task. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 1. It is a diagram of the segmentation network architecture of the semi-supervised printed fabric defect segmentation method based on ST++ of the present invention; Figure 2 This is an ST++ training flow chart of the ST++-based semi-supervised printed fabric defect segmentation method of the present invention; Figure 3 1 is a structural diagram of the MSF module of the semi-supervised printed fabric defect segmentation method based on ST++ of the present invention; Figure 4 This is a semi-supervised visualization result diagram of the semi-supervised printed fabric defect segmentation method based on ST++ of the present invention; Figure 5 This is a supervised visualization result diagram of the semi-supervised printed fabric defect segmentation method based on ST++ of the present invention. DETAILED DESCRIPTION
[0016] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0017] Example 1 The semi-supervised printed fabric defect segmentation method based on ST++ proposed in this embodiment includes the following steps: Step 1: Collect printed fabric defect images, preprocess the images, and construct a printed fabric defect dataset; Step 2: Build a segmentation network that includes the ST++ semi-supervised training framework, a multi-scale feature selective fusion module, and a triple attention module; Step 3: Input the printed fabric defect dataset into the segmentation network for training and output the defect segmentation results.
[0018] Example 2 The semi-supervised printed fabric defect segmentation method based on ST++ proposed in this embodiment includes the following steps: Step 1: Collect printed fabric defect images, preprocess the images, and construct a printed fabric defect dataset; Printed fabric defect images are collected by industrial cameras; Preprocessing specifically includes: adding different degrees of Gaussian noise, salt and pepper noise, and mixed noise to the image to expand the amount of original data and achieve better noise resistance performance; Step 2: Build a segmentation network that includes the ST++ semi-supervised training framework, a multi-scale feature selective fusion module, and a triple attention module; Step 3: Input the printed fabric defect dataset into the segmentation network for training and output the defect segmentation results.
[0019] Example 3 The semi-supervised printed fabric defect segmentation method based on ST++ proposed in this embodiment includes the following steps: Step 1: Collect printed fabric defect images, preprocess the images, and construct a printed fabric defect dataset; Printed fabric defect images are collected by industrial cameras; Preprocessing specifically includes: adding different degrees of Gaussian noise, salt and pepper noise, and mixed noise to the image to expand the amount of original data and achieve better noise resistance performance; Gaussian noise is specifically: Generate a random noise matrix that matches the size of the original printed fabric defect image according to the image size, as shown in formula (1); (1); in, and represent the noise matrix and the original printed fabric defect image respectively, and represents the image position, represents a normal distribution, and represents the mean and variance of the normal distribution; The noise matrix generated Superimpose the defect image on the original printed fabric On the surface, Gaussian noise is formed, as shown in formula (2); (2); in, represents matrix addition; Salt and pepper noise is specifically: Setting the signal-to-noise ratio , represents the proportion of pixels in the image to be replaced by noise, generating a random number matrix that matches the size of the original printed fabric defect image R , the range of random numbers is 0 to 1, and the random number matrix is falsified to obtain the salt and pepper noise shown in formula (3); (3); in, is the value of the random number matrix corresponding to the pixel position; The mixed noise is specifically: Gaussian noise and salt and pepper noise are mixed and superimposed to obtain the mixed noise, as shown in formula (4); (4); Step 2: Build a segmentation network that includes the ST++ semi-supervised training framework, a multi-scale feature selective fusion module, and a triple attention module; Step 3: Input the printed fabric defect dataset into the segmentation network for training and output the defect segmentation results.
[0020] Example 4 The semi-supervised printed fabric defect segmentation method based on ST++ proposed in this embodiment includes the following steps: Step 1: Collect printed fabric defect images, preprocess the images, and construct a printed fabric defect dataset; Printed fabric defect images are collected by industrial cameras; Preprocessing specifically includes: adding different degrees of Gaussian noise, salt and pepper noise, and mixed noise to the image to expand the amount of original data and achieve better noise resistance performance; Gaussian noise is specifically: Generate a random noise matrix that matches the size of the original printed fabric defect image according to the image size, as shown in formula (1); (1); in, and represent the noise matrix and the original printed fabric defect image respectively, and represents the image position, represents a normal distribution, and represents the mean and variance of the normal distribution; The noise matrix generated Superimpose the defect image on the original printed fabric On the surface, Gaussian noise is formed, as shown in formula (2); (2); in, represents matrix addition; Salt and pepper noise is specifically: Setting the signal-to-noise ratio , represents the proportion of pixels in the image to be replaced by noise, generating a random number matrix that matches the size of the original printed fabric defect image R, the range of random numbers is 0 to 1, and the random number matrix is falsified to obtain the salt and pepper noise shown in formula (3); (3); in, is the value of the random number matrix corresponding to the pixel position; The mixed noise is specifically: Gaussian noise and salt and pepper noise are mixed and superimposed to obtain the mixed noise, as shown in formula (4); (4); Step 2: Build a segmentation network that includes the ST++ semi-supervised training framework, a multi-scale feature selective fusion module, and a triple attention module; The ST++ semi-supervised training framework is as follows: First, the teacher model is trained on labeled images. Then, reliable unlabeled images selected by mIOU scores are annotated with pseudo-labels using the professor network. The academic network is trained a second time on the original and filtered images. Finally, the remaining images are pseudo-labeled and the final model training is performed on all images. The selection process of reliable unlabeled images is as follows: for an unlabeled image , using the saved Model parameters in the image The pseudo labels predicted above and The prediction results of the model parameters are used to calculate mIOU, as shown in formula (5); (5); in, We measure the unlabeled images stability and reliability, Indicates in The pseudo labels predicted based on the model parameters; Step 3: Input the printed fabric defect dataset into the segmentation network for training and output the defect segmentation results.
[0021] Example 5 The semi-supervised printed fabric defect segmentation method based on ST++ proposed in this embodiment includes the following steps: Step 1: Collect printed fabric defect images, preprocess the images, and construct a printed fabric defect dataset; Printed fabric defect images are collected by industrial cameras; Preprocessing specifically includes: adding different degrees of Gaussian noise, salt and pepper noise, and mixed noise to the image to expand the amount of original data and achieve better noise resistance performance; Gaussian noise is specifically: Generate a random noise matrix that matches the size of the original printed fabric defect image according to the image size, as shown in formula (1); (1); in, and represent the noise matrix and the original printed fabric defect image respectively, and represents the image position, represents a normal distribution, and represents the mean and variance of the normal distribution; The noise matrix generated Superimpose the defect image on the original printed fabric On the surface, Gaussian noise is formed, as shown in formula (2); (2); in, represents matrix addition; Salt and pepper noise is specifically: Setting the signal-to-noise ratio , represents the proportion of pixels in the image to be replaced by noise, generating a random number matrix that matches the size of the original printed fabric defect image R , the range of random numbers is 0 to 1, and the random number matrix is falsified to obtain the salt and pepper noise shown in formula (3); (3); in, is the value of the random number matrix corresponding to the pixel position; The mixed noise is specifically: Gaussian noise and salt and pepper noise are mixed and superimposed to obtain the mixed noise, as shown in formula (4); (4); Step 2: Build a segmentation network that includes the ST++ semi-supervised training framework, a multi-scale feature selective fusion module, and a triple attention module; The ST++ semi-supervised training framework is as follows: First, the teacher model is trained on labeled images. Then, reliable unlabeled images selected by mIOU scores are annotated with pseudo-labels using the professor network. The academic network is trained a second time on the original and filtered images. Finally, the remaining images are pseudo-labeled and the final model training is performed on all images. The selection process of reliable unlabeled images is as follows: for an unlabeled image , using the saved Model parameters in the image The pseudo labels predicted above and The prediction results of the model parameters are used to calculate mIOU, as shown in formula (5); (5); in, We measure the unlabeled images stability and reliability, Indicates in The pseudo labels predicted based on the model parameters; The multi-scale feature selective fusion module uses the MSP Block module. The MSP Block module performs weighted fusion of the global features output by the four dilated convolution branches with different dilation rates in the P1 block in different spatial and channel dimensions to achieve more stable printed fabric defect segmentation. The MSP Block module consists of four dilated convolution branches with different dilation rates and the MSF. The MSP Block module is specifically: Represents the four feature maps of the same size but different scales in the P1 Block. They are activated in the spatial dimension through global average pooling, convolution processing with a convolution kernel size of 1, and Sigmoid function to obtain the gain vector in the channel dimension, as shown in Equation (6); (6); in, Indicates the The first stage output results of each branch; The above process extracts the global representation of the spatial dimension in each branch and generates the gain vector of the channel dimension. In order to achieve multi-scale feature fusion between branches, MSF concatenates the gain features of different branches and obtains the weight representation of each branch through the Softmax function, as shown in Equation (7). (7); in, Represents the channel gain vector after interaction; Will Split into the gain vectors of each channel, multiply with the original features, and perform feature fusion, as shown in formula (8); (8); In step 2, the triple attention module adopts the TA module. The triple attention module consists of three branches with different dimensions of enhancement. The first dimension mainly performs selective feature enhancement fusion in the channel and horizontal dimensions. The second and third branches mainly perform feature fusion in the channel-vertical and spatial dimensions. The TA module is specifically as follows: In the first feature enhancement branch, Represents the output feature map, whose size is , rotate the first feature enhancement branch 90 degrees counterclockwise along the H axis to obtain , at this time the dimension of the first feature enhancement branch is converted to , perform Z-Pool aggregation in sequence The maximum pooling feature and average pooling feature representation of the dimension are concatenated to obtain , whose dimensions are , as shown in formula (9); (9); Through a convolution of size 1, Dimension is mapped to one dimension to obtain the gain vector , the gain vector Perform matrix multiplication with the original features to achieve The gain in dimension, and finally the output feature is converted into , as shown in formula (10); (10); in, represents the first feature enhancement branch; The second branch of dimension transformation is The dimension of the feature gain vector of the second branch is , output features are used Indicates that the third branch does not perform dimension conversion, and the processing process is Dimension, the output features are used express; The output features of the three dimensions are fused by adding and averaging, and the output features of the three dimensions are kept consistent with the input features in terms of dimensions, as shown in formula (11); (11); Step 3: Input the printed fabric defect dataset into the segmentation network for training and output the defect segmentation results.
[0022] Example 6 The semi-supervised printed fabric defect segmentation method based on ST++ proposed in this embodiment includes the following steps: Step 1: Collect printed fabric defect images, preprocess the images, and construct a printed fabric defect dataset; Printed fabric defect images were captured using an industrial camera. The resulting image size was 1024×1024, totaling 1120 images. These images were resized to 512×512 using OpenCV and expanded to 2560 images using rotation and translation. Preprocessing specifically includes: adding different degrees of Gaussian noise, salt and pepper noise, and mixed noise to the image, expanding the amount of original data to 4 times to achieve better noise resistance performance; Gaussian noise is specifically: Generate a random noise matrix that matches the size of the original printed fabric defect image according to the image size, as shown in formula (1); (1); in, and represent the noise matrix and the original printed fabric defect image respectively, and represents the image position, represents a normal distribution, and represents the mean and variance of the normal distribution; The noise matrix generated Superimpose the defect image on the original printed fabric On the surface, Gaussian noise is formed, as shown in formula (2); (2); in, represents matrix addition; Salt and pepper noise is specifically: Setting the signal-to-noise ratio , represents the proportion of pixels in the image to be replaced by noise, generating a random number matrix that matches the size of the original printed fabric defect image R , the range of random numbers is 0 to 1, and the random number matrix is falsified to obtain the salt and pepper noise shown in formula (3); (3); in, is the value of the random number matrix corresponding to the pixel position; The mixed noise is specifically: Gaussian noise and salt and pepper noise are mixed and superimposed to obtain the mixed noise, as shown in formula (4); (4); Step 2: Figure 1 As shown in the figure, a segmentation network is constructed that includes the ST++ semi-supervised training framework, a multi-scale feature selective fusion module, and a triple attention module; like Figure 2As shown in the figure, the most critical part of the entire training process is the screening strategy for unlabeled printed fabric images. This strategy determines the reliability of unlabeled printed fabric defect images by measuring the stability of pseudo-labels across different training processes. To make the measurement strategy more stable, ST++ quantitatively evaluates the stability of defect images based on the mIOU between the whole image and the pseudo-labels across different training rounds. The ST++ semi-supervised training framework is as follows: First, the teacher model is trained on labeled images. Then, reliable unlabeled images selected by mIOU scores are annotated with pseudo-labels using the professor network. The academic network is trained a second time on the original and filtered images. Finally, the remaining images are pseudo-labeled and the final model training is performed on all images. The selection process of reliable unlabeled images is as follows: in the first stage of training, the labeled images are pre-trained and saved. model parameters, and the quality of the model trained in the last round is higher, so for an unlabeled image , using the saved Model parameters in the image The pseudo labels predicted above and The prediction results of the model parameters are used to calculate mIOU, as shown in formula (5); (5); in, We measure the unlabeled images stability and reliability, Indicates in The pseudo labels predicted based on the model parameters; The larger the value is, the higher the overlap of the predicted pseudo labels is, and the defect image is more suitable for secondary training at this stage. The more stable the pseudo labels are during the training process, the more reliable the defect image quality is. Therefore, in the training of semantic segmentation, according to By selecting images, we can filter out images that are better than training images, thereby optimizing the training process.
[0023] like Figure 3As shown in the figure, the multi-scale feature selective fusion module uses the MSP Block module. The MSP Block module performs weighted fusion of the global features output by the four dilated convolutions with different dilation rates in the P1block across different spatial and channel dimensions to achieve more stable printed fabric defect segmentation. The MSP Block module consists of four dilated convolution branches with different dilation rates and the MSF. The feature selection branch extracts global feature gains from the original defect feature map, uses Softmax to obtain weighted representations of the feature gain vectors of the four branches, and finally multiplies them with the original feature map and concatenates them in the access dimension. The overall processing is performed in the channel dimension, amplifying valid defect feature information and effectively reducing the impact of information differences on segmentation.
[0024] The MSP Block module is specifically: Represents the four feature maps of the same size but different scales in the P1 Block. They are activated in the spatial dimension through global average pooling, convolution processing with a convolution kernel size of 1, and Sigmoid function to obtain the gain vector in the channel dimension, as shown in Equation (6); (6); in, Indicates the The first stage output results of each branch; The above process extracts the global representation of the spatial dimension in each branch and generates the gain vector of the channel dimension. In order to achieve multi-scale feature fusion between branches, MSF concatenates the gain features of different branches and obtains the weight representation of each branch through the Softmax function, as shown in Equation (7). (7); in, Represents the channel gain vector after interaction; Will Split into the gain vectors of each channel, multiply with the original features, and perform feature fusion, as shown in formula (8); (8); By introducing the Multi-Scale Feature Selection (MSF) module, we can effectively improve the performance of printed fabric defect segmentation tasks. The innovative design of the MSP Block enables the model to better retain useful information during feature extraction, minimizing information discrepancies and thus improving segmentation accuracy and model generalization capabilities.
[0025] The core of the Triple Attention Module is to enhance the model's feature extraction capabilities across different dimensions. This module consists of three branches focused on strengthening different dimensions. The first branch performs selective feature enhancement and fusion in the channel-lateral dimension, while the second and third branches perform feature fusion in the channel-vertical and spatial dimensions. This module's primary contribution is to enhance the model's ability to capture defect details, better adapt to semi-supervised training, and achieve more stable segmentation tasks.
[0026] In step 2, the triple attention module adopts the TA module. The triple attention module consists of three branches with different dimensions of enhancement. The first dimension mainly performs selective feature enhancement fusion in the channel and horizontal dimensions. The second and third branches mainly perform feature fusion in the channel-vertical and spatial dimensions. The TA module is specifically as follows: In the first feature enhancement branch, Represents the output feature map, whose size is , rotate the first feature enhancement branch 90 degrees counterclockwise along the H axis to obtain , at this time the dimension of the first feature enhancement branch is converted to , perform Z-Pool aggregation in sequence The maximum pooling feature and average pooling feature representation of the dimension are concatenated to obtain , whose dimensions are , as shown in formula (9); (9); Through a convolution of size 1, Dimension is mapped to one dimension to obtain the gain vector , the gain vector Perform matrix multiplication with the original features to achieve The gain in dimension, and finally the output feature is converted into , as shown in formula (10); (10); in, represents the first feature enhancement branch; The second branch of dimension transformation is The dimension of the feature gain vector of the second branch is , output features are used Indicates that the third branch does not perform dimension conversion, and the processing process is Dimension, the output features are used express; The output features of the three dimensions are fused by adding and averaging, and the output features of the three dimensions are kept consistent with the input features in terms of dimensions, as shown in formula (11); (11); Step 3: Input the printed fabric defect dataset into the segmentation network for training and output the defect segmentation results.
[0027] The semi-supervised comparative experiment was conducted under the ST++ framework and compared with other methods. The training parameters were kept consistent. Three rounds of training were adopted in this experiment. Each round of training epoch was set to 100, the batch size was 4, the optimizer used was the SGD optimizer, and the initial learning rate was 0. , the learning rate reduction formula is shown in formula (12).
[0028] (12); In order to verify the superiority of this method in detecting printed fabric defects under a semi-supervised strategy compared with other methods, in the above experimental environment, and Comparative experiments were conducted with labeled data, comparing methods including UNet, PSPNet, Deeplabv2, Deeplabv3, and PUNet. (A)-(D) show hair, wrinkles, stains, and ink leaks, respectively, while (a)-(c) show the original image, masked image, and image obtained with our method, respectively.
[0029] From the comparison of quantitative index evaluation, it can be seen that this method is ahead of other methods in accuracy and multi-category average accuracy, and has certain excellence. Among them, the multi-category average accuracy of the last stage of this method is 54.94%, which can basically complete the task of printed fabric defect detection and segmentation.
[0030] like Figure 4 As shown in the visualization experiment, this method leads in maintaining accurate image classification, defect shape integrity, and reducing segmentation errors. Compared with other methods, this method excels in the printed fabric defect segmentation task. Under the semi-supervised training mode, this method's mIOU performance is significantly better than other methods, reaching 54.91%, basically completing the printed fabric defect segmentation task.
[0031] In order to verify the superiority of this method in detecting printed fabric defects under supervised conditions compared with other similar methods, we used the same dataset, parameters, framework and optimizer for training and verification based on supervised comparative experiments. Figure 5 As shown in the figure, (ac) represent the defect image, segmentation mask and the present method respectively.
[0032] Under supervised conditions, this method has certain advantages over other similar methods in the segmentation of printed fabric defects. The mIOU is improved by 0.68% compared with PUNet. The segmented area is more complete and can effectively adapt to the complex diversity of printed fabrics.
[0033] This method is supervised and semi-supervised (labeled images account for 、 ) In a total of 3 cases, experiments were carried out under different conditions. The method was improved compared with UNet in semi-supervised or unsupervised conditions. For the printed fabric defect segmentation task, the improved strategy was effective and improved in the quantitative index evaluation. It is basically suitable for the printed fabric defect segmentation task with a small amount of data set.
Claims
1. A semi-supervised printed fabric defect segmentation method based on ST++, characterized by: The following steps are involved: Step 1: Collect printed fabric defect images, preprocess the images, and construct a printed fabric defect dataset; Step 2: Build a segmentation network that includes the ST++ semi-supervised training framework, a multi-scale feature selective fusion module, and a triple attention module; Step 3: Input the printed fabric defect dataset into the segmentation network for training and output the defect segmentation results.
2. The semi-supervised printed fabric defect segmentation method based on ST++ according to claim 1, characterized in that: The printed fabric defect image described in step 1 is collected by an industrial camera.
3. The semi-supervised printed fabric defect segmentation method based on ST++ according to claim 2, characterized in that: The preprocessing described in step 1 specifically includes: adding different degrees of Gaussian noise, salt and pepper noise and mixed noise to the image, expanding the amount of original data, and achieving better noise resistance performance.
4. The semi-supervised printed fabric defect segmentation method based on ST++ according to claim 3, characterized in that: The Gaussian noise is specifically: Generate a random noise matrix that matches the size of the original printed fabric defect image according to the image size, as shown in formula (1); (1); in, and represent the noise matrix and the original printed fabric defect image respectively, and represents the image position, represents a normal distribution, and represents the mean and variance of the normal distribution; The noise matrix generated Superimpose the defect image on the original printed fabric On the surface, Gaussian noise is formed, as shown in formula (2); (2); in, Represents matrix addition.
5. The semi-supervised printed fabric defect segmentation method based on ST++ according to claim 4, characterized in that: The salt and pepper noise is specifically: Setting the signal-to-noise ratio , represents the proportion of pixels in the image to be replaced by noise, generating a random number matrix that matches the size of the original printed fabric defect image R , the range of random numbers is 0 to 1, and the random number matrix is falsified to obtain the salt and pepper noise shown in formula (3); (3); in, is the value of the random number matrix corresponding to the pixel position.
6. The semi-supervised printed fabric defect segmentation method based on ST++ according to claim 5, characterized in that: The mixed noise is specifically: Gaussian noise and salt and pepper noise are mixed and superimposed to obtain mixed noise, as shown in formula (4); (4)。 7. The semi-supervised printed fabric defect segmentation method based on ST++ according to claim 6, characterized in that: The ST++ semi-supervised training framework described in step 2 is as follows: first, the teacher model is trained on the labeled images. Then, the reliable unlabeled images selected by mIOU score are annotated with pseudo labels using the professor network. The academic network is trained a second time on the original and filtered images. Finally, the remaining images are pseudo-labeled and the final model training is performed on all images. The selection process of the reliable unlabeled image is as follows: for an unlabeled image , using the saved Model parameters in the image The pseudo labels predicted above and The prediction results of the model parameters are used to calculate mIOU, as shown in formula (5); (5); in, We measure the unlabeled images stability and reliability, Indicates in The pseudo labels predicted based on the model parameters.
8. The semi-supervised printed fabric defect segmentation method based on ST++ according to claim 7, characterized in that: The multi-scale feature selective fusion module in step 2 adopts the MSP Block module, which performs weighted fusion of the global features output by the four dilated convolutions with different dilation rates in the P1 block in different dimensions of space and channels to achieve more stable printed fabric defect segmentation; the MSP Block module consists of four dilated convolution branches with different dilation rates and MSF; The MSP Block module is specifically: Represents the four feature maps of the same size but different scales in the P1 Block. They are activated in the spatial dimension through global average pooling, convolution processing with a convolution kernel size of 1, and Sigmoid function to obtain the gain vector in the channel dimension, as shown in Equation (6); (6); in, Indicates the The first stage output results of each branch; The above process extracts the global representation of the spatial dimension in each branch and generates the gain vector of the channel dimension. In order to achieve multi-scale feature fusion between branches, MSF concatenates the gain features of different branches and obtains the weight representation of each branch through the Softmax function, as shown in Equation (7). (7); in, Represents the channel gain vector after interaction; Will Split into the gain vectors of each channel, multiply with the original features, and perform feature fusion, as shown in formula (8); (8)。 9. The semi-supervised printed fabric defect segmentation method based on ST++ according to claim 8, characterized in that: The triple attention module in step 2 adopts the TA module. The triple attention module consists of three branches with different dimensions of enhancement. The first dimension mainly performs selective feature enhancement fusion in the channel and horizontal dimensions. The second and third branches mainly perform feature fusion in the channel-vertical and spatial dimensions. The TA module specifically comprises: in the first feature enhancement branch, using Represents the output feature map, whose size is , rotate the first feature enhancement branch 90 degrees counterclockwise along the H axis to obtain , at this time the dimension of the first feature enhancement branch is converted to , perform Z-Pool aggregation in sequence The maximum pooling feature and average pooling feature representation of the dimension are concatenated to obtain , whose dimensions are , as shown in formula (9); (9); Through a convolution of size 1, Dimension is mapped to one dimension to obtain the gain vector , the gain vector Perform matrix multiplication with the original features to achieve The gain in dimension, and finally the output feature is converted into , as shown in formula (10); (10); in, represents the first feature enhancement branch; The second branch of dimension transformation is The dimension of the feature gain vector of the second branch is , output features are used Indicates that the third branch does not perform dimension conversion, and the processing process is Dimension, the output features are used express; The output features of the three dimensions are fused by adding and averaging, and the output features of the three dimensions are kept consistent with the input features in terms of dimensions, as shown in formula (11); (11)。