A textile quality detection method fusing multi-scale features
By using multi-scale feature extraction and support vector machine classifiers, the problem of detecting textiles under torsional deformation and brightness changes was solved, realizing comprehensive automatic detection and quantitative evaluation of textile quality, and improving the accuracy and reliability of detection.
Patent Information
- Application Number
- CN202411395736.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-08
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2044-10-08
AI Technical Summary
Textiles often undergo torsional deformation during production and testing, causing traditional feature extraction methods to fail and affecting detection accuracy. Furthermore, changes in brightness also affect the detection results. Finding a balance between torsional deformation and brightness changes to accurately capture texture, shape, and brightness information is the core challenge.
A multi-scale feature extraction method is adopted, which extracts texture and shape features through discrete wavelet transform and Zernike moment algorithm, and extracts brightness features by combining gray-level co-occurrence matrix. The invariant moments and correlation coefficients of feature vectors are calculated to generate multi-scale torsion feature vectors and brightness feature vectors. A support vector machine classifier is used for detection.
It enables automatic detection and quantitative assessment of torsion and brightness defects in textiles, providing a comprehensive assessment of textile quality and improving the accuracy and reliability of detection.
Smart Images

Figure CN119444670B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information technology, and in particular to a method for quality inspection of textiles that integrates multi-scale features. Background Technology
[0002] Textile quality inspection faces a complex technical challenge. Textiles frequently undergo varying degrees of torsional deformation during production and inspection, which can render traditional feature extraction methods ineffective, thus affecting inspection accuracy. Furthermore, surface texture, shape, and brightness features of textiles exhibit different characteristics under different torsional states, further increasing the difficulty of feature extraction. In addition, changes in textile brightness also affect inspection results, necessitating effective fusion of brightness features with multi-scale features. However, in practical applications, these requirements are often contradictory. Improving the torsional invariance of features may reduce their sensitivity to subtle texture changes; conversely, enhancing adaptability to brightness changes may affect the accuracy of shape feature extraction. Finding a balance among these conflicting factors, and developing a feature extraction method that can adapt to torsional deformation while accurately capturing texture, shape, and brightness information, is the core technical challenge. Summary of the Invention
[0003] This invention provides a method for quality inspection of textiles that integrates multi-scale features, mainly comprising:
[0004] Multi-scale decomposition of textile images is performed to obtain image features at different scales. Multi-scale feature vectors containing texture and shape information are extracted to obtain multi-scale feature representations that reflect the structural features of textile twisting cycle, twisting amplitude and twisting morphology at different scales.
[0005] For multi-scale feature representation, by calculating the invariant moments of the feature vector, the twist angle and twist direction feature descriptors that remain unchanged under image rotation transformation are obtained, and multi-scale twist feature vectors are generated.
[0006] A gray-level co-occurrence matrix is constructed, statistical features reflecting the brightness distribution are extracted from the textile image, and the energy, contrast, and correlation statistics of the gray-level co-occurrence matrix are calculated to obtain a brightness feature vector characterizing the average brightness, brightness contrast, and brightness uniformity of the textile.
[0007] Calculate the correlation coefficients between the torsion frequency and torsion density in the multi-scale torsion feature vector and the brightness gradient and brightness change rate in the brightness feature vector to determine the degree of correlation between torsion features and brightness features.
[0008] Based on the correlation between the multi-scale torsion feature vector and the brightness feature vector, the main feature components of the torsion region feature in the multi-scale torsion feature vector and the brightness dynamic range feature in the brightness feature vector are selected and fused to form a comprehensive feature vector.
[0009] Based on the comprehensive feature vector, a support vector machine classifier is used to classify textile images to determine whether there are defective areas such as abnormal twisting regions or abnormal brightness dynamic range.
[0010] Within the defect area, local features such as torsion angle, torsion amplitude, average brightness, and brightness contrast are extracted. By comparing thresholds, the degree of torsion and brightness anomaly in the defect area are determined, and a quantitative description of the defect is obtained.
[0011] By combining the torsion and brightness characteristics of the defective areas, a comprehensive quality score for the defective areas is calculated to obtain a quantitative assessment result reflecting the local quality of the textile. By combining the comprehensive quality scores of each defective area, an overall quality assessment score for the textile is obtained for a comprehensive evaluation of the textile quality.
[0012] The technical solutions provided by the embodiments of the present invention may include the following beneficial effects:
[0013] This invention discloses a textile quality inspection method integrating multi-scale features. The method decomposes textile images at multiple scales, extracting multi-scale feature vectors containing texture and shape information to obtain multi-scale feature representations reflecting torsion characteristics. Simultaneously, a gray-level co-occurrence matrix is constructed to extract brightness feature vectors, and the correlation between torsion and brightness features is calculated. Based on the correlation between torsion and brightness features, dimensionality reduction is performed on the torsion region features in the multi-scale torsion features and the brightness dynamic range features in the brightness features. The main feature components are selected, and the torsion region features and brightness dynamic range features are fused to form a comprehensive feature vector. This vector contains both local torsion change information and overall brightness dynamic range information, achieving a comprehensive characterization of textile quality. A support vector machine classifier is used to determine the presence of defective regions. Local features are extracted within defective regions, and the degree of torsion and brightness anomaly is determined by threshold comparison to obtain a quantitative description of the defect. Finally, the quality scores of each defective region are combined to obtain the overall quality assessment result of the textile. This invention achieves automatic detection and quantitative assessment of torsion and brightness defects in textiles, providing an effective technical means for textile quality control. Attached Figure Description
[0014] Figure 1 This is a flowchart of a textile quality inspection method that integrates multi-scale features according to the present invention.
[0015] Figure 2This is a schematic diagram of a textile quality inspection method that integrates multi-scale features according to the present invention.
[0016] Figure 3 This is another schematic diagram of a textile quality inspection method that integrates multi-scale features according to the present invention. Detailed Implementation
[0017] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0018] like Figure 1 -3. In this embodiment, a textile quality inspection method that integrates multi-scale features may specifically include:
[0019] Step S101: Perform multi-scale decomposition on the textile image to obtain image features at different scales, extract multi-scale feature vectors containing texture and shape information, and obtain multi-scale feature representations that reflect the structural features of the textile's torsion cycle, torsion amplitude, and torsion morphology at different scales.
[0020] Discrete wavelet transform is used to decompose the textile image at multiple scales, obtaining approximation coefficients and detail coefficients at different scales. Based on these approximation and detail coefficients, the gray-level co-occurrence matrix features of each scale sub-image are calculated to obtain texture features; simultaneously, the edge orientation histogram and Zernike moment features of the sub-images are extracted to obtain shape features. A feature concatenation method is used to combine the texture and shape features to form a high-dimensional feature vector containing multi-scale information. If the dimensionality of the high-dimensional feature vector exceeds a preset requirement, principal component analysis is used to reduce the dimensionality of the high-dimensional feature vector to obtain the final multi-scale feature representation. Based on the multi-scale feature representation, a support vector machine regression model is constructed to predict the torsion period, torsion amplitude, and torsion morphology parameters of the textile.
[0021] Specifically, discrete wavelet transform is used to decompose textile images at multiple scales. Daubechies wavelet basis functions are used to decompose the original image into approximation coefficients and detail coefficients at three scales, thereby obtaining image features of the textile at different scales. For each scale of the decomposed sub-image, the energy, contrast, correlation, and entropy of the gray-level co-occurrence matrix are calculated as texture features; simultaneously, edge orientation histograms and Zernike moments are extracted as shape features, resulting in a multi-scale feature vector containing both texture and shape information. A feature concatenation method is used to sequentially combine the texture and shape features extracted at different scales to form a high-dimensional feature vector. Then, principal component analysis is used to reduce the dimensionality of the feature vector, retaining principal components that explain up to 95% of the variance, resulting in the final multi-scale feature representation. This representation reflects the structural characteristics of the textile's torsion period, torsion amplitude, and torsion morphology at different scales. Based on the multi-scale feature representation, a support vector machine-based regression model is designed to predict the torsion period, torsion amplitude, and torsion morphology parameters of the textile. The most representative feature subset is selected from the high-dimensional feature vector to construct a low-dimensional feature representation reflecting the textile's torsion characteristics. When performing multi-scale decomposition on textile images, the discrete wavelet transform method is employed, using the Daubechies 4 wavelet basis function to decompose the original 512×512 pixel image into approximation coefficients and detail coefficients at three scales. For each scale sub-image, the energy, contrast, correlation, and entropy of the gray-level co-occurrence matrix are calculated as texture features, with 8 gray levels, directions of 0°, 45°, 90°, and 135°, and a distance of 1 pixel. Simultaneously, edge orientation histograms and Zernike moments are extracted as shape features, with the edge orientation histogram using 8 orientation bins and the Zernike moment order set to 4. The texture and shape features extracted at different scales are sequentially combined to form a 256-dimensional high-dimensional feature vector. Principal component analysis is used to reduce the dimensionality of the feature vector, retaining principal components that explain up to 95% of the variance, ultimately yielding a 64-dimensional multi-scale feature representation. Based on this multi-scale feature representation, a regression model based on support vector machine is established, using a radial basis function kernel function with a penalty parameter C set to 10 and a kernel parameter γ set to 0.1, to predict the torsion period, torsion amplitude, and torsion morphology parameters of textiles. From the 64-dimensional feature vector, the 32 most representative features are selected as a subset to construct a low-dimensional feature representation reflecting the torsion characteristics of textiles.
[0022] Step S102: For multi-scale feature representation, by calculating the invariant moments of the feature vector, the twist angle and twist direction feature descriptors that remain unchanged under image rotation transformation are obtained, and multi-scale twist feature vectors are generated.
[0023] The feature vectors are converted to polar coordinates, and the amplitude and phase spectra are obtained through Fourier transform. Torsion angle and direction features are extracted from the amplitude and phase spectra to obtain preliminary feature descriptors. Multi-order Zernike moments are calculated using the Zernike moment algorithm to construct multi-order moment features. If the multi-order moment features satisfy the rotation invariance requirement, they are combined with the preliminary feature descriptors to generate a multi-scale torsion feature vector. The multi-scale torsion feature vector is then subjected to min-max normalization to obtain a standardized multi-scale torsion feature vector. Determining whether the standardized multi-scale torsion feature vector satisfies the rotation invariance requirement includes: rotating the original image at multiple angles; extracting feature vectors at each rotation angle; calculating the Euclidean distance between the original feature vector and the feature vectors at each rotation angle; if all distance values are less than a preset threshold, the standardized multi-scale torsion feature vector is determined to satisfy the rotation invariance requirement.
[0024] Specifically, for multi-scale feature representation, polar coordinate Fourier transform is used to process the feature vectors. First, the feature vectors are converted to polar coordinates, and then their Fourier transforms are calculated to obtain the amplitude spectrum and phase spectrum. Rotation-invariant torsion angle features are extracted from the amplitude spectrum, and torsion direction features are extracted from the phase spectrum, combining them to form a preliminary feature descriptor. The Zernike moment algorithm is used to further extract rotation-invariant features. For the feature image at each scale, 3rd, 5th, and 7th order Zernike moments are calculated to construct multi-order moment features. These features are combined with the preliminary feature descriptor to generate a complete multi-scale torsion feature vector, which contains information on the torsion angle and torsion direction of the textile at different scales. The generated multi-scale torsion feature vector is normalized by mapping the feature values to the 0-1 interval using a minimum-maximum normalization method, resulting in a standardized multi-scale torsion feature vector. The rotation invariance of the standardized multi-scale torsion feature vector is verified using a rotation consistency test. First, the original image is rotated by 0°, 90°, 180°, and 270°, and feature vectors at each rotation angle are extracted. Then, the Euclidean distance between the original feature vector and the feature vectors at each rotation angle is calculated. If all distance values are less than the preset threshold of 0.01, the extracted features are deemed to meet the rotation invariance requirement. For a 512×512 pixel textile image, it is first converted to polar coordinates and processed using polar coordinate Fourier transform. In the calculated amplitude spectrum, the first 10 low-frequency components are selected as torsional angle features, and the first 5 high-frequency components are extracted from the phase spectrum as torsional direction features, combining them to form a 16-dimensional preliminary feature descriptor. Next, Zernike moments are calculated for the feature image at each scale, selecting 3rd, 5th, and 7th order moments to obtain 20 moment features. These 20 moment features are combined with the 16-dimensional preliminary feature descriptor to generate a 36-dimensional multi-scale torsional feature vector. This feature vector is then subjected to min-max normalization to map the feature values to the 0-1 interval. To verify rotation invariance, the original 512×512 pixel image is rotated by 0°, 90°, 180°, and 270°, and 36-dimensional feature vectors are extracted respectively. Calculate the Euclidean distance between the original feature vector and the feature vectors at each rotation angle, obtaining four distance values. If all four distance values are less than a preset threshold of 0.01, the extracted features are deemed to meet the rotation invariance requirement.
[0025] Step S103: Construct a gray-level co-occurrence matrix, extract statistical features reflecting the brightness distribution from the textile image, calculate the energy, contrast, and correlation statistics of the gray-level co-occurrence matrix, and obtain a brightness feature vector characterizing the average brightness, brightness contrast, and brightness uniformity of the textile.
[0026] A color image of a textile is acquired, and the red, green, and blue channels of the color image are converted into a single-channel grayscale image using a weighted average method to obtain a textile image matrix. Based on the textile image matrix, a grayscale co-occurrence matrix (GCM) is constructed, which is obtained by statistically analyzing the frequency of grayscale values of adjacent pixel pairs in each direction for each pixel. For each direction of the GCM, three statistics—energy, contrast, and correlation—are calculated. Energy is obtained by calculating the sum of squares of the matrix elements, contrast is obtained by calculating the quadratic moment of the difference matrix, and correlation is obtained by calculating the covariance between the grayscale value and its average value. The arithmetic mean of the statistical results for each direction is taken to obtain the final energy, contrast, and correlation statistics. A maximum-minimum normalization method is used to map the three statistics to the 0-1 interval, generating a final three-dimensional brightness feature vector. This three-dimensional brightness feature vector contains normalized average brightness, brightness contrast, and brightness uniformity values.
[0027] Specifically, grayscale information is extracted from color textile images. A weighted average method is used to convert the red, green, and blue channels into single-channel grayscale images, with weights of 0.299 for red, 0.587 for green, and 0.114 for blue, resulting in a 256-level grayscale textile image matrix. Based on the grayscale textile image matrix, a grayscale co-occurrence matrix (GCMM) is constructed. For each pixel, the frequencies of its neighboring pixels in the four directions (right, bottom right, bottom, and bottom left) are counted, yielding four-directional GCMMs. For each of the four directional GCMMs, three statistics are calculated: energy, contrast, and correlation. Energy is obtained by calculating the sum of squares of the matrix elements; contrast is obtained by calculating the quadratic moment of the difference matrix; and correlation is obtained by calculating the covariance between the grayscale value and its mean. The arithmetic mean of the results in the four directions is then taken to obtain the final energy, contrast, and correlation statistics. Energy is considered as an average brightness index, contrast as a brightness uniformity index, and correlation as a brightness uniformity index, forming a three-dimensional brightness feature vector. The three feature values are mapped to the 0-1 interval using the minimum-maximum normalization method, generating the final three-dimensional brightness feature vector, which includes the normalized average brightness, brightness contrast, and brightness uniformity values. For a 1024x1024 pixel color image of textiles, it is first converted to a grayscale image. Using a weighted average method, the red, green, and blue channel values of each pixel are multiplied by weights of 0.299, 0.587, and 0.114 respectively, and the sum is obtained to obtain the grayscale value. This results in a 1024x1024 grayscale matrix with 256 grayscale levels. Next, a grayscale co-occurrence matrix is constructed, with a distance of 1 pixel and directions of 0°, 45°, 90°, and 135°. For each pixel, the frequency of grayscale value pairs of its neighboring pixels in the four directions is counted, resulting in four 256x256 grayscale co-occurrence matrices. Then, the statistics of the matrix in each direction are calculated: energy is the sum of squares of the matrix elements, contrast is the second moment of the difference matrix, and correlation is the covariance between the grayscale value and its mean. The arithmetic mean of the results from the four directions is taken to obtain the final energy, contrast, and correlation values. Assume the obtained energy value is 0.85, contrast is 0.45, and correlation is 0.62. These three values form the initial feature vector [0.85, 0.45, 0.62]. Finally, maximum and minimum value normalization is performed. Assuming the minimum values of the three features are 0.5, 0.2, and 0.3, and the maximum values are 0.9, 0.7, and 0.8, the normalized feature vector is [0.875, 0.5, 0.64]. This three-dimensional vector is the final luminance feature vector, representing the normalized average luminance, luminance contrast, and luminance uniformity, respectively.
[0028] Step S104: Calculate the correlation coefficients between the torsion frequency and torsion density in the multi-scale torsion feature vector and the brightness gradient and brightness change rate in the brightness feature vector to determine the degree of correlation between the torsion features and the brightness features.
[0029] A multi-scale torsion feature vector is obtained, and torsion frequency data and torsion density data are extracted from it. The torsion frequency data is obtained by calculating the reciprocal of the torsion period, and the torsion density data is obtained by counting the number of torsions per unit area. Based on the brightness feature vector, the Sobel operator is used to calculate the horizontal and vertical gradients of the image to obtain the brightness gradient. The brightness change rate is obtained by calculating the sum of the absolute values of the brightness differences between adjacent pixels divided by the total number of pixels. The torsion frequency, torsion density, brightness gradient, and brightness change rate are combined to form a 4-dimensional feature vector. For this 4-dimensional feature vector, the Pearson correlation coefficient algorithm is used to calculate the correlation coefficients between each pair of features, forming a 4x4 correlation coefficient matrix. It is determined whether the absolute value of any off-diagonal element in the correlation coefficient matrix is greater than a preset threshold. If the absolute value of any off-diagonal element in the correlation coefficient matrix is greater than the preset threshold, it is determined to be significantly correlated. Based on the significantly correlated feature pairs, an intrinsic relationship is determined between textile quality and the corresponding features. Through this intrinsic relationship, a quantitative analysis of the correlation between torsion features and brightness features is achieved.
[0030] Specifically, torsion frequency and torsion density data are extracted from the multi-scale torsion feature vector. Temporal analysis is performed on the torsion frequency data, and the reciprocal of the torsion period is calculated to obtain the frequency value. For the torsion density data, the number of torsions per unit area is counted. The brightness feature vector is processed by using the Sobel operator to calculate the horizontal and vertical gradients of the image, and then calculating the gradient magnitude as the brightness gradient. The brightness change rate is obtained by summing the absolute values of the brightness differences between adjacent pixels and dividing by the total number of pixels. The four features—torsion frequency, torsion density, brightness gradient, and brightness change rate—are combined into a 4-dimensional feature vector. The Pearson correlation coefficient algorithm is used to calculate the correlation coefficients between each pair of these four features, forming a 4x4 correlation coefficient matrix. A correlation coefficient threshold of 0.7 is set. If the absolute value of any off-diagonal element in the correlation coefficient matrix is greater than 0.7, it is considered significantly correlated. Based on the significantly correlated feature pairs, an intrinsic relationship between textile quality and the corresponding features is determined. For a 1024x1024 pixel textile image, torsion frequency and torsion density data are extracted from the multi-scale torsion feature vector. Temporal analysis revealed a torsion period of 20 pixels, resulting in a torsion frequency of 0.05 times / pixel. Statistical analysis showed an average of 25 torsions per 100x100 pixel area, yielding a torsion density of 0.0025 times / pixel². Applying a 3x3 Sobel operator to the luminance feature vector, the horizontal and vertical gradients were calculated, resulting in a gradient magnitude matrix as the luminance gradient. The sum of the absolute values of the luminance differences between adjacent pixels was calculated as 5,242,880, divided by the total number of pixels (1,048,576), yielding a luminance change rate of 5. A 4-dimensional feature vector [0.05, 0.0025, 50, 5] was constructed using the torsion frequency (0.05), torsion density (0.0025), average luminance gradient (50), and luminance change rate (5). The Pearson correlation coefficient algorithm was used to calculate the pairwise correlation coefficients between these four features, resulting in a 4x4 correlation coefficient matrix. Assuming the correlation coefficient between torsion frequency and brightness gradient in the matrix is 0.82, and the correlation coefficient between torsion density and brightness change rate is 0.75, both exceeding the set threshold of 0.7, it is determined that there is a significant correlation between torsion frequency and brightness gradient, and between torsion density and brightness change rate. This establishes an intrinsic link between textile quality and these characteristics, providing quantitative data support for textile quality assessment.
[0031] Step S105: Based on the correlation between the multi-scale torsion feature vector and the brightness feature vector, select the main feature components of the torsion region feature in the multi-scale torsion feature vector and the brightness dynamic range feature in the brightness feature vector, and then fuse them to form a comprehensive feature vector.
[0032] Based on the correlation coefficient matrix, features with high correlation coefficients are assigned corresponding weights to obtain weighted multi-scale torsional features. Principal component analysis is used to process the torsional region features in the weighted multi-scale torsional features, and principal components with cumulative contribution rates reaching a preset threshold are selected as the main feature components to obtain the dimensionality-reduced torsional region feature vector. For the brightness dynamic range features in the brightness features, wavelet transform is applied to extract brightness change information at different scales, and wavelet coefficients of the top N scales with the largest energy proportions are selected as the main feature components to form the dimensionality-reduced brightness dynamic range feature vector. The Euclidean distance between the dimensionality-reduced torsional region feature vector and the brightness dynamic range feature vector is calculated, and a weight matrix is constructed based on the Euclidean distance. The two feature vectors are then weighted and fused using the weight matrix to obtain a preliminary comprehensive feature vector. Data distribution analysis is performed on each component in the preliminary comprehensive feature vector. If the component is approximately normally distributed, z-score standardization is used; if the component is not normally distributed, min-max normalization is used. All standardized features are combined to obtain the final comprehensive feature vector.
[0033] Specifically, based on the previously calculated correlation coefficient matrix of torsion and brightness features, features with higher correlation coefficients are assigned greater weights. Then, principal component analysis is performed on the torsion region features in the weighted multi-scale torsion features, selecting the principal components with a cumulative contribution rate of 95% as the main feature components, resulting in a dimensionality-reduced torsion region feature vector. Wavelet transform is applied to the brightness dynamic range features in the brightness features to extract brightness variation information at different scales. The wavelet coefficients of the three scales with the largest energy proportions are selected as the main feature components, forming a dimensionality-reduced brightness dynamic range feature vector. A distance-based feature fusion method is used to calculate the Euclidean distance between the dimensionality-reduced torsion region feature vector and the brightness dynamic range feature vector, constructing a weight matrix based on the distance. The two feature vectors are then weighted and fused using the weight matrix to obtain a preliminary comprehensive feature vector. Data distribution analysis is performed on each component in the preliminary comprehensive feature vector. Features with approximately normal distributions are standardized using z-scores, while non-normally distributed features are normalized using min-max normalization. Finally, all standardized features are combined to obtain the final comprehensive feature vector, achieving a comprehensive characterization of textile quality. For a 1024x1024 pixel textile image, based on the previously calculated correlation coefficient matrix, the correlation coefficient between torsion frequency and brightness gradient was found to be 0.85, and the correlation coefficient between torsion density and brightness change rate was 0.78. Therefore, these features were assigned a weight of 1.5. Principal component analysis was performed on the weighted torsion region features, selecting the top three principal components, whose cumulative contribution reached 96.7%. A level 4 discrete wavelet transform was applied to the brightness dynamic range features, selecting the wavelet coefficients of the top three scales with the largest energy proportions, accounting for 45%, 30%, and 15% of the total energy, respectively. The Euclidean distance between the dimension-reduced torsion region feature vector (3 dimensions) and the brightness dynamic range feature vector (3 dimensions) was calculated, yielding a distance value of 0.6. A weight matrix was constructed, with a weight of 0.4 for the torsion feature and 0.6 for the brightness feature. The two feature vectors were then weighted and fused to obtain a preliminary 6-dimensional comprehensive feature vector. Data distribution analysis of these 6 feature components revealed 4 approximately normal distributions and 2 skewed distributions. The features of the normally distributed pattern are standardized using z-scores, while the features of the skewed pattern are normalized using min-max normalization. The resulting standardized 6-dimensional comprehensive feature vector contains information on local torsional variations and overall brightness dynamic range of the textile, thus providing a comprehensive characterization of the textile's quality.
[0034] Step S106: Based on the comprehensive feature vector, a support vector machine classifier is used to classify the textile image to determine whether the textile has defective areas such as abnormal torsion areas or abnormal brightness dynamic range.
[0035] A training dataset containing normal samples and known defective samples is obtained. For each sample in the training dataset, a comprehensive feature vector is extracted and labeled as either normal or defective. Based on the comprehensive feature vector, a support vector machine classifier with a radial basis function kernel is used to perform binary classification on the textile images. The optimal penalty parameter C and kernel parameter γ are determined to obtain a classification hyperplane. The comprehensive feature vector of the textile image to be detected is classified through the classification hyperplane, and the classification result and confidence score are obtained. If the classification result is a defective category and the confidence score is greater than a preset threshold, a quality defect is determined to exist. For textile images determined to have quality defects, a multi-scale sliding window method is used. Windows of different sizes are used to scan the textile image, and feature vectors are extracted and classified for each window region. Local regions classified as defects are clustered, and the feature vectors of the cluster centers are obtained. The feature vectors are then used to classify the defect type to determine the specific type of defect.
[0036] Specifically, a training dataset containing normal samples and known defective samples is first constructed. A comprehensive feature vector is extracted from each sample, labeling it as either normal or defective. Based on the comprehensive feature vector, a support vector machine (SVM) classifier with a radial basis function kernel is used to perform binary classification of textile images. The optimal penalty parameter C and kernel parameter γ are determined using a grid search method and 5-fold cross-validation, and the classification model is trained to obtain the classification hyperplane. The trained SVM classifier is then used to classify the comprehensive feature vector of the textile image to be detected, obtaining the classification result and confidence score. A confidence threshold of 0.8 is set. If the classification result is a defect and the confidence score is greater than 0.8, a quality defect is determined to exist; otherwise, it is determined to be normal. If a quality defect is determined, a multi-scale sliding window method is used, scanning the original image using windows of three different sizes: 32x32, 64x64, and 128x128 pixels, with a stride set to 1 / 4 of the window size. Feature vectors are extracted and classified for each window region. Local regions classified as defects are clustered, with a minimum sample size of 5 and a neighborhood radius of 20 pixels. For the feature vector of each cluster center, the decision tree algorithm is used to classify the defect type. Two main defect types, torsion anomaly and brightness anomaly, are predefined to determine the specific type of defect.
[0037] For a batch of 2000 textile images, including 1600 normal samples and 400 known defect samples, each image is 1024x1024 pixels in size. First, a 256-dimensional comprehensive feature vector is extracted from each image to construct a training dataset. A support vector machine classifier with radial basis function kernel is used. Parameter optimization is performed within the range of C = [0.1, 1, 10, 100] and γ = [0.001, 0.01, 0.1, 1] using a grid search method. The optimal parameters C = 10 and γ = 0.01 are obtained using 5-fold cross-validation. After training, a comprehensive feature vector is extracted from a new textile image to be detected and classified. The classification result is a defect category with a confidence score of 0.92, exceeding the set threshold of 0.8, indicating the presence of a quality defect. Subsequently, a multi-scale sliding window method was used to scan the image with windows of 32x32, 64x64, and 128x128 pixels, with a stride of 1 / 4 of the window size, generating a total of 15,625 local regions. Feature vectors were extracted and classified for each local region, identifying 67 regions as defects. The DBSCAN algorithm was used to cluster these 67 defect regions, setting a minimum sample size of 5 and a neighborhood radius of 20 pixels, resulting in two cluster centers. Finally, the C4.5 decision tree algorithm was used to classify the feature vectors of the two cluster centers, determining one to be a torsion anomaly and the other a brightness anomaly, thus identifying the specific location and type of the defect.
[0038] Step S107: Within the defect area, extract local features such as torsion angle, torsion amplitude, average brightness, and brightness contrast. By comparing thresholds, determine the degree of torsion and brightness abnormality of the defect area to obtain a quantitative description of the defect.
[0039] The local directional field of the defective region is extracted, and the responses in multiple directions within a multi-angle range are calculated. Based on these responses, the direction with the strongest response is selected as the torsion angle, and the torsion amplitude is obtained by calculating the standard deviation of the multiple directional responses. The defective region is grayscaled, and the average grayscale value of the pixels within the region is obtained as the average brightness feature. Brightness contrast is calculated using a sliding window of a preset pixel size to calculate the local entropy value of each pixel, and the average value of the local entropy within the region is taken as the brightness contrast feature. Based on statistics from normal textile samples, a normal range for torsion angles is defined; the extracted torsion features are compared with the normal range, and the degree of deviation is calculated as a quantitative description of torsion anomalies. Normal textile samples are analyzed to establish a database of normal brightness ranges. The mean and standard deviation of the average brightness and brightness contrast of normal samples are calculated to define the normal brightness range. The extracted brightness features are compared with the normal brightness range, and the degree of deviation is calculated as a quantitative description of brightness anomalies.
[0040] Specifically, for the identified defective areas, a Gabor filter bank is used to extract the local directional field, calculating the responses in 12 directions within the range of 0° to 180° with a step size of 15°. The direction with the strongest response is selected as the torsion angle, and the torsion amplitude is obtained by calculating the standard deviation of the 12 directional responses, thus acquiring the torsion feature vector of the defective area. The defective area is then grayscaled, and the average grayscale value of the pixels within the area is calculated as the average brightness feature. A local entropy algorithm is used to calculate the brightness contrast, calculating the local entropy value of each pixel using a 3x3 pixel sliding window, and taking the average local entropy within the area as the brightness contrast feature, forming the brightness feature vector of the defective area. Based on statistics of normal textile samples, the normal range of the torsion angle is set as the main direction ±15°, and the threshold for the torsion amplitude is the mean amplitude of normal samples plus twice the standard deviation. The extracted torsion features are compared with these thresholds, and the degree of exceedance is calculated as a quantitative description of the torsion anomaly. By analyzing a large number of normal textile samples, a database of normal brightness ranges is established. The mean and standard deviation of the average brightness and brightness contrast of normal samples are calculated, and the normal range is defined as the mean ± 2 times the standard deviation. The extracted brightness features are compared with this range, and the degree of deviation is calculated as a quantitative description of the brightness anomaly, thereby achieving a comprehensive quantitative characterization of the defect.
[0041] For a 128x128 pixel identified defect area, 12 Gabor filters (0° to 165°, 15° step) were first applied to extract the local orientation field. The calculation results showed that the 45° direction had the strongest response, with a value of 0.85, which was identified as the torsion angle. The standard deviation of the 12 orientation responses was 0.12, which was used as the torsion amplitude. After grayscale processing of the area, the average grayscale value was calculated to be 128.5. A 3x3 pixel sliding window was used to calculate the local entropy, yielding an average local entropy of 4.2, which was used as the brightness contrast feature. Based on statistical analysis of 1000 normal textile samples, the normal range for the torsion angle was set at 30°.
[0042] The torsion angle was set to 60°, with a threshold of 0.1. Comparison revealed that while the torsion angle of the current defective area was within the normal range, the torsion amplitude exceeded the threshold by 0.02, quantitatively describing the degree of torsion abnormality as 20%. In the normal brightness range database, the mean average brightness was 120 with a standard deviation of 10; the mean brightness contrast was 3.8 with a standard deviation of 0.3. Comparison results showed that the average brightness of the current defective area was 8.5 units higher than normal, exceeding the normal range by 0.85 standard deviations; the brightness contrast was 0.4 units higher than normal, exceeding the normal range by 1.33 standard deviations. The overall quantitative description of the brightness abnormality in this defective area was 13.3%. These quantitative analyses comprehensively characterized the torsion and brightness abnormality characteristics of the defective area.
[0043] Step S108: Combining the torsional and brightness characteristics of the defective areas, calculate the comprehensive quality score of the defective areas to obtain a quantitative assessment result reflecting the local quality of the textile. By combining the comprehensive quality scores of each defective area, obtain the overall quality assessment score of the textile for a comprehensive evaluation of its quality.
[0044] Based on the torsion and brightness characteristics of the defective region, a comprehensive quality score for the defective region is calculated. This calculation includes adjusting the weights of the torsion and brightness characteristics according to the defect type; mapping the torsion and brightness characteristic values to a preset range using a Sigmoid function; and weighted summing of the mapped characteristic values to obtain a local quality assessment result for the defective region. The DBSCAN algorithm is used to spatially cluster the defective region, yielding clustering results. The neighborhood radius of the DBSCAN algorithm is a preset pixel value, and the minimum number of samples is a preset value. An average comprehensive quality score is calculated for each cluster in the defective region clustering results to obtain local quality assessment results for different defect types. The area proportion of the defective region is obtained. This involves calculating the number of pixels in the defective region; dividing the number of pixels in the defective region by the total number of pixels in the textile image; multiplying the comprehensive quality score of the defective region by the area proportion, and summing the results to obtain the overall quality assessment score of the textile. Establish a fuzzy set of defect quantity, defect area ratio, and overall quality assessment score; define a preset number of quality levels; set fuzzy rules for the fuzzy set; perform fuzzy inference on the fuzzy rules using the Mamdani inference method; and defuzzify the fuzzy inference results using the centroid method to obtain the final quality level.
[0045] Specifically, an adaptive weighting method is used to calculate the comprehensive quality score based on the torsion and brightness characteristics of the defect area. The weights of the torsion and brightness characteristics are automatically adjusted according to the defect type; for torsion defects, the weight of the torsion characteristic is higher; for brightness defects, the weight of the brightness characteristic is higher. The sigmoid function is used to map the feature values to the range of 0-1, and then a weighted sum is performed to obtain a quantitative assessment result reflecting the local quality of the defect area. A comprehensive quality score is calculated for all identified defect areas in the textile image. The DBSCAN algorithm is used to spatially cluster the defect areas, setting the neighborhood radius to 20 pixels and the minimum sample size to 2. The average comprehensive quality score is calculated for each cluster to obtain the local quality assessment results for different defect types. The area of each defect area is calculated using a pixel counting method and divided by the total number of pixels in the entire textile image to obtain the area percentage. The comprehensive quality score of each defect area is multiplied by its area percentage, and the sum is obtained to obtain the overall quality assessment score of the textile. Three fuzzy sets are established for the number of defects, the defect area percentage, and the overall quality assessment score. Five quality levels are defined as excellent, good, average, poor, and unacceptable. A fuzzy rule was set, such as "if the number of defects is small, the area ratio is small, and the overall evaluation score is high, then the quality level is excellent." The Mamdani inference method and the centroid method were used for defuzzification to obtain the final quality level, achieving a comprehensive evaluation of textile quality. For a 4096x4096 pixel textile image, five defect regions were identified. The first defect region had a torsion feature value of 0.8 and a brightness feature value of 0.3, and was identified as a torsion defect. Adaptive weights were set to 0.7 and 0.3. The Sigmoid function was used to map the feature values to the 0-1 range, resulting in 0.92 and 0.42. After weighted summation, the overall quality score was 0.77. The DBSCAN algorithm was applied to the five defect regions, with a neighborhood radius of 20 pixels and a minimum sample size of 2, resulting in two clusters. The first cluster contained three defects with an average overall quality score of 0.75; the second cluster contained two defects with an average overall quality score of 0.62. The pixel counting method calculated that the areas of the five defect regions accounted for 0.2%, 0.3%, 0.1%, 0.4%, and 0.2% of the total area, respectively. After weighted averaging, the overall quality assessment score of the textile was 0.71. A fuzzy set was established, with the number of defects (5) corresponding to a membership degree of 0.6, the defect area percentage (1.2%) corresponding to a membership degree of 0.4, and the overall quality assessment score (0.71) corresponding to a membership degree of 0.7. Applying the fuzzy rule "If the number of defects is moderate and the area percentage is small, and the overall assessment score is high, then the quality level is good," and using the Mamdani inference method and the centroid method to defuzzify, the final quality level "good" was obtained with a membership degree of 0.65, achieving a comprehensive quantitative assessment of the textile quality.
[0046] It should be noted that the above examples are merely some specific embodiments of the present invention. Obviously, the present invention is not limited to the above embodiments and many variations are possible. All variations that can be directly derived or conceived by those skilled in the art from the content disclosed in this invention should be considered within the scope of protection of this invention.
Claims
1. A method for textile quality detection fusing multi-scale features, characterized in that, The method comprises: performing multi-scale decomposition on the textile image to obtain image features at different scales, extract multi-scale feature vectors containing texture and shape information, and obtain multi-scale feature representations reflecting the structural characteristics of the twist period, twist amplitude and twist morphology of the textile at different scales; for the multi-scale feature representations, obtain twist angle and twist direction feature descriptors that remain unchanged under image rotation transformation by calculating the moment invariants of the feature vectors, and generate multi-scale twist feature vectors; construct a gray level co-occurrence matrix to extract statistical features reflecting brightness distribution from the textile image, calculate the energy, contrast and correlation statistics of the gray level co-occurrence matrix, and obtain a brightness feature vector representing the average brightness, brightness contrast and brightness uniformity of the textile; calculate the correlation coefficients between the twist frequency and twist density in the multi-scale twist feature vector and the brightness gradient and brightness change rate in the brightness feature vector to determine the correlation degree of the twist features and the brightness features; based on the correlation degree of the multi-scale twist feature vector and the brightness feature vector, select the main feature components in the twist region feature of the multi-scale twist feature vector and the brightness dynamic range feature of the brightness feature vector, and then fuse them to form a comprehensive feature vector; according to the comprehensive feature vector, use a support vector machine classifier to classify the textile image to determine whether the textile has a defect region with twist region abnormality or brightness dynamic range abnormality; in the defect region, extract local features such as twist angle, twist amplitude, average brightness and brightness contrast, compare them with thresholds, determine the twist degree and brightness abnormality degree of the defect region, and obtain a quantitative description of the defect; integrate the twist features and brightness features of the defect region, calculate the comprehensive quality score of the defect region, obtain a quantitative evaluation result reflecting the local quality of the textile, combine the comprehensive quality scores of each defect region, and obtain a quality evaluation score of the entire textile to comprehensively evaluate the quality of the textile.
2. The method of claim 1, wherein, The method comprises: performing multi-scale decomposition on the textile image to obtain image features at different scales, extract multi-scale feature vectors containing texture and shape information, and obtain multi-scale feature representations reflecting the structural characteristics of the twist period, twist amplitude and twist morphology of the textile at different scales; performing multi-scale decomposition on the textile image to obtain image features at different scales, extract multi-scale feature vectors containing texture and shape information, and obtain multi-scale feature representations reflecting the structural characteristics of the twist period, twist amplitude and twist morphology of the textile at different scales; extract the edge direction histogram and Zernike moment features of the sub-image to obtain shape features; combine the texture features and shape features using a feature concatenation method to form a high-dimensional feature vector containing multi-scale information; if the dimension of the high-dimensional feature vector is higher than the preset requirement, use principal component analysis to reduce the dimension of the high-dimensional feature vector to obtain the final multi-scale feature representation; based on the multi-scale feature representation, construct a support vector machine regression model, which is used to predict the twist period, twist amplitude and twist morphology parameters of the textile.
3. The method of claim 1, wherein, The multi-scale twist feature vector is generated by calculating the invariant moment of the feature vector, obtaining the twist angle and twist direction feature descriptor which remains unchanged under image rotation transformation, and including: The feature vector is converted into polar coordinate representation, and the amplitude spectrum and phase spectrum are obtained by Fourier transform; The twist angle feature and twist direction feature are extracted according to the amplitude spectrum and phase spectrum, and a preliminary feature descriptor is obtained; A multi-order Zernike moment is calculated by using a Zernike moment algorithm, and a multi-order moment feature is constructed; If the multi-order moment feature meets the rotation invariance requirement, the multi-scale twist feature vector is generated by combining the preliminary feature descriptor; The multi-scale twist feature vector is normalized by minimum-maximum normalization processing, and a standardized multi-scale twist feature vector is obtained; It is judged whether the standardized multi-scale twist feature vector meets the rotation invariance requirement, including: the original image is rotated at multiple angles; The feature vector under each rotation angle is extracted; The Euclidean distance between the original feature vector and the feature vector at each rotation angle is calculated; If all distance values are less than a preset threshold, it is determined that the standardized multi-scale twist feature vector meets the rotation invariance requirement.
4. The method of claim 1, wherein, The gray level co-occurrence matrix is constructed, the statistical features reflecting the brightness distribution are extracted from the textile image, the energy, contrast and correlation statistics of the gray level co-occurrence matrix are calculated, and the brightness feature vector representing the average brightness, brightness contrast and brightness uniformity of the textile is obtained, including: A textile color image is obtained, and a weighted average method is used to convert the red, green and blue three channels of the color image into a single channel gray image, and a textile image matrix is obtained; The gray level co-occurrence matrix is constructed according to the textile image matrix, and the gray level co-occurrence matrix is obtained by counting the gray value frequency of each pixel point in each direction; For each direction gray level co-occurrence matrix, the energy, contrast and correlation of each matrix are calculated, wherein the energy is obtained by calculating the square sum of the matrix elements, the contrast is obtained by calculating the second moment of the difference matrix, and the correlation is obtained by calculating the covariance of the gray value and its average value; The statistical results of each direction are taken as the arithmetic mean value to obtain the final energy, contrast and correlation statistics; The three statistics are mapped to the 0-1 interval by using the maximum and minimum value normalization method to generate the final three-dimensional brightness feature vector, and the three-dimensional brightness feature vector contains the normalized average brightness, brightness contrast and brightness uniformity values.
5. The method of claim 1, wherein, The correlation coefficients between the twist frequency and twist density in the multi-scale twist feature vector and the brightness gradient and brightness change rate in the brightness feature vector are calculated to determine the correlation degree of the twist feature and the brightness feature, including: The multi-scale twist feature vector is obtained, and the twist frequency data and twist density data are extracted from the multi-scale twist feature vector; The twist frequency data is obtained by calculating the inverse of the twist period, and the twist density data is obtained by counting the number of twists per unit area; The brightness gradient is obtained by calculating the horizontal and vertical direction gradients of the image using the Sobel operator according to the brightness feature vector; The rate of change of brightness is obtained by summing the absolute values of the brightness differences between adjacent pixels and dividing by the total number of pixels. The torsion frequency, the torsion density, the brightness gradient, and the brightness change rate are combined to form a 4-dimensional feature vector; For the 4-dimensional feature vector, the Pearson correlation coefficient algorithm is used to calculate the correlation coefficient between each pair of features, forming a 4x4 correlation coefficient matrix; Determine whether the absolute value of the off-diagonal elements in the correlation coefficient matrix is greater than a preset threshold; If the absolute value of any off-diagonal element in the correlation coefficient matrix is greater than the preset threshold, it is determined to be significantly correlated. Based on the significantly correlated feature pairs, an intrinsic relationship is determined between textile quality and the corresponding features; Through this intrinsic connection, a quantitative analysis of the correlation between torsional features and brightness features can be achieved.
6. The method of claim 1, wherein, Based on the correlation between the multi-scale torsion feature vector and the brightness feature vector, the main feature components of the torsion region feature in the multi-scale torsion feature vector and the brightness dynamic range feature in the brightness feature vector are selected and fused to form a comprehensive feature vector, including: Based on the correlation coefficient matrix, the features with high correlation coefficients are assigned corresponding weights to obtain the weighted multi-scale torsion features. Principal component analysis is used to process the torsional region features in the weighted multi-scale torsional features. Principal components with a cumulative contribution rate reaching a preset threshold are selected as the main feature components to obtain the dimension-reduced torsional region feature vector. For the brightness dynamic range feature in the brightness feature, wavelet transform is applied to extract brightness change information at different scales, and the wavelet coefficients of the N scales with the largest energy proportion are selected as the main feature components to form a dimension-reduced brightness dynamic range feature vector. Calculate the Euclidean distance between the dimension-reduced torsion region feature vector and the brightness dynamic range feature vector, construct a weight matrix based on the Euclidean distance, and perform weighted fusion of the two feature vectors using the weight matrix to obtain a preliminary comprehensive feature vector; For each component in the preliminary integrated feature vector, data distribution analysis is performed. If the component is approximately normally distributed, z-score standardization is used. If the component is not normally distributed, min-max normalization is used. All standardized features are combined to obtain the final integrated feature vector.
7. The method of claim 1, wherein, The step of classifying textile images using a support vector machine classifier based on comprehensive feature vectors to determine whether the textiles have defective areas such as abnormal twisting regions or abnormal dynamic range of brightness, includes: Obtain a training dataset containing normal samples and known defective samples, extract a comprehensive feature vector for each sample in the training dataset, and label it as normal or defective; Based on the comprehensive feature vector, a support vector machine classifier with radial basis function kernel is used to perform binary classification on textile images, determine the optimal penalty parameter C and kernel parameter γ, and obtain the classification hyperplane. The comprehensive feature vector of the textile image to be detected is classified through the classification hyperplane to obtain the classification result and confidence score; If the classification result is a defect category and the confidence score is greater than a preset threshold, then a quality defect is determined to exist. For textile images that are determined to have quality defects, a multi-scale sliding window method is used. The textile image is scanned using windows of different sizes, and feature vectors are extracted and classified for each window region. Clustering is performed on local regions classified as defects to obtain the feature vectors of the cluster centers. The feature vectors are then used to classify the defect types to determine the specific types of defects.
8. The method of claim 1, wherein, Within the defect area, local features such as torsion angle, torsion amplitude, average brightness, and brightness contrast are extracted. Through threshold comparison, the degree of torsion and brightness anomaly in the defect area are determined to obtain a quantitative description of the defect, including: Extract the local orientation field of the defect region and calculate the response in multiple directions within a multi-angle range; Based on the directional response, the direction with the strongest response is selected as the torsion angle, and the torsion amplitude is obtained by calculating the standard deviation of the multiple directional responses. The defective area is converted to grayscale, and the average grayscale value of the pixels in the area is obtained as the average brightness feature. To calculate the brightness contrast, a sliding window of a preset pixel size is used to calculate the local entropy value of each pixel, and the average value of the local entropy within the region is taken as the brightness contrast feature. Based on statistics from normal textile samples, a normal range for torsion angles was defined; The extracted torsional features are compared with the normal range of torsional angles, and the degree of deviation is calculated as a quantitative description of torsional anomaly. Analyze normal textile samples and establish a database of normal brightness ranges; Calculate the mean and standard deviation of the average brightness and brightness contrast of normal samples, and define the normal range of brightness; The extracted brightness features are compared with the normal brightness range, and the degree of deviation is calculated as a quantitative description of the brightness anomaly.
9. The method of claim 1, wherein, The torsional and brightness characteristics of the comprehensive defect areas are used to calculate the comprehensive quality score of the defect areas, resulting in a quantitative assessment of the local quality of the textile. Combining the comprehensive quality scores of each defect area, an overall quality assessment score for the textile is obtained for a comprehensive evaluation of the textile quality, including: Calculate the overall quality score of the defect area based on its torsion and brightness characteristics; The comprehensive quality score for the calculated defect region includes adjusting the weights of the torsion feature and the brightness feature according to the defect type; The Sigmoid function is used to map the torsion eigenvalues and brightness eigenvalues to a preset range; The mapped feature values are weighted and summed to obtain the local quality assessment results of the defect area; The DBSCAN algorithm is used to perform spatial clustering of the defect region to obtain the defect region clustering results; The neighborhood radius of the DBSCAN algorithm is a preset pixel value, and the minimum number of samples is a preset value. The average comprehensive quality score is calculated for each cluster in the defect region clustering results to obtain the local quality assessment results for different defect types; Obtain the area percentage of the defective region; The method of obtaining the area ratio of the defective region includes: calculating the number of pixels in the defective region; Divide the number of pixels in the defective area by the total number of pixels in the textile image; Multiply the comprehensive quality score of the defective area by the area ratio, and sum them to obtain the overall quality assessment score of the textile. Establish fuzzy sets for the number of defects, the percentage of defect area, and the overall quality assessment score; Define a preset quantity of quality grades; Set the fuzzy rules for the fuzzy set; The fuzzy rules are subjected to fuzzy inference using the Mamdani inference method. The centroid method is used to defuzzify the fuzzy inference results to obtain the final quality level.
Citation Information
Patent Citations
Textile defect detection method based on defect enhancement
CN102331425A
Image analysis method based on multi-scale and multi-zone woven fabric knitting tightness
CN104715477A