A machine vision textile defect detection method

By initializing the machine vision system and using deep learning algorithms, combined with support vector machine classification, the problem of balancing accuracy and efficiency in textile defect detection was solved. This enabled flexible detection of both high-end and ordinary textiles, improving detection accuracy and efficiency, and enhancing the level of automation.

CN119323543BActive Publication Date: 2025-11-18IFLYTEK SOUTH CHINA ARTIFICIAL INTELLIGENCE RES INST GUANGZHOU CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411177179.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2025-11-18
Estimated Expiration
2044-08-26

AI Technical Summary

Technical Problem

Existing textile defect detection systems struggle to balance accuracy and efficiency when inspecting both high-end and ordinary textiles. In particular, there is a conflict between model complexity and real-time processing capabilities in wrinkle defect identification, and the detection standards are difficult to adjust flexibly.

Method used

The initial setup uses a machine vision system, which combines a high-resolution camera and deep learning algorithms to identify wrinkles and defects through feature extraction and pattern matching. The system then uses a support vector machine algorithm for classification and rating, generating a unified defect description data structure.

Benefits of technology

It enables flexible adjustment of testing standards for high-end and ordinary textiles, improves testing accuracy and efficiency, reduces manual intervention, ensures consistency and accuracy of test results, and enhances the automation level of production quality control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119323543B_ABST
    Figure CN119323543B_ABST
Patent Text Reader

Abstract

The application provides a textile defect detection method based on machine vision, comprising: obtaining corresponding camera resolution parameters, algorithm complexity parameters and detection sensitivity parameters from a database according to textile quality requirements, and initializing and setting a machine vision system; performing feature extraction on an optimized textile surface image, extracting texture and morphological features related to wrinkle defects, and constructing a feature map capable of reflecting wrinkle characteristics; identifying a region of suspected wrinkle defects in the feature map, determining the contour of the defect, and obtaining the position and range information of the wrinkle defect; performing pattern matching on the quantified wrinkle features according to a pre-established wrinkle defect type database, and if the matching degree exceeds a preset threshold, the specific category of the wrinkle defect is determined; using a support vector machine algorithm to classify wrinkle degree quantification indicators, combining wrinkle depth and density parameters, and dividing the wrinkle defects into different grades to evaluate the severity of the wrinkle.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of information technology, and in particular to a textile defect detection method based on machine vision. BACKGROUND

[0002] In the field of textile defect detection, as consumers' expectations for product quality continue to rise and production efficiency continues to be pursued, how to ensure detection accuracy while considering detection efficiency and cost control has become a key technical challenge. In particular, there is a fundamental difference in the standards for defect detection between high-end textiles and ordinary textiles. The detection of high-end textiles requires extremely strict standards, and even minor defects cannot be ignored, which forces the detection system to use high-resolution cameras and complex algorithms to achieve accurate detection. However, such configurations inevitably result in a decrease in detection speed and a significant increase in equipment costs. On the contrary, the detection standards for ordinary textiles are relatively lenient, tolerating the presence of larger defects. While a simplified solution can improve detection efficiency, it may overlook subtle but important defects, especially for wrinkle defects, which are even more complex. The identification and evaluation of wrinkle defects involve multiple dimensions such as wrinkle type, depth, and area, requiring the detection system to establish a comprehensive and detailed model to accurately judge different types of wrinkle defects. However, there is a natural contradiction between the complexity of the model and real-time processing capabilities. The more complex the model, the greater the computational load and the difficulty of real-time processing. In addition, different textiles have different tolerances for wrinkles. How to flexibly adjust the detection standards in the same detection system so that it can meet the stringent requirements of high-end products without excessive resource consumption has become a technical problem that needs to be solved urgently. SUMMARY

[0003] The present application provides a textile defect detection method based on machine vision, mainly comprising:

[0004] According to the quality requirements of the textile, the corresponding camera resolution parameters, algorithm complexity parameters, and detection sensitivity parameters are obtained from the database to initialize and set the machine vision system;

[0005] The camera of the initialized machine vision system is used to collect image data of the textile surface, and the original image data is preprocessed by noise reduction, enhancement, and correction to obtain an optimized textile surface image;

[0006] The optimized textile surface image is subjected to feature extraction, and texture and morphological features related to wrinkle defects are extracted to construct a feature map that can reflect the characteristics of wrinkles;

[0007] Identify the area suspected of having a wrinkle defect in the feature map, determine the outline of the defect, and obtain the location and range information of the wrinkle defect;

[0008] For the identified wrinkle defect area, calculate the wrinkle depth, wrinkle direction, and wrinkle density characteristic parameters to construct a quantitative index of wrinkle degree, including quantifying the wrinkle characteristics through a feature vector;

[0009] According to the pre-established wrinkle defect type database, the quantified wrinkle characteristics are matched, and if the matching degree exceeds the preset threshold, the specific category of the wrinkle defect is determined;

[0010] Using a support vector machine algorithm to classify the wrinkle degree quantitative index, combining the wrinkle depth and density parameters, the wrinkle defect is divided into different grades, and the severity of the wrinkle is evaluated;

[0011] The type, location, range, and severity information of the wrinkle defect are fused to generate a unified defect description data structure to realize the unified management and analysis of the textile wrinkle defect.

[0012] The technical scheme provided by the embodiment of the present application can include the following beneficial effects:

[0013] The present application discloses a textile defect detection method based on machine vision, which realizes the balance between detection accuracy, efficiency and cost control; by integrating intelligent textile defect detection methods, enterprises can customize detection standards for different grades of textiles, i.e. meet the strict requirements of high-end products for small defects, while avoiding excessive investment in ordinary textiles; using high-resolution cameras and deep learning algorithms, various types of defects can be accurately captured and analyzed, especially in the identification of wrinkle defects, the type, depth and area of the wrinkle can be considered comprehensively to form a comprehensive and detailed evaluation model; through automated feature extraction, region segmentation and quantitative index calculation, not only the detection speed is significantly improved, the demand for manual participation is reduced, but also the consistency and accuracy of the detection results are ensured. In addition, the detection strategy can be flexibly adjusted according to different textile characteristics, and automatic classification and rating can be realized through algorithms such as support vector machine (SVM), making the defect management of textiles more scientific and standardized. In summary, the implementation of the present application effectively improves the accuracy and efficiency of textile defect detection, through advanced image processing and deep learning technology, the accuracy and reliability of defect recognition are ensured, and through automatic classification and rating, the automation level of production quality control is significantly improved, which has important significance for textile quality management and protection. BRIEF DESCRIPTION OF DRAWINGS

