A method of locating a textile defect

CN119444658BActive Publication Date: 2026-10-16IFLYTEK SOUTH CHINA ARTIFICIAL INTELLIGENCE RES INST GUANGZHOU CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411222564.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-02
Publication Date
2026-10-16
Estimated Expiration
2044-09-02

AI Technical Summary

Technical Problem

当前的瑕疵检测系统在处理这种高度复杂和动态变化的场景时显得力不从心

Benefits of technology

[0012] This invention provides a method for locating defects in textiles. By extracting complex features from the textile surface, such as texture, color, and shape, it improves the accuracy and robustness of defect detection. Fusion of feature maps at different scales captures various details of the defects, including local details and global layout, leading to a more comprehensive understanding of the nature and spatial distribution of defects. Fine-grained classification of defects distinguishes different types, which is crucial for subsequent processing and decision-making. A multi-task learning model can simultaneously perform defect detection, classification, and location, improving the overall system efficiency and consistency, while the backpropagation algorithm ensures model optimization and performance improvement. Precise location of defect areas, combined with edge detection, allows for the acquisition of accurate contour and size information of the defects, which is critical for subsequent evaluation. By considering the area, location, type, and combination complexity of the defects, the system can provide a comprehensive severity score, which helps in developing more reasonable quality control strategies. A dynamic threshold adjustment mechanism can adjust the defect judgment criteria in real time according to changes in production batches and product types, ensuring consistency and adaptability in detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119444658B_ABST
    Figure CN119444658B_ABST
Patent Text Reader

Abstract

The application provides a textile defect positioning method, comprising: fusing different scale feature maps according to the extracted defect feature map, extracting multi-scale defect features, and comprehensively describing the spatial distribution and combination information of the defects; for the case that multiple defects exist simultaneously, a multi-task learning model is constructed to simultaneously perform defect detection, classification and positioning tasks, and a back propagation algorithm is used to optimize the multi-task learning model; an image segmentation algorithm is used to position the defect area, the contour of the defect area is obtained according to the defect area positioning result and by using a Canny edge detection algorithm, and the defect area and position information are calculated; based on the evaluation result, a dynamic threshold adjustment algorithm is used to adjust the defect judgment threshold according to the production batch and product type, and the threshold parameter is dynamically updated by analyzing historical data and the current production situation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information technology, and in particular to a method for locating defects in textiles. Background Technology

[0002] Textile defect detection faces complex and ever-changing challenges. Current defect threshold setting methods are overly simplistic and cannot effectively handle the multiple combinations of defects that may simultaneously exist on textile surfaces. These defects may include fiber breaks, stains, color differences, etc., and vary in type and severity. Traditional detection techniques struggle to accurately identify and classify these complex defect combinations, resulting in inaccurate detection results. A deeper problem lies in the complex formation mechanisms of defects during textile production, influenced by multiple factors such as raw materials, processes, and the environment. Different types of defects may present similar visual characteristics, while defects of the same type may exhibit different appearances depending on their severity. This high degree of complexity and variability makes establishing a unified defect classification standard extremely difficult. Furthermore, the diversity of textile surface textures further increases the difficulty of defect detection. Different fabric structures, fiber materials, and surface treatment processes produce various unique texture features, which may visually interfere with certain defects. How to accurately identify and locate defects in complex background textures, while avoiding misjudging normal textures as defects, is a pressing technical challenge that needs to be solved. Current defect detection systems fall short in handling such highly complex and dynamically changing scenarios. Developing an intelligent detection system capable of adapting to diverse combinations of defects, accurately identifying different types and degrees of defects, and precisely locating defects in complex environments is a major challenge facing the field of textile quality control. Summary of the Invention

[0003] This invention provides a method for locating defects in textiles, mainly including:

[0004] Deep learning convolutional neural networks are used to extract features from textile images. Through multi-layer convolution and pooling operations, texture, color and shape features of the textile surface are extracted to obtain feature maps containing defect information.

[0005] Based on the extracted defect feature maps, feature maps of different scales are fused to extract multi-scale defect features and comprehensively depict the spatial distribution and combination information of defects.

[0006] Hierarchical clustering algorithm is used to classify multi-scale defect features in a fine-grained manner. By calculating the similarity between defect features, defects with similarity greater than a preset threshold are clustered into the same category to obtain the defect classification result.

[0007] To address the situation where multiple defects coexist, a multi-task learning model is constructed to simultaneously perform defect detection, classification, and localization tasks. The backpropagation algorithm is then used to optimize the multi-task learning model.

[0008] Image segmentation algorithms are used to locate the defective areas. Based on the location results and the Canny edge detection algorithm, the outline of the defective areas is obtained, and the defect area and location information are calculated.

[0009] Based on the area, location, and type information of the defective area, and combined with the results of defect combination complexity analysis, a defect severity assessment model is constructed. The defect combination complexity analysis is quantified by combining the spatial distribution, overlap, and type combination of multiple defects. By establishing scoring rules, different weights are assigned to different defect combinations, and a comprehensive score is calculated to obtain the defect severity assessment result.

[0010] Based on the evaluation results, a dynamic threshold adjustment algorithm is adopted to adjust the defect judgment threshold according to the production batch and product type. The threshold parameters are dynamically updated by analyzing historical data and current production conditions.

[0011] The technical solutions provided by the embodiments of the present invention may include the following beneficial effects:

[0012] This invention provides a method for locating defects in textiles. By extracting complex features from the textile surface, such as texture, color, and shape, it improves the accuracy and robustness of defect detection. Fusion of feature maps at different scales captures various details of the defects, including local details and global layout, leading to a more comprehensive understanding of the nature and spatial distribution of defects. Fine-grained classification of defects distinguishes different types, which is crucial for subsequent processing and decision-making. A multi-task learning model can simultaneously perform defect detection, classification, and location, improving the overall system efficiency and consistency, while the backpropagation algorithm ensures model optimization and performance improvement. Precise location of defect areas, combined with edge detection, allows for the acquisition of accurate contour and size information of the defects, which is critical for subsequent evaluation. By considering the area, location, type, and combination complexity of the defects, the system can provide a comprehensive severity score, which helps in developing more reasonable quality control strategies. A dynamic threshold adjustment mechanism can adjust the defect judgment criteria in real time according to changes in production batches and product types, ensuring consistency and adaptability in detection. Attached Figure Description

[0013] Figure 1 This is a flowchart of a method for locating defects in textiles according to the present invention.

[0014] Figure 2 This is a schematic diagram of a method for locating textile defects according to the present invention.

[0015] Figure 3 This is another schematic diagram of a method for locating textile defects according to the present invention. Detailed Implementation

[0016] To further understand the content of this invention, a detailed description of the invention is provided in conjunction with the accompanying drawings and embodiments. The specific embodiments described herein are for illustrative purposes only and are not intended to limit the invention. It should also be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.

[0017] like Figure 1 -3. In this embodiment, a method for locating textile defects may specifically include:

[0018] S101. Deep learning convolutional neural networks are used to extract features from textile images. Through multi-layer convolution and pooling operations, texture, color and shape features of the textile surface are extracted to obtain feature maps containing defect information.

[0019] Textile images are acquired, and ResNet50 convolutional neural networks are used to extract texture, color, and shape features from the textile image surface, resulting in a feature map containing defect information. Image segmentation is performed based on the feature map, dividing it into multiple regions using the Otsu algorithm. Each region represents a local feature of the textile surface. For each of these regions, a gray-level co-occurrence matrix, color histogram, and color moments are calculated to construct a feature vector for that local textile region. This feature vector reflects the fine structure, statistical characteristics, and color distribution of the texture within the region. A random forest algorithm is used to classify the feature vectors. If a feature vector meets a preset condition for a normal region, it is classified as a normal region; if it meets a preset condition for a defective region, it is classified as a defective region. Morphological operations are performed on the classification results to remove noise, resulting in a distribution map of defects on the textile surface. This distribution map marks the location and type of defects. The defect distribution map is overlaid on the textile image to generate a visualization showing the distribution of defects on the textile surface.

[0020] For example, a ResNet50 convolutional neural network is used to extract features from textile images. Through multi-layer convolution and pooling operations, texture, color, and shape features of the textile surface are extracted, resulting in a feature map containing defect information. This feature map reflects anomalies such as fiber breakage, stains, and color differences on the textile surface. Image segmentation is then performed on the feature map, using the Otsu algorithm to divide it into multiple regions. Each region represents a local feature of the textile surface, with region boundaries corresponding to texture edges or color variations. For each segmented region, a gray-level co-occurrence matrix is ​​calculated for each of the RGB channels. Statistical features such as contrast, entropy, and energy are extracted from the co-occurrence matrix. Simultaneously, a color histogram and color moments are calculated to construct a feature vector for the local textile region. This feature vector reflects the fine structure, statistical characteristics, and color distribution of the texture within the region. A random forest algorithm is then used to classify the feature vector, dividing the textile surface into normal and defective regions. Defective regions are further subdivided into specific types such as fiber breakage, stains, and color differences. Morphological operations are performed on the classification results to remove noise, resulting in a distribution map of surface defects on the textile, which marks the location and type of defects. This defect distribution map is then overlaid on the original textile image to generate a visualization, visually showing the distribution of defects on the textile surface. Based on a ResNet50 convolutional neural network, a 50-layer network structure is constructed, including convolutional layers, pooling layers, and fully connected layers. The input textile image is 224x224x3 pixels. After multiple convolution and pooling operations, a 7x7x2048 feature map is finally obtained. This feature map reflects the texture, color, and shape features of the textile surface, including defect information such as fiber breakage, stains, and color differences. The Otsu algorithm is applied to the feature map for image segmentation, automatically calculating the optimal threshold to divide the image into foreground and background. For RGB images, Otsu segmentation is performed on each of the three channels, resulting in multiple local regions. For each segmented region, a gray-level co-occurrence matrix (COM) is calculated, with a distance parameter d = 1 and direction angles of 0°, 45°, 90°, and 135°. COM matrices are calculated for each of the four directions. Statistical features such as contrast, entropy, and energy are extracted from the COM, and color histograms and color moments are calculated simultaneously. The color histogram statistically analyzes the pixel value distribution across the RGB channels, with each channel divided into 16 bins. Color moment calculations include first-order moments (regarding the mean), second-order moments (regarding the variance), and third-order moments (regarding the skewness). These features are combined into a feature vector reflecting the texture structure, statistical characteristics, and color distribution within the region. A random forest algorithm is used for classification, with 100 decision trees and a maximum depth of 10. The textile surface is divided into normal and defective regions, with defective regions further subdivided into types such as fiber breakage, stains, and color differences. Morphological operations are applied to the classification results to remove noise, using 3x3 structuring elements for opening and closing operations to obtain a smooth defect distribution map.Finally, the defect distribution map is overlaid with the original textile image, and different colors are used to mark different types of defects to generate an intuitive visualization that shows the specific distribution of defects on the textile surface.