[0014] Figure 1 The flowchart of the textile defect detection method based on machine vision of the present application.

[0015] Figure 2 A schematic diagram of a machine vision textile defect detection method of the present application.

[0016] Figure 3 Another schematic diagram of a machine vision textile defect detection method of the present application. DETAILED DESCRIPTION

[0017] In order to enable persons skilled in the art to better understand the technical solutions in the specification, the technical solutions in the specification will be clearly and completely described below in combination with the drawings in the specification. Obviously, the described embodiments are only some of the embodiments of the specification, not all the embodiments. Based on the embodiments in the specification, all other embodiments obtained by persons skilled in the art without creative labor should belong to the scope of protection of the specification.

[0018] As Figure 1 -3, the machine vision textile defect detection method of the embodiment can specifically include:

[0019] S101, according to the textile quality requirement, the corresponding camera resolution parameter, the algorithm complexity parameter and the detection sensitivity parameter are acquired from the database, and the machine vision system is initialized and set.

[0020] The system parameters corresponding to the textile quality requirement are acquired, the system parameters include the camera resolution parameter, the detection sensitivity parameter, the image preprocessing parameter and the defect classification parameter; the machine vision system is initialized and set according to the system parameters. The textile image is acquired by using a high-speed camera, the image acquisition frequency is adjusted according to the camera resolution parameter; the acquired image is preprocessed according to the image preprocessing parameter, and a clear image is obtained. The feature of the clear image is extracted, compared with the pre-established defect feature, and the position coordinates and area information of the suspected defect area are obtained. The region growing algorithm is used to accurately segment the suspected defect area; the region growing threshold is adjusted according to the detection sensitivity parameter; the segmentation result is classified by using the decision tree algorithm, the depth and branch condition of the decision tree are adjusted according to the defect classification parameter; whether the classification result meets the preset defect type is judged; if it meets, the textile defect type and position information are determined.

[0021] Specifically, based on the textile quality requirements, the corresponding camera resolution parameters, algorithm complexity parameters, detection sensitivity parameters, image preprocessing parameters, and defect classification parameters are retrieved from the database to initialize the machine vision system. A high-speed camera is used to acquire textile images. The image acquisition frequency is adjusted according to the initialized camera resolution parameters. Based on the image preprocessing parameters, the acquired images undergo median filtering for noise reduction, histogram equalization for enhancement, and Wiener filtering for deblurring to obtain clear images. For the processed clear images, a support vector machine algorithm is used for feature extraction. The kernel function type and parameters are adjusted according to the initialized algorithm complexity parameters. The Euclidean distance is used to compare the images with a pre-established defect feature database to obtain the location coordinates and area information of suspected defect areas. A region growing algorithm is used for fine segmentation of suspected defective areas. This algorithm groups pixels in the image into regions with similar features. The region growing threshold is adjusted based on the initially set detection sensitivity parameters. This threshold defines the similarity conditions between pixels, determined by differences in pixel intensity (grayscale value), color, or other features. The threshold determines which neighboring pixels can be included in the growing region. A decision tree algorithm is then used to classify the segmentation results. The depth and branching conditions of the decision tree are adjusted according to the initially set defect classification parameters, ultimately obtaining the textile defect type and location information. In textile quality inspection, the parameters obtained from the database based on the product type are: camera resolution set to 4096x3072 pixels, algorithm complexity set to 0.8, detection sensitivity threshold set to 0.95, image preprocessing parameters including median filter window size of 5x5, histogram equalization target grayscale level of 256, Wiener filter signal-to-noise ratio of 10dB, and defect classification parameters including maximum decision tree depth of 5 and minimum sample segmentation number of 10. A high-speed camera acquired textile images at a resolution of 4096x3072 at 120fps. The images were then subjected to 5x5 window median filtering for noise reduction, 256-level histogram equalization for contrast enhancement, and Wiener filtering with a signal-to-noise ratio of 10dB for blurring, resulting in a clear preprocessed image. For the preprocessed image, a support vector machine was used for feature extraction, with the RBF kernel selected, γ parameter set to 0.1, and C parameter set to 10, extracting texture, color, and shape features. The extracted features were compared with a pre-established defect feature library using Euclidean distance calculation. A distance threshold of 0.5 was set; regions with a distance less than the threshold were marked as suspected defect areas, and their location coordinates and area information were recorded. For the marked suspected defect areas, a region growing algorithm was used for fine segmentation. The initial seed point was selected from the region center, and the growth threshold was dynamically adjusted based on the detection sensitivity parameter of 0.95. Specifically, when the gray-level difference between an adjacent pixel and the seed point was less than 25.5 (255 * 0.1), it was included in the segmented region.Finally, a decision tree algorithm is used to classify the segmentation results. The maximum depth of the tree is 5, the minimum number of sample segments is 10, and the classification features include defect area, perimeter, and roundness. The final output is the type of textile defect, such as broken yarn, oil stain, hole, etc., and its precise location coordinates.

[0022] S102. Using the camera in the machine vision system after initialization settings, images of the textile surface are acquired to obtain raw image data. The raw image data is then preprocessed by noise reduction, enhancement, and correction to obtain an optimized image of the textile surface.

[0023] The original image data is acquired according to preset camera resolution parameters. The original image data is collected by the camera from the surface of the textile and stored in memory. An adaptive median filtering method is used to denoise the original image data. The first image after denoising is obtained by dynamically adjusting the size of the filtering window. If the signal-to-noise ratio of the first image is improved by more than a preset threshold, the denoising is deemed effective. Adaptive histogram equalization is performed on the first image, dividing the image into sub-blocks of a preset size. Histogram equalization is performed on each sub-block individually to obtain a second image with enhanced contrast. If the entropy value of the second image increases by more than a preset threshold, the contrast enhancement is deemed effective. Geometric correction is performed on the second image to obtain an affine transformation matrix. The affine transformation matrix is ​​applied to correct the second image to obtain an optimized textile surface image.

[0024] Specifically, based on the pre-set camera resolution parameter of 4096x3072 pixels, the optimal acquisition frequency is calculated, and the high-speed camera acquisition frequency is set to 120 frames per second to acquire raw image data from the textile surface. The acquired raw image data is temporarily stored in high-speed memory. The raw image data is read from high-speed memory and subjected to adaptive median filtering for noise reduction. The size of the filtering window is dynamically adjusted according to the local noise level, ranging from 3x3 to 7x7 pixels. The signal-to-noise ratio (SNR) before and after noise reduction is calculated. If the SNR increases by more than 5dB, the noise reduction is considered effective, and the first image after noise reduction is obtained. Adaptive histogram equalization is then performed on the first image, dividing the image into 8x8 sub-blocks. Histogram equalization is performed on each sub-block individually, with the target gray level set to 256 levels. The image entropy value before and after enhancement is calculated. If the entropy value increases by more than 0.5, the contrast enhancement is considered effective, and the second image with enhanced contrast is obtained. Geometric correction is performed on the second image. A SIFT feature point detection method based on feature point matching is used to detect the feature points in the image. These points are then matched with a pre-calibrated reference image to calculate the affine transformation matrix. This matrix is ​​then applied to correct the image, eliminating tilt and distortion, resulting in the final optimized image of the textile surface. During the acquisition and optimization of the textile surface image, based on the preset 4096x3072 pixel resolution parameter, the optimal acquisition frequency is calculated to be 120 frames per second. A high-speed camera acquires raw images from the textile surface at this frequency. Each frame contains approximately 36MB of data, temporarily stored in DDR4 high-speed memory with a storage capacity of 4GB, caching approximately 111 frames. Subsequently, the raw image data is read from the high-speed memory and subjected to adaptive median filtering for noise reduction. The algorithm first calculates the median within a 3x3 window. If the difference between the median and the center pixel value of the window exceeds a preset threshold of 20, the window is expanded to 5x5, up to a maximum of 7x7. By calculating the signal-to-noise ratio (SNR) before and after denoising, it was found that the SNR improved from the original 15dB to 21dB, exceeding the 5dB threshold, indicating that the denoising was effective. Next, adaptive histogram equalization was performed on the denoised image. The 4096x3072 image was divided into 512 8x8 sub-blocks, and each sub-block underwent histogram equalization independently, with a target gray level of 256. The calculated image entropy value increased from the original 5.8 to 6.4, exceeding the 0.5 threshold, confirming the contrast enhancement was effective. Finally, the SIFT algorithm was used to detect 2000 feature points in the enhanced image, which were matched with a pre-calibrated reference image, selecting 500 valid matching points. Based on these matching points, the RANSAC algorithm was used to calculate the optimal affine transformation matrix, which included correction parameters of a 1.2° rotation angle, a 5-pixel translation in the x-direction, and a 3-pixel translation in the y-direction. This matrix was applied to perform an affine transformation on the image, ultimately obtaining a geometrically corrected optimized textile surface image.

[0025] S103. Extract features from the optimized textile surface image, extract texture and morphological features related to wrinkles and defects, and construct a feature map that reflects the characteristics of wrinkles.

[0026] An optimized image of the textile surface is acquired, and a convolutional neural network is used to extract features from the image. Based on a preset number of convolutional layers, multiple convolutional operations are performed to extract local features from the textile surface image, resulting in multiple feature maps. For the output feature map of each convolutional layer, a pooling layer is added, and max pooling is used to downsample the feature map, obtaining a downsampled feature map. The high-dimensional features in the downsampled feature map are then dimensionality-reduced to obtain a feature map spectrum. Cross-validation is used to evaluate the effectiveness of the feature map spectrum on the wrinkle recognition task, determining whether the average accuracy of the feature map spectrum meets a preset threshold.

[0027] Specifically, a convolutional neural network (CNN) is used to extract features from the optimized textile surface image. Five convolutional layers are used to extract local features, with the number of kernels in each layer set to 32, 64, 128, 256, and 512 respectively. The kernel size is 3x3, the stride is 1, and the padding method is SAME. A pooling layer is added after each convolutional layer, using max pooling to downsample the feature map. The pooling window size is set to 2x2, and the stride is 2, reducing the spatial dimensionality of the feature map while preserving wrinkle edge information. A BatchNormalization layer and the LeakyReLU activation function are applied to the pooled feature map. The slope of the negative half-axis of the LeakyReLU function is set to 0.01 to introduce non-linear transformation and alleviate gradient vanishing, resulting in multiple activated feature maps. The t-SNE algorithm is used to reduce the dimensionality of the high-dimensional features and visualize them, reducing the feature space to 2 dimensions and generating a feature distribution map. Multiple feature maps are flattened into a one-dimensional vector. A fully connected layer combines features from different levels to obtain a 256-dimensional feature vector. L1 regularization is used to select the 128 features most relevant to wrinkle features, constructing a feature map reflecting wrinkle characteristics. A 5-fold cross-validation method is used to evaluate the effectiveness of the feature map on the wrinkle recognition task, calculating the average accuracy and recording the standard deviation. In the feature extraction process for wrinkles and defects on textile surfaces, an optimized image of 4096x3072 pixels is first input into a convolutional neural network. The network contains five convolutional layers with 32, 64, 128, 256, and 512 kernels respectively. All kernels are 3x3 in size with a stride of 1 and SAME padding. After the first convolutional layer, the feature map size remains unchanged, but the number of channels becomes 32. Subsequent max pooling operations use a 2x2 window with a stride of 2, halving the feature map size to 2048x1536 while preserving the salient features of the wrinkle edges. Each convolutional layer is followed by a BatchNormalization layer with parameters including mean μ = 0, variance σ² = 1, epsilon = 1e⁻⁵, and momentum = 0.99. Then, the LeakyReLU activation function is used with a negative half-axis slope of 0.01 to effectively mitigate gradient vanishing. After 5 layers of convolutional pooling, a 128x96x512 feature map is obtained. The t-SNE algorithm is used to reduce the 512-dimensional features to 2-dimensionality, with a perplexity parameter of 30, a learning rate of 200, and 1000 iterations, generating a feature distribution scatter plot. The feature map is flattened into a 6,291,456-dimensional vector and further reduced to 256 dimensions through a fully connected layer. L1 regularization is applied with a regularization strength λ = 0.01, selecting 128 of the most relevant features to form a wrinkled feature map. Finally, a 5-fold cross-validation was performed, with each fold using 80% of the data for training and 20% for testing, resulting in an average accuracy of 95.3% and a standard deviation of 1.2%, thus validating the effectiveness of the feature map.