[0021] S102. Based on the extracted defect feature maps, feature maps of different scales are fused to extract multi-scale defect features and comprehensively depict the spatial distribution and combination information of defects.

[0022] A pyramid pooling operation is applied to the defect feature map for multi-scale transformation, resulting in a feature pyramid with four levels. For each level of the feature pyramid, multi-scale convolutional kernels are used in parallel to extract features, obtaining defect texture and shape information at different scales. The multi-scale features are adaptively weighted and fused according to a feature channel attention mechanism, and the importance weight of each feature channel is obtained through global average pooling and fully connected layers. Non-maximum suppression is applied to the fused feature map; if the search window size is 5x5 and the threshold is 0.5, local maximum response points are retained. The area ratio and clustering degree of the defect regions are calculated to determine the spatial distribution and quantitative description of the combination information of the defects.

[0023] For example, pyramid pooling is used to perform multi-scale transformation on the defect feature map. A four-layer feature pyramid is set, with each layer having a size of 1 / 1, 1 / 2, 1 / 4, and 1 / 8 of the original image, generating feature representations at different resolutions from the original feature map, resulting in multi-scale features containing both global information and local details. For each layer of the feature pyramid, 3x3, 5x5, and 7x7 multi-scale convolutional kernels are used in parallel for feature extraction, capturing the texture and shape information of the defect at different scales. Features at different scales are then concatenated through channel dimensions. An adaptive weighted fusion of multi-scale features is performed using a feature channel attention mechanism. First, global average pooling is applied to the feature map. Then, dimensionality reduction and expansion are performed through fully connected layers. Finally, the softmax function is used to calculate the importance weight of each feature channel, enhancing key feature channels and suppressing unimportant ones, resulting in a fused multi-scale defect feature map. Non-maximum suppression is applied to the fused feature map, setting the search window size to 5x5 and the threshold to 0.5, preserving local maximum response points, and upsampling the feature map to the original image size using bilinear interpolation. The area ratio and clustering degree of defective regions are calculated to quantitatively describe the spatial distribution and combination of defects. A 5-fold cross-validation method is used to evaluate the effect of multi-scale feature fusion, resulting in a final feature map that comprehensively depicts the spatial distribution and combination of defects. For textile defect detection, a four-layer feature pyramid is first constructed. The original input image size is 640x640 pixels. After pyramid pooling, multi-scale feature maps of 640x640, 320x320, 160x160, and 80x80 are obtained. For each feature map layer, 3x3, 5x5, and 7x7 convolutional kernels are applied in parallel with a stride of 1, and padding is used to maintain the output size. Taking a 320x320 feature map as an example, the three convolutional kernels generate feature maps of 320x320x64, 320x320x128, and 320x320x256 respectively, which are then concatenated along the channel dimension to obtain a 320x320x448 multi-scale feature map. Channel attention is applied to the concatenated features. First, global average pooling is performed to obtain a 1x1x448 vector. This vector is then passed through two fully connected layers (448→224→448) and a ReLU activation function, and finally, softmax is applied to obtain 448 channel weights. The weights are multiplied by the original features to obtain a weighted, fused multi-scale feature map. Non-maximum suppression is applied to the fused feature map using a 5x5 sliding window with a threshold of 0.5, preserving local maxima. The feature map is upsampled to 640x640 using bilinear interpolation. The defect area ratio is calculated; assuming a threshold of 0.3, the number of pixels above the threshold is divided by the total number of pixels to obtain the defect area ratio. The DBSCAN algorithm is used to calculate the defect clustering degree, with a neighborhood radius of 10 pixels and a minimum sample size of 5.Finally, 5-fold cross-validation was used to evaluate the model performance. The dataset was randomly divided into 5 parts, and 4 parts were used for training and 1 part for testing in turn. The average accuracy, recall and F1 score were calculated.