[0028] S104. Identify the suspected wrinkle defect area in the feature map, determine the outline of the defect, and obtain the location and range information of the wrinkle defect.

[0029] Based on the distribution of wrinkle feature values ​​in the feature map, principal component analysis is used to reduce multidimensional features to single feature values, obtaining initial regions suspected of wrinkle defects. These initial regions are obtained by binarizing the feature map using a set threshold. Connected component analysis is performed on these initial regions; if the area of ​​a connected component is less than a preset threshold, the component is removed. Within the remaining connected components, the point with the largest feature value is selected as the seed point for region growth, and its coordinates and grayscale value are recorded in a seed point list. Seed points are retrieved from this list, and their neighboring pixels are examined. The grayscale threshold of these neighboring pixels is adaptively calculated using the Otsu algorithm. If the difference between the grayscale value of a neighboring pixel and the grayscale value of the seed point is less than the grayscale threshold, the neighboring pixel is added to both the seed point list and the growth region. The centroid coordinates of each defect region are calculated as location information, and the bounding rectangle is calculated as range information. The contour of the defect region is refined using the Snake algorithm, with a preset number of iterations.

[0030] Specifically, based on the distribution of wrinkle feature values ​​in the feature map, principal component analysis is used to reduce multidimensional features to single feature values. A threshold is set as the average of the feature values ​​plus twice the standard deviation. The feature map is then binarized to obtain initial regions suspected of wrinkle defects. Connectivity analysis is performed on the initial regions to remove areas smaller than 100 square pixels, reducing false positives. Within each remaining connected region, the point with the largest feature value is selected as the seed point for region growth, and its coordinates and grayscale value are recorded in a seed point list. A seed point is taken from the seed point list, and its 8-neighbor pixels are examined. The Otsu algorithm is used to adaptively calculate the grayscale threshold. If the difference between the grayscale value of a neighboring pixel and the grayscale value of the seed point is less than the threshold, the neighboring pixel is added to the seed point list and the growth region. When the area growth rate of the growth region is less than 1%, the growth process of the current seed point is stopped. Seed point growth is repeated until the seed point list is empty, resulting in multiple wrinkle defect regions. For each defect region, the centroid coordinates are calculated as location information, and the bounding rectangle is calculated as range information. The Snake algorithm is used to refine the contour of each defect region, with 100 iterations to obtain accurate defect contours. Finally, an overall defect distribution description is generated, including the number of defects, their location, and extent. In the textile wrinkle defect identification process, principal component analysis is first applied to the 128-dimensional feature map, selecting the principal component with the highest contribution rate as the single feature value. The calculated mean of the feature values ​​is 0.5, and the standard deviation is 0.1, based on which a threshold of 0.7 (0.5 + 2 * 0.1) is set. The feature map is binarized, with regions above the threshold marked as 1 and regions below the threshold marked as 0, forming an initial map of suspected wrinkle defect regions. Subsequently, connected component analysis is performed, using an 8-connectivity algorithm to label connected regions, removing regions with an area less than 100 square pixels. For the remaining regions, the point with the largest feature value within each connected component is selected as a seed point. For example, if the largest feature value in a connected component is 0.85, its coordinates (150, 200) and grayscale value 180 are added to the seed point list. Seed points are retrieved from the list, and the Otsu algorithm is used to calculate the grayscale threshold of the 8-neighborhood, assuming a threshold of 15. The 8-neighbor pixels are checked; if the difference is less than 15, the pixel is added to the growth region. Growth of the current seed point is stopped when the region area increases from 1000 to 1010 (a growth rate of 1%). This process is repeated for all seed points, resulting in three wrinkled defect regions. The centroid coordinates of each region are calculated, such as (160, 210), (350, 420), (580, 630), and the circumscribed rectangle is calculated, such as [(140, 190), (180, 230)]. The Snake algorithm is used to refine the contour of each region, with 100 iterations and α = 0.1, β = 0.1, and γ = 0.1 in the energy function.Finally, a defect distribution description was generated, and three wrinkle defects were detected at positions (160, 210), (350, 420), and (580, 630), with areas of 1200, 1500, and 1800 square pixels, respectively.

[0031] S105. For the identified wrinkle defect areas, calculate the wrinkle depth, wrinkle direction, and wrinkle density feature parameters, and construct a quantitative index of wrinkle degree, including quantifying wrinkle features through feature vectors.

[0032] A gray-level co-occurrence matrix (GLCM) is calculated for the wrinkled and defective regions. Based on this GLCM, four statistical features—contrast, correlation, energy, and homogeneity—are extracted. The maximum value of each of the four statistical features is taken as the final feature. The wrinkled and defective regions are processed to obtain multidimensional feature vectors representing the distribution of wrinkle directions. Multidimensional feature vectors representing wrinkle density are selected based on the wrinkled and defective regions. The selected feature vectors are normalized, and the weights of each feature are determined. Principal component analysis (PCA) is used to reduce the dimensionality of the weighted features, obtaining a predetermined number of principal components as the quantitative index of wrinkle degree.

[0033] Specifically, for the identified wrinkled and defective regions, a gray-level co-occurrence matrix (GLCM) is calculated. With a distance parameter of 1 and directional angles of 0°, 45°, 90°, and 135°, GLCMs in four directions are obtained. Four statistical features—contrast, correlation, energy, and homogeneity—are extracted from these GLCMs. The maximum value in each direction is taken as the final feature, where a higher contrast value indicates greater wrinkle depth, serving as a quantitative indicator of wrinkle depth. A gradient orientation histogram (GAH) algorithm is used to divide the wrinkled and defective regions into a 4x4 grid. The gradient direction and magnitude of pixels within each grid are calculated. The 360° angle is divided into nine directions, generating a 9-dimensional feature vector for each grid, resulting in a 36-dimensional feature vector representing the distribution of wrinkle directions. A local binary pattern (LBP) algorithm is used, selecting a circular neighborhood with a radius of 2. The LBP value of each pixel within the wrinkled and defective region is calculated, and an LBP histogram is generated, resulting in a 256-dimensional feature vector. The complexity of the LBP pattern reflects the density of wrinkles, serving as a representation of wrinkle density. The recursive feature elimination method was used to select the 100 most relevant features from the above features. The selected feature vectors were normalized, and multiple linear regression was used to determine the weights of each feature. Different weights were assigned based on the regression coefficients, and weighted combinations were performed. Principal component analysis was used to reduce the dimensionality of the weighted features, and the top 10 principal components were selected as the final quantitative index of wrinkle degree. Five-fold cross-validation was used to evaluate the stability and reliability of the quantitative index, and the mean error and standard deviation were calculated. In the analysis of textile wrinkle defects, the gray-level co-occurrence matrix was first calculated for the identified 100x100 pixel defect area. With a distance parameter of 1, the gray-level co-occurrence matrix was calculated at 0°, 45°, 90°, and 135° respectively.

[0034] The system generates four matrices. Contrast, correlation, energy, and homogeneity features are extracted from each matrix, and the maximum value in each of the four directions is selected as the final feature. For example, a maximum contrast value of 0.85 indicates a deeper wrinkle. Then, a gradient orientation histogram (LBP) algorithm is applied to divide the defect area into a 4x4 grid, each 25x25 pixels. The gradient direction and magnitude of each pixel are calculated, dividing the 360° angle into nine 40° intervals. The gradient distribution in each of the nine directions within each grid is statistically analyzed, generating a 36-dimensional feature vector. For example, if the feature of a certain grid is [0.1, 0.2, 0.3, 0.1, 0.1, 0.05, 0.05, 0.05, 0.05], it indicates that the wrinkles in this area are mainly in the 45°–85° direction. Next, a local binary pattern (LBP) algorithm is used to select a circular neighborhood (8 pixels) with a radius of 2. The difference between the center pixel and the neighboring pixels is calculated, resulting in an 8-bit binary number, which is then converted to a decimal LBP value. The LBP histogram for the entire region is then calculated, resulting in a 256-dimensional feature vector. If the peak value in the histogram appears in the bin corresponding to the complex pattern, it indicates a high wrinkle density. Using recursive feature elimination, the 100 most relevant features are selected from the 292 features. The selected features are normalized, with the value range unified to [0, 1]. Multiple linear regression is used to determine the feature weights, assuming the resulting regression equation is y = 0.3*x1 + 0.25*x2 + 0.2*x3 + ... + 0.01*x100. Features are weighted and combined based on the regression coefficients. Finally, principal component analysis is used to reduce the dimensionality of the 100-dimensional weighted features, selecting the top 10 principal components with a cumulative contribution rate of 90% as the final quantification index of wrinkle degree. The stability of the index is evaluated using 5-fold cross-validation, yielding a mean error of 0.05 and a standard deviation of 0.01, demonstrating the good reliability of the quantification index.

[0035] S106. Based on the pre-established database of wrinkle defect types, perform pattern matching on the quantified wrinkle features. If the matching degree exceeds the preset threshold, determine the specific category of the wrinkle defect.

[0036] Standard feature vectors for each type of defect are obtained from a pre-established database of crease and defect types. Based on the standard feature vectors, principal component analysis is used to reduce the feature vectors to a preset dimension, and the crease features are normalized. The k-nearest neighbor algorithm is used to select the k standard samples most similar to the crease feature to be classified, and the value of k is determined by cross-validation. If the confidence score of the k-nearest neighbor algorithm result is lower than a preset threshold, a support vector machine classifier is trained using all samples in the database. The crease feature to be classified is input into the support vector machine classifier to obtain the classification probability values ​​for each category. If the maximum value of the classification probability value exceeds a preset threshold, and the difference between the maximum value and the second largest value is greater than a preset difference, the final category of the crease and defect is determined. If the condition is not met, the sample is marked as an undetermined type. The classification result and its confidence score are fed back to the database to update the crease and defect type database.