[0024] S103. A hierarchical clustering algorithm is used to perform fine-grained classification of multi-scale defect features. By calculating the similarity between defect features, defects with similarity greater than a preset threshold are clustered into the same category to obtain the defect classification result.

[0025] Based on multi-scale defect features, a similarity matrix is ​​calculated between defect features to obtain similarity values. A similarity threshold is set, and defect features with similarity greater than the threshold are grouped into the same category to form a preliminary classification result. The minimum distance method is used to calculate the distance between each category to generate a category distance matrix. Based on the category distance matrix, categories with distances less than a set value are merged to update the defect classification result. The center feature vector of each category is obtained by calculating the coordinates of the center point of each category. The distance between each center feature vector is judged, and if the distance is less than a set threshold, the corresponding categories are merged. Based on the merged categories, the defect classification result is updated to obtain a fine-grained multi-scale defect classification. A voting mechanism is used to determine the category of each defect feature and identify its fine-grained category. Based on the defect feature distribution of the fine-grained categories, a feature template for each category is generated to complete the fine-grained classification of multi-scale defects.

[0026] For example, firstly, based on the multi-scale defect features, the cosine similarity calculation method is used to calculate the similarity between different defect features, resulting in a similarity matrix. For instance, for two defect feature vectors A and B, the cosine similarity can be expressed as cos(A, B) = (A·B) / (||A||*||B||), where ||A|| and ||B|| represent the magnitudes of vectors A and B, respectively. Then, a similarity threshold of 8 is set, and defect features with similarity greater than 8 are grouped into the same category, forming a preliminary classification result. Next, the minimum distance method is used to calculate the distance between each category, generating a category distance matrix. For instance, for two categories C1 and C2, their distance can be expressed as d(C1, C2) = min{d(x, y)|x∈C1, y∈C2}, where d(x, y) represents the Euclidean distance between feature vectors x and y. Based on the category distance matrix, categories with a distance less than 5 are merged, updating the defect classification result. The central feature vector of each category is obtained by calculating the coordinates of the center point of each category. For example, for category C, its central feature vector can be represented as c = (1 / |C|) * ∑{x|x∈C}, where |C| represents the number of feature vectors in category C. The distance between each central feature vector is determined. If the distance is less than a set threshold of 3, the corresponding categories are merged. Based on the merged categories, the defect classification results are updated to obtain a fine-grained multi-scale defect classification. A voting mechanism is used to determine the category of each defect feature and its corresponding fine-grained category. Specifically, for each defect feature, its distance to the central feature vectors of each category is calculated, and it is assigned to the category with the smallest distance. Finally, a feature template for each category is generated based on the defect feature distribution of the fine-grained categories. For example, for category C, its feature template can be represented as t = (1 / |C|) * ∑{x|x∈C}, where |C| represents the number of feature vectors in category C. Through the above steps, fine-grained classification of multi-scale defects is completed, which can effectively identify and distinguish different types of defects, providing an important basis for subsequent defect detection and quality control.

[0027] S104. For situations where multiple defects coexist, a multi-task learning model is constructed to simultaneously perform defect detection, classification, and localization tasks. The backpropagation algorithm is used to optimize the multi-task learning model.

[0028] Textile images are acquired, and multi-scale features of the textile images are extracted using a residual network structure to obtain feature maps containing defect information. Three task branches are constructed based on the feature maps, which are used for defect detection, defect classification, and defect localization, respectively. A multi-task loss function is generated for each of the three task branches, comprising defect detection loss, defect classification loss, and defect localization loss. A comprehensive loss function is determined by adjusting the weight coefficients; this comprehensive loss function is a weighted average of the defect detection loss, defect classification loss, and defect localization loss. The multi-task learning model is optimized using a backpropagation algorithm. If the parameters of the multi-task learning model need to be updated, the Adam optimizer is used to update the parameters of the multi-task learning model.