[0037] Specifically, standard feature vectors for each type of defect are extracted from a pre-established database of wrinkle defect types. Principal component analysis is used to reduce all feature vectors to 50 dimensions. The quantized wrinkle features are then normalized, and the similarity between the wrinkle feature to be classified and the standard feature vectors is calculated using the Euclidean distance formula. Based on the calculated similarity, the k-nearest neighbor algorithm is used to select the k standard samples most similar to the wrinkle feature to be classified. The optimal k value is determined to be 5 through 10-fold cross-validation. A majority voting method is used to vote on the categories of these five samples, and the category with the highest number of votes is taken as the initial wrinkle defect category. The difference in votes between the two categories with the highest number of votes is calculated. If the difference is greater than 2, the k-nearest neighbor result is considered to have high confidence and is directly adopted; otherwise, further optimization is performed. A support vector machine classifier is trained using all samples in the database, with a radial basis function kernel function selected, and the penalty parameter C is set to 1.0 and the kernel function parameter γ to 0.1. The wrinkle features to be classified are input into a trained support vector machine classifier to obtain classification probability values ​​for each category. If the highest probability value exceeds a preset threshold of 0.8 and the difference between it and the second highest probability value is greater than 0.1, the final category of the wrinkle defect is determined; otherwise, the sample is marked as an undetermined type. The classification results and their confidence scores are fed back to the database to update and optimize the wrinkle defect type database, improving the accuracy of subsequent classifications. In the wrinkle defect classification process, 1000 standard samples are first extracted from the database, each containing a 200-dimensional feature vector. Principal component analysis is used to reduce all vectors to 50 dimensions, achieving a cumulative variance contribution rate of 95%. The wrinkle features to be classified undergo the same dimensionality reduction process, and then Min-Max normalization is used to scale the feature values ​​to the [0, 1] interval. The Euclidean distance between the feature to be classified and the standard samples is calculated, such as [0.25, 0.42, 0.18, 0.37, ...]. The k-nearest neighbor algorithm is applied, and the optimal k value is determined to be 5 through 10-fold cross-validation, achieving an average accuracy of 92%. Five samples with the smallest distance were selected, and their categories were assumed to be [A, B, A, C, A]. A preliminary category of A was determined by majority vote, with 3 votes. The difference between the two highest vote counts was 1(3-2), which is less than the threshold of 2, requiring optimization. A support vector machine was trained using all 1000 samples. Grid search was used to determine the optimal parameters C=1.0, γ=0.1, and the 5-fold cross-validation accuracy reached 95%. The features to be classified were input into the trained support vector machine to obtain the probabilities of each category [A: 0.75, B: 0.15, C: 0.10]. The highest probability, 0.75, was less than the threshold of 0.8, but the difference between it and the second highest probability, 0.60, was greater than 0.1. Therefore, the final category was determined to be A. This result and its confidence score of 0.75 were fed back to the database for subsequent optimization. The entire process was completed on a high-performance server, taking approximately 0.5 seconds, achieving fast and accurate classification of wrinkles and defects.

[0038] S107. The support vector machine algorithm is used to classify the quantitative indicators of wrinkle degree. Combined with wrinkle depth and density parameters, the wrinkle defects are divided into different levels to assess the severity of wrinkles.

[0039] Z-score standardization is applied to the wrinkle features to obtain a standard normal distribution of the feature values. The top N features with the greatest impact on classification are obtained. A support vector machine (SVM) classifier is constructed, and the kernel function is determined based on the training results of the linear kernel function and the radial basis function kernel function. The optimal penalty parameter C and kernel function parameter γ are obtained from a preset parameter range using a grid search method. Weighted 5-fold cross-validation is used to evaluate the performance metrics of the SVM classifier. If the probability value of the classification result is lower than the threshold, the sample is determined to be a pending category. Based on the evaluation report, the wrinkle level, feature index, and confidence level are determined.

[0040] Specifically, Z-score standardization is applied to features such as wrinkle degree quantification indicators, wrinkle depth, wrinkle density, and wrinkle direction, converting all feature values ​​into a standard normal distribution with a mean of 0 and a standard deviation of 1. A recursive feature elimination method is used to select the most important feature subset, retaining the top 10 features with the greatest impact on classification. A support vector machine classifier is constructed and trained using both linear and radial basis function kernels. The performance of the two kernels is compared to select the more suitable kernel. A grid search method is used to determine the optimal penalty parameter C and kernel function parameter γ, with the parameter search range set to C as...

[0041] The parameters are set to [0.1, 1, 10, 100], with γ set to [0.001, 0.01, 0.1, 1]. Each parameter combination is evaluated. Weighted 5-fold cross-validation is used to evaluate the performance of the support vector machine classifier. Weights are set inversely proportional to the number of samples in each class to handle potential class imbalance. Based on the statistical distribution of the samples, threshold values ​​for mild, moderate, and severe wrinkles are determined. Test samples are input into the trained support vector machine classifier to obtain classification results and corresponding probability values. A confidence threshold of 0.8 is set; when the probability value of the classification result is lower than the threshold, the sample is marked as "pending". An evaluation report is generated, including wrinkle level, various feature indicators, and confidence scores. Additional test sets can be used to verify the model's generalization ability, calculating metrics such as accuracy, precision, and recall to evaluate the effectiveness of the support vector machine classifier in a real-world production environment. In the assessment of the severity of wrinkle defects, the 20 original features were first standardized using Z-scores, converting the wrinkle depth from the original value of 5.2 mm to a standardized value of 1.3, and the wrinkle density from the original value of 0.8 to -0.5. Then, a recursive feature elimination method was used, iterating 100 times to select the 10 most important features, including the standardized wrinkle depth, density, and orientation. A support vector machine classifier was constructed, and the performance of linear kernels and RBF kernel functions was compared. The RBF kernel achieved an accuracy of 92% in 5-fold cross-validation, superior to the 88% of the linear kernel; therefore, the RBF kernel was selected. A grid search was conducted to find the optimal parameters, iterating through 16 parameter combinations to determine the optimal C = 10 and γ = 0.01. In weighted cross-validation, the ratio of mild, moderate, and severe samples was 6:3:1, with corresponding weights set to 1:2:6. Based on the statistical distribution of 3000 samples, the mild-moderate threshold was set to a standardized wrinkle depth of 0.5, and the moderate-severe threshold was set to 1.5. Classifying 100 test samples, 85 samples had a probability value exceeding the 0.8 threshold, including 50 mild, 25 moderate, 10 severe, and 15 pending. An evaluation report was generated, such as "Sample #37, wrinkle level moderate, normalized depth 0.8, density -0.2, orientation 45°, confidence level 0.92". The model was validated using 500 additional test samples, achieving an accuracy of 91%, precision of 89%, recall of 90%, and an F1 score of 0.895, demonstrating good generalization ability and practical value.

[0042] S108. Data fusion of the type, location, extent, and severity of wrinkle defects to generate a unified defect description data structure to achieve unified management and analysis of wrinkle defects in textiles.