[0029] For example, a shared underlying network is constructed for the multi-task learning model. A 50-layer residual network structure is used to extract multi-scale features from textile images. Each residual block contains two 3x3 convolutional layers and one short-circuit connection. Multiple convolutional and pooling operations are used to obtain feature maps containing defect information. Three task branches are generated on top of the shared underlying network for defect detection, defect classification, and defect localization. The defect detection branch contains two fully connected layers and outputs a binary classification result; the defect classification branch uses global average pooling and one fully connected layer to output a multi-label classification result; the defect localization branch uses five transposed convolutional layers to generate a localization heatmap of the same size as the input image. A multi-task loss function is generated: binary cross-entropy loss is used for defect detection, multi-label soft boundary loss is used for defect classification, and pixel-level mean squared error loss is used for defect localization. By adjusting the weight coefficients α, β, and γ to balance the contributions of the three tasks, a comprehensive loss function L = αL_detection + βL_classification + γL_localization is obtained. The backpropagation algorithm was used to optimize the multi-task learning model. The gradient of the loss function with respect to the parameters of each layer was calculated, and the parameters were updated using the Adam optimizer. The initial learning rate was set to 0.001, decaying by 10% every 50 epochs. The batch size was 32, and the training was iterated for 300 epochs to obtain a comprehensive model capable of simultaneously handling multiple defect detection, classification, and localization. In the detection of multiple defects in textiles, a 50-layer residual network was used as the shared bottom layer network. The input image was 224x224x3, which passed through 16 residual blocks. Each residual block contained two 3x3 convolutional layers and a short-circuit connection, finally yielding a 14x14x2048 feature map. Based on this, three task branches are generated: the defect detection branch uses two fully connected layers, such as 2048-512-2, to output a binary classification result of normal / defect; the defect classification branch first performs global average pooling to obtain a 2048-dimensional vector, and then outputs a multi-label classification result of 10 types of defects through a fully connected layer; the defect localization branch uses 5 layers of transposed convolutions, kernel_size=4, stride=2, padding=1, to generate a 224x224 localization heatmap. In the loss function generation, the defect detection task uses binary cross-entropy loss, the defect classification task uses multi-label soft-boundary loss, and the defect localization task uses pixel-level mean squared error loss, with weight coefficients set to α=0.3, ...

[0030] β = 0.5, γ = 0.2. The Adam optimizer was used with an initial learning rate of 0.001, decaying by 10% every 50 epochs, and a batch size of 32. After 300 epochs of training on a dataset containing 10,000 labeled textile images, the validation set accuracy reached 98.5%, with a mean precision (mAP) of 0.92 and a mean intersection-over-union (mIoU) of 0.85. The model can simultaneously detect multiple defects, such as identifying holes, stains, and wrinkles in a single image and accurately locating their positions.

[0031] S105. The defect area is located using an image segmentation algorithm. Based on the defect area location result and the Canny edge detection algorithm, the outline of the defect area is obtained, and the defect area and location information are calculated.

[0032] A fully convolutional network with a U-Net structure is used to perform pixel-level segmentation on the textile image to obtain a segmentation prediction map. A spatial attention module is constructed based on the segmentation prediction map to compress the channel dimension of the feature map and obtain spatial attention weights. The attention weights are multiplied by the segmentation prediction map to obtain an optimized defect region localization result. Based on the defect region localization result, the Canny edge detection algorithm is used to extract the contour of the defect region. The contour is optimized through opening and closing operations to obtain the boundary of the defect region. The defect area is calculated based on the boundary of the defect region, and the defect area is obtained by pixel counting. The center coordinates of the defect region are calculated using central moments, and the shape features of the defect are described using Hu invariant moments. If the intersection-union ratio (IU / U) of the segmentation result is greater than a preset threshold and the Dice coefficient is greater than a preset threshold, the segmentation result is considered reliable.

[0033] For example, a fully convolutional network with a U-Net structure is used to perform pixel-level segmentation of textile images. Image features are extracted through a 4-layer encoder and a 4-layer decoder to obtain a segmentation prediction map with the same size as the original image. A spatial attention module is constructed to compress the channel dimension of the feature map, calculate the spatial dimension attention weights, and enhance the features of defect regions, increasing the model's attention to defect regions. The attention weights are multiplied by the segmentation prediction map to obtain the optimized defect region localization result. Post-processing is performed on the optimized localization result. The Canny edge detection algorithm is used to extract the precise contour of the defect region, and the contour shape is optimized through opening and closing operations to obtain the precise boundary of the defect region. Based on the precise contour of the defect region, the defect area and location information are calculated. The defect area is obtained by pixel counting, the center coordinates of the defect region are calculated using central moments, and the shape features of the defect are described using Hu invariant moments to obtain the location and shape information of the defect. The intersection-union ratio (IU / U) and Dice coefficient of the segmentation result are calculated to evaluate the accuracy of defect region localization. The IU threshold is set to 0.7, and the Dice coefficient threshold is set to 0.8 to determine the reliability of the segmentation result. In textile defect detection, a fully convolutional network with a U-Net structure is used for pixel-level segmentation. The input image is 512x512, processed by a 4-layer encoder (each layer containing two 3x3 convolutions and a 2x2 max pooling operation) and a 4-layer decoder (each layer containing a 2x2 deconvolution and two 3x3 convolutions), ultimately outputting a 512x512 segmentation prediction map. A spatial attention module compresses the feature map's channel dimension, using a 1x1 convolution to reduce the number of channels from 512 to 1, and then uses a sigmoid function to obtain spatial attention weights. Multiplying these attention weights by the segmentation prediction map yields the optimized defect region localization result. The Canny edge detection algorithm is used to extract the defect contour, followed by 3x3 kernel opening and closing operations to optimize the contour shape. The low threshold is 30, and the high threshold is 90. The defect area is obtained by pixel counting, with units of square pixels. The center coordinates (x, y) of the defect region are calculated using central moments, and the defect shape is described using seven Hu invariant moments. Finally, the Intersection over Union (IoU) and Dice coefficient of the segmentation results were calculated: IoU = intersection area / union area, Dice = 2 * intersection area / (predicted area + actual area). On 1000 test images, the average IoU reached 0.85, and the average Dice coefficient was 0.92, demonstrating the effectiveness of this method in accurately locating defects in textiles.

[0034] S106. Based on the area, location, and type information of the defective region, and combined with the results of the defect combination complexity analysis, a defect severity assessment model is constructed. The defect combination complexity analysis is quantified by combining the spatial distribution, overlap, and type combination of multiple defects. By establishing scoring rules, different weights are assigned to different defect combinations, and a comprehensive score is calculated to obtain the defect severity assessment result.

[0035] The process involves: acquiring information on the area, location, and type of defective regions to construct a basic defect attribute dataset; calculating the defect combination complexity based on the spatial distribution, overlap, and type combinations of defects; constructing a defect severity assessment model using the basic defect attribute dataset and the defect combination complexity; assigning different weights to different defect combinations by establishing scoring rules and calculating a comprehensive score; obtaining the defect severity assessment result based on the comprehensive score; triggering a defect alarm mechanism if the defect severity assessment result exceeds a preset threshold; generating a defect analysis report based on the defect severity assessment result and the defect alarm mechanism; transmitting the defect analysis report to the quality management system to update the defect database; and optimizing the defect severity assessment model and scoring rules based on the updated defect database.

[0036] For example, firstly, image processing techniques are used to segment and extract features from the product surface image to obtain basic attribute information such as the area, location coordinates, and type of defective areas, constructing a defect basic attribute dataset. For instance, defective areas are extracted using a threshold segmentation algorithm, pixel areas are calculated, and defect types are identified based on features such as grayscale, texture, and shape. Then, based on the spatial distribution, overlap, and type combinations of defects on the product surface, the defect combination complexity is calculated. The complexity considers factors such as the number, density, and diversity of defects, and a complexity evaluation function is designed to obtain a quantitative complexity value. Based on this, machine learning algorithms such as decision trees and support vector machines are used, with defect basic attributes and combination complexity as input, to establish a defect severity assessment model. Through data analysis, scoring rules are formulated, and corresponding weight coefficients are assigned to different defect combinations. A weighted average is calculated to obtain a comprehensive score, which serves as a quantitative indicator of defect severity. Based on a pre-set threshold, it is determined whether the defect severity exceeds the standard; if it does, an alarm mechanism is triggered, generating a warning message. Finally, by integrating the defect assessment results and alarm information, a defect analysis report is automatically generated, including a defect distribution map, severity level, root cause analysis, and improvement suggestions. This analysis report is then transmitted to the quality management system to update the defect database and accumulate a large amount of real-world case data. Data mining techniques are used to analyze the correlation rules between defects and influencing factors, optimize the assessment model and scoring rules, and continuously improve the accuracy and reliability of defect assessment, providing data support for product quality improvement.

[0037] S107. Based on the evaluation results, a dynamic threshold adjustment algorithm is adopted to adjust the defect judgment threshold according to the production batch and product type. The threshold parameters are dynamically updated by analyzing historical data and current production conditions.

[0038] Obtain defect assessment results for different production batches and product types. Calculate the average severity and standard deviation of each defect type using an exponentially weighted moving average method to obtain statistical indicators reflecting batch and product characteristics. Based on these statistical indicators, acquire defect assessment results and production parameters for the current production batch hourly, including defect type distribution, severity distribution, and production environment data. Store this data in a time-series database. Calculate a dynamic threshold adjustment factor using a sliding window algorithm, combining the statistical indicators and the data in the time-series database. If the dynamic threshold adjustment factor has been calculated, obtain a defect judgment threshold adapted to the current production situation according to the formula New_Threshold = Base_Threshold * (1 + Adjustment_Factor), where New_Threshold is the new threshold, Base_Threshold is the base threshold, and Adjustment_Factor is the adjustment factor. Determine whether the production environment data exceeds a preset range. If it does, trigger an alarm and suspend the use of the defect judgment threshold, using a preset fixed threshold for judgment.