[0043] Obtain defect description information containing crease defect ID, type, location coordinates, and area, wherein the defect description information is represented in JSON format; establish a relational database table structure based on the defect description information; perform data validation on the defect description information, validate the data format using regular expressions, and delete duplicate data; perform fusion processing on crease defect information from different sources, including converting the crease defect information into a preset data structure; and perform database management operations, including data insertion, update, deletion, and query.

[0044] Specifically, a unified defect description data structure is designed, including fields such as crease defect ID, type, location coordinates, area, severity, detection time, and image path, represented in JSON format. Dynamic fields are used to store the special attributes of different defect types, ensuring data structure and scalability. A relational database table structure is created, including a main defect table and related type dictionary tables and severity level tables. Primary keys and foreign key constraints are set, indexes are created to improve query efficiency, and triggers are used to implement data integrity verification. Input data is validated and cleaned, using regular expressions to validate data format and remove duplicate data to ensure data quality. Crease defect information from different sources is uniformly converted into the designed data structure. Decision tree algorithms are used to resolve data conflicts, and min-max normalization is used to unify data scales. Issues such as data type conversion, unit unification, and coordinate system conversion are handled to ensure data consistency and comparability. Database management functions are implemented, including basic operations such as data insertion, update, deletion, and query. Composite indexes are used to optimize query performance, sliding window methods are used to calculate defect trends, and K-means clustering is used to analyze defect distribution characteristics, supporting multi-dimensional data analysis and visualization. Data backup and recovery should be performed using an incremental backup strategy, with regular full backups to ensure data security and reliability. In the textile wrinkle and defect management system, a JSON-formatted data structure should first be designed, including fixed fields such as "id", "type", "position", "area", "severity", and "time".

[0045] The "image_path" field, and the dynamic field "attributes" field, store special attributes. For example,

[0046] {"id": "F001", "type": "crease"}

[0047] ", "position": [100, 200], "area": ​​50, "severity": 3, "time": "2024-07-11 10:30:00", "image_path": " / images / F001.jpg", "attributes": {"crease length"; ...

[0048] "15, "Fold Direction": 45}}. Create a PostgreSQL database, use a partitioned table to store defect data by month, and set up a B-tree index to optimize queries. When inputting data, use the regular expression "^\d{4}-

[0049] \d{2}-\d{2}\d{2}:\d{2}:\d{2}¥" Verify the time format and delete duplicate records. Data fusion uses the C4.5 decision tree algorithm to resolve conflicts; for example, when two sources report different severity levels, the final level is determined based on features such as area and depth. Min-Max normalization is used to scale all numerical features to [0, 1].

[0050] Range. Implement database CRUD operations, such as...

[0051] SELECT * FROM faults WHERE severity > 2 AND detection_time > '2024-07-01' to query for severe defects. A 30-day sliding window is used to calculate defect trends, and K-means clustering (K=5) is used to analyze the spatial distribution of defects. Incremental backups are performed hourly, and a full backup is performed daily at 23:00, retaining backup files from the most recent 30 days.

[0052] Based on the embodiments of the present invention described above, and through the above description, those skilled in the art can make various changes and modifications without departing from the technical concept of the present invention. The technical scope of the present invention is not limited to the contents of the specification, but must be determined according to the scope of the claims.

Claims

1. A machine vision-based method for detecting defects in textiles, characterized in that, The method includes: obtaining corresponding camera resolution parameters, algorithm complexity parameters, and detection sensitivity parameters from a database according to textile quality requirements, and initializing the machine vision system; using the camera in the initialized machine vision system to acquire images of the textile surface, obtaining raw image data, and performing preprocessing such as noise reduction, enhancement, and correction on the raw image data to obtain an optimized textile surface image; extracting features from the optimized textile surface image, extracting texture and morphological features related to wrinkles and defects, and constructing a feature map that reflects the characteristics of wrinkles; identifying areas suspected of wrinkles and defects in the feature map, determining the outline of the defects, and obtaining the location and extent information of the wrinkles and defects; For the identified wrinkle defect areas, the wrinkle depth, wrinkle direction, and wrinkle density feature parameters are calculated to construct a quantitative index of wrinkle severity, including quantifying wrinkle features through feature vectors. Based on a pre-established wrinkle defect type database, pattern matching is performed on the quantified wrinkle features. If the matching degree exceeds a preset threshold, the specific category of the wrinkle defect is determined. The support vector machine algorithm is used to classify the wrinkle severity quantitative index, and combined with the wrinkle depth and density parameters, it is divided into different levels of wrinkle defects to assess the severity of wrinkles. The type, location, range, and severity information of wrinkle defects are fused to generate a unified defect description data structure to achieve unified management and analysis of textile wrinkle defects.

2. The method according to claim 1, wherein, The process of initializing the machine vision system by retrieving corresponding camera resolution parameters, algorithm complexity parameters, and detection sensitivity parameters from the database based on textile quality requirements includes: acquiring system parameters corresponding to the textile quality requirements, including camera resolution parameters, detection sensitivity parameters, image preprocessing parameters, and defect classification parameters; initializing the machine vision system based on the system parameters; acquiring textile images using a high-speed camera and adjusting the image acquisition frequency according to the camera resolution parameters; performing image preprocessing on the acquired images according to the image preprocessing parameters to obtain clear images; extracting features from the clear images and comparing them with pre-established defect features to obtain the location coordinates and area information of suspected defect areas; using a region growing algorithm to accurately segment the suspected defect areas; adjusting the region growing threshold according to the detection sensitivity parameters; classifying the segmentation results using a decision tree algorithm, with the depth and branching conditions of the decision tree adjusted according to the defect classification parameters; determining whether the classification results conform to a preset defect type; if they do, determining the textile defect type and location information.