[0039] For example, a historical data analysis module is constructed to statistically analyze the defect assessment results of different production batches and product types. An exponentially weighted moving average method is used to calculate the average severity and standard deviation of each type of defect, obtaining statistical indicators reflecting the characteristics of the batch and product. A real-time data acquisition module is constructed to acquire the defect assessment results and production parameters of the current production batch hourly, including defect type distribution, severity distribution, and production environment data. This data is stored in a time-series database to form a dataset of real-time production conditions. A sliding window algorithm is used, with a window size of 24 hours and a sliding step of 1 hour. Combining historical statistical indicators and real-time data, a dynamic threshold adjustment factor is calculated. The threshold adjustment formula is New_Threshold = Base_Threshold * (1 + Adjustment_Factor). The baseline threshold is adjusted according to the characteristics of the current production batch to obtain a defect judgment threshold adapted to the current production situation. A threshold update mechanism is established to evaluate the effect of the threshold adjustment daily. By calculating the F1 score and comparing the judgment accuracy before and after the adjustment, the threshold parameters are fine-tuned, and the new threshold parameters are fed back to the database, realizing dynamic updating and optimization of the threshold. For different product types, independent threshold parameter sets are maintained, and the appropriate threshold set is selected and adjusted based on the product type identifier. An anomaly detection mechanism is set up; when production environment parameters exceed preset ranges, an alarm is triggered, and the use of dynamic thresholds is suspended, switching to preset fixed thresholds for judgment until the production environment returns to normal. In the dynamic threshold adjustment process for textile defect detection, historical data is first analyzed. For example, for stains and defects of a certain product type, the average severity is calculated using the exponentially weighted moving average method, resulting in an average severity of 0.65 and a standard deviation of 0.08. The real-time data acquisition module collects data hourly; for example, at a certain time point, stains and defects account for 30%, with an average severity of 0.72. A 24-hour sliding window with a 1-hour step is used, calculating an adjustment factor of 0.15. The baseline threshold is adjusted from 0.6 to 0.69. Threshold evaluation is performed daily at 23:59, and the F1 score increases from 0.82 to 0.88, confirming the effectiveness of the threshold adjustment. For different product types, the stain threshold is 0.69 for product A and 0.73 for product B. The anomaly detection mechanism detects a sudden temperature rise from the normal 25℃ to 35℃, triggering an alarm and switching to a fixed threshold of 0.65. The entire process is automated, requiring no manual intervention, and achieves real-time and precise adjustment of the defect judgment threshold.

[0040] The above embodiments are merely one of the preferred embodiments of the present invention and should not be used to limit the scope of protection of the present invention. Any modifications or refinements made to the main design concept and spirit of the present invention that are not of substantial significance, but solve the same technical problem as the present invention, should be included within the scope of protection of the present invention.

Claims

1. A method for locating defects in textiles, characterized in that, The method includes: Deep learning convolutional neural networks are used to extract features from textile images. Through multi-layer convolution and pooling operations, texture, color and shape features of the textile surface are extracted to obtain feature maps containing defect information. Based on the extracted defect feature maps, feature maps of different scales are fused to extract multi-scale defect features and comprehensively depict the spatial distribution and combination information of defects. Hierarchical clustering algorithm is used to classify multi-scale defect features in a fine-grained manner. By calculating the similarity between defect features, defects with similarity greater than a preset threshold are clustered into the same category to obtain the defect classification result. To address the situation where multiple defects coexist, a multi-task learning model is constructed to simultaneously perform defect detection, classification, and localization tasks. The backpropagation algorithm is used to optimize the multi-task learning model. The localization branch of the multi-task learning model uses five layers of transposed convolution to generate a localization heatmap of the same size as the input image. Image segmentation algorithms are used to locate the defective areas. Based on the location results and the Canny edge detection algorithm, the outline of the defective areas is obtained, and the defect area and location information are calculated. Based on the area, location, and type information of the defective areas, a defect basic attribute dataset is constructed. Based on the spatial distribution, overlap, and type combination of defects, the defect combination complexity is calculated. Using the defect basic attribute dataset and the defect combination complexity, a defect severity assessment model is constructed. By establishing scoring rules, different weights are assigned to different defect combinations, and a comprehensive score is calculated to obtain the defect severity assessment result. If the defect severity assessment result exceeds a preset threshold, a defect alarm mechanism is triggered. Based on the defect severity assessment result and the defect alarm mechanism, a defect analysis report is generated. The defect analysis report is transmitted to the quality management system to update the defect database. Based on the updated defect database, the defect severity assessment model and scoring rules are optimized. Based on the evaluation results, a dynamic threshold adjustment algorithm is adopted to adjust the defect judgment threshold according to the production batch and product type. The threshold parameters are dynamically updated by analyzing historical data and current production conditions. Specifically, the adjustment of the defect judgment threshold requires obtaining defect evaluation results for different production batches and product types. An exponentially weighted moving average method is used to calculate the average severity and standard deviation of each type of defect as statistical indicators. The defect type distribution of the current production batch is obtained hourly. Severity distribution and production environment data are stored in a time-series database. A dynamic threshold adjustment factor is calculated by combining statistical indicators and time-series database data using a sliding window algorithm. The new threshold is obtained according to the formula New_Threshold=Base_Threshold(1+Adjustment_Factor). If the production environment data exceeds the preset range, an alarm is triggered and the use of the dynamic threshold is suspended. Instead, a preset fixed threshold is used for judgment. Here, New_Threshold is the new threshold, Base_Threshold is the base threshold, and Adjustment_Factor is the adjustment factor.