3. The method according to claim 1, wherein, The process involves using a camera in a machine vision system after initialization to acquire images of the textile surface, obtaining raw image data, and performing preprocessing on the raw image data including noise reduction, enhancement, and correction to obtain an optimized textile surface image. This includes: acquiring raw image data based on preset camera resolution parameters, wherein the raw image data is acquired by the camera from the textile surface and stored in memory; applying an adaptive median filtering method to denoise the raw image data, obtaining a first denoised image by dynamically adjusting the filter window size; determining that the noise reduction is effective if the signal-to-noise ratio of the first image increases beyond a preset threshold; performing adaptive histogram equalization on the first image, dividing the image into sub-blocks of a preset size, and obtaining a second image with enhanced contrast by performing histogram equalization on each sub-block individually; determining that the contrast enhancement is effective if the entropy value of the second image increases beyond a preset threshold; performing geometric correction on the second image to obtain an affine transformation matrix; and applying the affine transformation matrix to correct the second image to obtain the optimized textile surface image.

4. The method according to claim 1, wherein, The step of extracting features from the optimized textile surface image, extracting texture and morphological features related to wrinkles and defects, and constructing a feature map that reflects the characteristics of wrinkles includes: acquiring the optimized textile surface image and extracting features from the textile surface image using a convolutional neural network; extracting local features from the textile surface image through multiple convolutional operations according to a preset number of convolutional layers to obtain multiple feature maps; adding pooling layers to the output feature map of each convolutional layer and using max pooling to downsample the feature map to obtain a downsampled feature map; performing dimensionality reduction processing on the high-dimensional features in the downsampled feature map to obtain a feature map; and using cross-validation to evaluate the effectiveness of the feature map on the wrinkle recognition task and determine whether the average accuracy of the feature map meets a preset threshold.

5. The method according to claim 1, wherein, The process of identifying suspected wrinkle defects in the feature map, determining the contour of the defects, and obtaining the location and extent information of the wrinkles includes: based on the distribution of wrinkle feature values ​​in the feature map, using principal component analysis to reduce multidimensional features to single feature values ​​to obtain an initial region of suspected wrinkles; wherein, the initial region is obtained by binarizing the feature map by setting a threshold; performing connected component analysis on the initial region, and removing the connected component if its area is less than a preset threshold; selecting the point with the largest feature value in the remaining connected components as the seed for region growth. The coordinates and grayscale values ​​of the seed points are recorded in a seed point list. A seed point is retrieved from the seed point list, and its neighboring pixels are checked. The grayscale threshold of the neighboring pixels is adaptively calculated using the Otsu algorithm. If the difference between the grayscale value of a neighboring pixel and the grayscale value of the seed point is less than the grayscale threshold, the neighboring pixel is added to the seed point list and the growth region. The centroid coordinates of each defect region are calculated as location information, and the circumscribed rectangle is calculated as range information. The contour of the defect region is refined using the Snake algorithm, with the number of iterations set to a preset value.

6. The method according to claim 1, wherein, For the identified wrinkled and defective areas, the method calculates wrinkle depth, wrinkle direction, and wrinkle density characteristic parameters to construct a quantitative index of wrinkle degree. This includes quantifying wrinkle features through feature vectors, specifically: calculating a gray-level co-occurrence matrix for the wrinkled and defective areas; extracting four statistical features—contrast, correlation, energy, and homogeneity—from the gray-level co-occurrence matrix, with the maximum value of each of the four directions taken as the final feature; processing the wrinkled and defective areas to obtain multidimensional feature vectors representing the distribution of wrinkle directions; selecting multidimensional feature vectors representing wrinkle density based on the wrinkled and defective areas; normalizing the selected feature vectors and determining the weight of each feature; and using principal component analysis to reduce the dimensionality of the weighted features, obtaining a predetermined number of principal components as the quantitative index of wrinkle degree.

7. The method according to claim 1, wherein, The process involves performing pattern matching on the quantified wrinkle features based on a pre-established wrinkle defect type database. If the matching degree exceeds a preset threshold, the specific category of the wrinkle defect is determined. This includes: obtaining standard feature vectors for each type of defect from the pre-established wrinkle defect type database; using principal component analysis to reduce the feature vectors to a preset dimension and normalizing the wrinkle features based on the standard feature vectors; using the k-nearest neighbor algorithm to select the k standard samples most similar to the wrinkle features to be classified, and determining the value of k through cross-validation; if the confidence level of the k-nearest neighbor algorithm result is lower than a preset threshold, then a support vector machine classifier is trained using all samples in the database; the wrinkle features to be classified are input into the support vector machine classifier to obtain classification probability values ​​for each category; if the maximum value of the classification probability value exceeds a preset threshold, and the difference between the maximum and the second largest value is greater than a preset difference, then the final category of the wrinkle defect is determined; if the conditions are not met, the sample is marked as an undetermined type; and the classification result and its confidence level are fed back to the database to update the wrinkle defect type database.

8. The method according to claim 1, wherein, The method employs a support vector machine (SVM) algorithm to classify crease severity quantification indicators. Combining crease depth and density parameters, creases are categorized into different levels of defects to assess their severity. This includes: Z-score standardization of crease features to obtain a standard normal distribution of feature values; obtaining the top N features with the greatest impact on classification; constructing an SVM classifier and determining the kernel function based on the training results of linear and radial basis function kernels; using a grid search method to obtain the optimal penalty parameter C and kernel function parameter γ from a preset parameter range; employing weighted 5-fold cross-validation to evaluate the performance indicators of the SVM classifier; if the probability value of the classification result is lower than a threshold, the sample is determined to be a pending category; and determining the crease level, feature indicators, and confidence level based on the evaluation report.

9. The method according to claim 1, wherein, The process of fusing information on the type, location, extent, and severity of wrinkles to generate a unified defect description data structure for unified management and analysis of textile wrinkles includes: acquiring defect description information with a wrinkle ID, type, location coordinates, and area, wherein the defect description information is represented in JSON format; establishing a relational database table structure based on the defect description information; performing data validation on the defect description information, validating the data format using regular expressions, and deleting duplicate data; fusing wrinkle defect information from different sources, including converting the wrinkle defect information into a preset data structure; and performing database management operations, including data insertion, updating, deletion, and querying.

Citation Information

Patent Citations

  • Method for automatically detecting and classifying textile flaws based on pattern recognition and image processing

    CN102879401A

  • Non-woven fabric flaw detection and classification method and system based on machine vision

    CN113554080A