2. The method according to claim 1, wherein, The method employs a deep learning convolutional neural network to extract features from textile images. Through multi-layer convolution and pooling operations, it extracts texture, color, and shape features from the textile surface, obtaining a feature map containing defect information, including: Textile images are acquired, and ResNet50 convolutional neural networks are used to extract the texture, color, and shape features of the textile image surface to obtain a feature map containing defect information. Image segmentation is performed based on the feature map, and the feature map is divided into multiple regions using the Otsu algorithm. Each region represents a local feature of the textile surface. For each of the multiple regions, a gray-level co-occurrence matrix, a color histogram, and color moments are calculated to construct a feature vector for a local region of the textile. The feature vector reflects the fine structure, statistical characteristics, and color distribution of the texture within the region. The feature vectors are classified using the random forest algorithm. If a feature vector meets the preset normal region conditions, it is determined to be a normal region. If the feature vector satisfies the preset defect region conditions, it is determined to be a defect region; Morphological operations are performed on the classification results to remove noise and obtain a distribution map of surface defects in textiles. The distribution map marks the location and type of defects. The distribution map of the defects is overlaid with the image of the textile to generate a visualization that shows the distribution of defects on the surface of the textile.

3. The method according to claim 1, wherein, The process involves fusing feature maps of different scales based on the extracted defect feature maps to extract multi-scale defect features, comprehensively depicting the spatial distribution and combination information of defects, including: The defect feature map is transformed by pyramid pooling to obtain a feature pyramid with four levels. For each feature map in the feature pyramid, multi-scale convolution kernels are used in parallel to extract features and obtain defect texture and shape information at different scales. The multi-scale defect features are adaptively weighted and fused according to the feature channel attention mechanism, and the importance weight of each feature channel is obtained by global average pooling and fully connected layer processing. Non-maximum suppression is applied to the fused feature map. If the search window size is 5x5 and the threshold is 0.5, local maximum response points are retained. Calculate the area ratio and clustering degree of the defective regions to determine a quantitative description of the spatial distribution and combination information of the defects.

4. The method according to claim 1, wherein, The hierarchical clustering algorithm is used to perform fine-grained classification of multi-scale defect features. By calculating the similarity between defect features, defects with similarity greater than a preset threshold are clustered into the same category to obtain defect classification results, including: Based on the multi-scale defect features, calculate the similarity matrix between the defect features to obtain the similarity values; Set a similarity threshold, and classify the flaw features that are more similar than the threshold into the same category to form a preliminary classification result; The minimum distance method is used to calculate the distance between each category and generate a category distance matrix; Based on the category distance matrix, categories with a distance less than a set value are merged, and the defect classification results are updated. By calculating the coordinates of the center point of each category, the center feature vector of each category is obtained; Determine the distance between each central feature vector; if the distance is less than a set threshold, merge the corresponding categories. Based on the merged categories, update the defect classification results to obtain a fine-grained multi-scale defect classification. A voting mechanism is used to classify each defect feature and determine its fine-grained category. Based on the defect feature distribution of fine-grained categories, feature templates for each category are generated to complete the fine-grained classification of multi-scale defects.

5. The method according to claim 1, wherein, To address the situation where multiple defects coexist, a multi-task learning model is constructed to simultaneously perform defect detection, classification, and localization tasks. The backpropagation algorithm is used to optimize the multi-task learning model, including: A textile image is acquired and a residual network structure is used to extract multi-scale defect features from the textile image to obtain a feature map containing defect information. Three task branches are constructed based on the feature map, and the three task branches are used for defect detection, defect classification and defect localization, respectively. A multi-task loss function is generated for the three task branches, and the multi-task loss function includes defect detection loss, defect classification loss and defect localization loss. The comprehensive loss function is determined by adjusting the weighting coefficients. The comprehensive loss function is composed of a weighted average of the defect detection loss, the defect classification loss, and the defect location loss. The backpropagation algorithm is used to optimize the multi-task learning model. If the parameters of the multi-task learning model need to be updated, the Adam optimizer is used to update the parameters of the multi-task learning model.

6. The method according to claim 1, wherein, The process involves using an image segmentation algorithm to locate the defective region, obtaining the contour of the defective region based on the location result and the Canny edge detection algorithm, and calculating the defect area and location information, including: A fully convolutional network with a U-Net structure is used to perform pixel-level segmentation on the textile image to obtain a segmentation prediction map. A spatial attention module is constructed based on the segmentation prediction map, and the channel dimension of the feature map is compressed to obtain the attention weights in the spatial dimension. Multiply the attention weights by the segmentation prediction map to obtain the optimized defect region localization result; Based on the defect area location results, the Canny edge detection algorithm is used to extract the contour of the defect area, and the contour is optimized by opening and closing operations to obtain the boundary of the defect area; The defect area is calculated based on the boundary of the defective region, and the defect area is obtained by pixel counting; The center coordinates of the defective region are calculated using the central moment, and the shape characteristics of the defect are described using Hu invariant moments. If the intersection-union ratio of the segmentation result is greater than a preset threshold and the Dice coefficient is greater than a preset threshold, then the segmentation result is determined to be reliable.

Citation Information

Patent Citations

  • Semi-supervised industrial product flaw detection method and system based on positive sample learning

    CN112801962A

  • Textile defect detection method based on deep learning

    CN115511796A