Defect detection method based on fabric texture correlation
By calculating the autocorrelation coefficient and Pearson correlation coefficient of local fabric images, the problems of low efficiency of manual observation and lack of deep learning samples in fabric defect detection are solved, and efficient and accurate defect detection is achieved.
Patent Information
- Application Number
- CN202511598486.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-04
- Publication Date
- 2025-12-02
AI Technical Summary
In existing technologies, fabric defect detection relies on manual observation, which is inefficient and prone to missed or false detections. Deep learning methods are inefficient in training scenarios with scarce samples and cannot fully leverage their feature extraction and learning capabilities.
By calculating the autocorrelation coefficient of a local image of the fabric, performing binarization processing, and then calculating the Pearson correlation coefficient, texture correlation is used to identify defects, and a texture structure correlation threshold is set to determine whether there are defects in the fabric.
It enables efficient and accurate detection of fabric defects without requiring a large number of samples, improving the accuracy and efficiency of detection and adapting to fabrics with complex textures.
Smart Images

Figure CN121053141A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of fabric defect detection technology, and relates to a defect detection method based on fabric texture correlation. Background Technology
[0002] Fabrics may develop various defects during production, such as holes, stains, and broken yarns, which affect the quality and usability of the fabric. Traditional fabric defect detection methods mainly rely on manual visual inspection, which is inefficient, labor-intensive, and prone to missed or false detections. In recent years, deep learning vision detection has been widely applied, and various defect detection methods for fabrics based on deep network points have been proposed.
[0003] For example, Chinese patent CN202010781797.9 proposes a defect detection method based on an improved Faster R-CNN, which improves the detection accuracy of small target defects by introducing a feature pyramid network model. Patent CN202411537802.6 discloses a high-precision fabric defect detection method based on the fusion of a lightweight hybrid aggregation network and enhanced generalized features. Using YOLOv8 as the backbone network and EGFPN as the neck structure, it not only significantly improves the accuracy of defect detection but also enhances the model's adaptability and generalization performance.
[0004] However, the randomness and low incidence of fabric defects pose a significant challenge to the collection of large-scale defect samples. This predicament severely restricts the training efficiency of deep networks in fabric defect detection, making it difficult to fully utilize their powerful feature extraction and learning capabilities.
[0005] Therefore, developing a defect detection method based on fabric texture correlation that does not rely on a large number of defect samples can not only make up for the performance shortcomings of deep networks in scenarios with scarce samples, but also significantly improve the universality and accuracy of fabric defect detection. This has important practical significance and application value for promoting the development of quality inspection technology in the textile industry. Summary of the Invention
[0006] The purpose of this invention is to solve the problems existing in the prior art and provide a defect detection method based on fabric texture correlation.
[0007] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0008] A defect detection method based on fabric texture correlation includes the following steps:
[0009] (1) Local image acquisition: Divide the fabric image A to be detected into w×w sub-windows, and expand each sub-window into a one-dimensional vector of dimension w×w by column or row, denoted as {xi}∈R w×w ;
[0010] (2) First calculation of autocorrelation coefficient: For the local image of the fabric {x i Calculate the autocorrelation coefficient to obtain the autocorrelation curve. ;
[0011] (3) Binarization: For the autocorrelation coefficient curve Binarization is performed to convert the autocorrelation coefficient curve into a binary curve, denoted as . ;
[0012] (4) Second calculation of autocorrelation coefficient: for binary curves Calculate the autocorrelation coefficient to obtain the autocorrelation curve. ;
[0013] (5) Fabric texture correlation extraction: Applying steps (2) to (4), calculate the autocorrelation curve of the fabric image A to be detected and the autocorrelation curve of the fabric image A after binarization. The autocorrelation curve after binarization is denoted as The fabric texture correlation T is defined as follows:
[0014] T=PLCC( );
[0015] Among them, PLCC ( ) indicates calculation and The Pearson correlation coefficient between them;
[0016] (6) Defect judgment: Set a texture structure correlation threshold θ. When the fabric texture correlation T is lower than the threshold, it is judged that there is a defect; otherwise, it is judged that there is no defect.
[0017] Because normal fabric textures typically exhibit good regularity, the autocorrelation function of any local image region will show periodic correlation. When defects exist in a localized area of the fabric texture, the regularity of the texture in that area is disrupted. In this case, the autocorrelation function calculation for that area will not show obvious periodicity. However, since defects generally exist in localized areas and do not affect the periodicity of the autocorrelation function of the fabric image, a low texture correlation indicates the presence of a defect. Therefore, this invention effectively determines the presence of defects by utilizing whether the fabric texture correlation is below a set threshold.
[0018] As a preferred technical solution:
[0019] As described above, in a defect detection method based on fabric texture correlation, the size of the fabric image A to be detected in step (1) is 300×300~400×400, and the large image can be cropped to this size range.
[0020] In the defect detection method based on fabric texture correlation described above, w is 32~40 in step (1).
[0021] As described above, in the defect detection method based on fabric texture correlation, the autocorrelation curve in step (2) The calculation formula is:
[0022] ;
[0023] in, It is the pixel value of the i-th pixel. It is 1≦i≦N- Time series { The average value of} yes ≦i≦N time series { The average value of} is τ, where τ is the displacement and N is the number of pixels in the sequence. τ < N. For example, given a sequence with N = 4 elements, such as 1, 2, 3, 4, when τ = 2, starting from the third number, the extracted sequence is 3, 4.
[0024] The autocorrelation curve in step (4) The calculation formula can be derived by analogy.
[0025] In the defect detection method based on fabric texture correlation described above, the average value of the autocorrelation curve is used as the threshold for binarization in step (3).
[0026] In the defect detection method based on fabric texture correlation described above, the value range of T in step (5) is [-1, 1]. Since the Pearson correlation coefficient ranges from [-1, 1], the fabric texture correlation T ranges from [-1, 1]. The larger the value, the higher the correlation between the texture structure and the normal texture structure.
[0027] As described above, in a defect detection method based on fabric texture correlation, in step (6), the texture structure correlation threshold θ = μ - 3σ, where μ is the average value of the fabric texture correlation T of all sub-windows in the fabric image A to be detected, and σ is the standard deviation of the fabric texture correlation T of all sub-windows in the fabric image A to be detected.
[0028] Since images with defects have low correlation with texture structure, a texture structure correlation threshold θ can be set. The threshold is primarily based on the statistical 3σ principle, a common, simple, and effective method for identifying outliers. According to the normal distribution assumption, data points differing from the mean by more than three standard deviations are defined as outliers. When the calculated texture structure correlation is below this threshold, the fabric is judged to have defects; otherwise, the fabric is judged to be normal.
[0029] The defect detection method based on fabric texture correlation, as described above, has an accuracy rate of over 94%.
[0030] Beneficial effects:
[0031] (1) The present invention provides a defect detection method based on fabric texture correlation. By calculating the autocorrelation coefficient of a local image of the fabric, the autocorrelation coefficient curve is binarized, and then the autocorrelation coefficient of the binarized curve is calculated and the peaks and valleys are extracted to calculate the texture correlation. The difference in texture correlation is used to determine whether there are defects in the fabric. This method does not require sample learning and complex feature extraction. It judges defects through intuitive texture structure correlation, which is consistent with human perception. It has good adaptability to complex texture fabrics and improves the accuracy and efficiency of fabric defect detection.
[0032] (2) The present invention provides a defect detection method based on fabric texture correlation, which can accurately and efficiently detect defects in fabrics and improve the accuracy and efficiency of fabric quality detection. Attached Figure Description
[0033] Figure 1 Image I shows the fabric with defects.
[0034] Figure 2 for Figure 1 The autocorrelation curve;
[0035] Figure 3 for Figure 1 The autocorrelation curve after binarization;
[0036] Figure 4 Image I shows a portion of the fabric with defects.
[0037] Figure 5 for Figure 4 The autocorrelation curve;
[0038] Figure 6 for Figure 4 The autocorrelation curve after binarization;
[0039] Figure 7 Image I shows a portion of the fabric without any defects.
[0040] Figure 8 for Figure 7 The autocorrelation curve of a normal local fabric image;
[0041] Figure 9 for Figure 7 The autocorrelation curve after binarization;
[0042] Figure 10 The detection result is that the texture structure correlation is less than the threshold, and the result is judged as a defect.
[0043] Figure 11 Image II shows the fabric with defects.
[0044] Figure 12 for Figure 11 The autocorrelation curve;
[0045] Figure 13 for Figure 11 The autocorrelation curve after binarization;
[0046] Figure 14 Image II shows a portion of the fabric with defects.
[0047] Figure 15 for Figure 14 The autocorrelation curve;
[0048] Figure 16 for Figure 14 The autocorrelation curve after binarization;
[0049] Figure 17 Image II shows a portion of the fabric without any defects.
[0050] Figure 18 for Figure 17 The autocorrelation curve of a normal local fabric image;
[0051] Figure 19 for Figure 17 The autocorrelation curve after binarization;
[0052] Figure 20 The detection result is that the texture structure correlation is less than the threshold, and the result is judged as a defect.
[0053] Figure 21 There are 12 images with defects. Detailed Implementation
[0054] The present invention will be further described below with reference to specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. Furthermore, it should be understood that after reading the teachings of this invention, those skilled in the art can make various alterations or modifications to the invention, and these equivalent forms also fall within the scope defined by the appended claims.
[0055] A defect detection method based on fabric texture correlation includes the following steps:
[0056] (1) Local image acquisition: The fabric image A to be detected with a size of 300×300~400×400 is divided into w×w sub-windows, and each sub-window is expanded into a one-dimensional vector with dimension w×w by column or row, denoted as {x i}∈R w×w w is 32~40;
[0057] (2) First calculation of autocorrelation coefficient: For the local image of the fabric {x i Calculate the autocorrelation coefficient to obtain the autocorrelation curve. ;
[0058] Autocorrelation curve The calculation formula is:
[0059] ;
[0060] in, It is the pixel value of the i-th pixel. It is 1≦i≦N- Time series { The average value of} yes ≦i≦N time series { The average value of}, where τ is the displacement and N is the number of pixels in the sequence;
[0061] (3) Binarization: For the autocorrelation coefficient curve Binarization is performed using the average value of the autocorrelation curve as the threshold, converting the autocorrelation coefficient curve into a binary curve, denoted as . ;
[0062] (4) Second calculation of autocorrelation coefficient: for binary curves Calculate the autocorrelation coefficient to obtain the autocorrelation curve. ;
[0063] (5) Fabric texture correlation extraction: Applying steps (2) to (4), calculate the autocorrelation curve of the fabric image A to be detected and the autocorrelation curve of the fabric image A after binarization. The autocorrelation curve after binarization is denoted as The fabric texture correlation T is defined as follows:
[0064] T=PLCC( );
[0065] Among them, PLCC ( ) indicates calculation and The Pearson correlation coefficient between them; the value of T ranges from [-1, 1];
[0066] (6) Defect judgment: Set a texture structure correlation threshold θ. When the fabric texture correlation T is lower than the threshold, it is judged that there is a defect; otherwise, it is judged that there is no defect. The detection accuracy is greater than 94%.
[0067] The texture structure correlation threshold θ = μ - 3σ, where μ is the average fabric texture correlation T of all sub-windows in the fabric image A to be detected, and σ is the standard deviation of the fabric texture correlation T of all sub-windows in the fabric image A to be detected.
[0068] The following specific embodiments illustrate a defect detection method based on fabric texture correlation according to the present invention. The specific process is as follows:
[0069] Example 1
[0070] (1) Local image acquisition: [The text abruptly ends here, likely due to an incomplete sentence or a formatting error.] Figure 1 The defective fabric image I shown is divided into 32×32 sub-windows, and each sub-window is expanded column-wise into a one-dimensional vector with dimension 1024, denoted as {x i}∈R 1024 ;
[0071] (2) First calculation of autocorrelation coefficient: such as Figure 4 Image I shows a partial fabric image with a defect. Figure 4 partial image of the fabric {x i Calculate the autocorrelation coefficient to obtain the following: Figure 5 The autocorrelation curve shown ;
[0072] Where i=1, =0.55, 0.61, τ=1, N=1024;
[0073] (3) Binarization: For the autocorrelation coefficient curve Binarization is performed using the average value of the autocorrelation curve as the threshold, converting the autocorrelation coefficient curve into a binary curve, denoted as . ;
[0074] (4) Second calculation of autocorrelation coefficient: for binary curves Calculate the autocorrelation coefficient and obtain the following: Figure 6 The autocorrelation curve shown ;
[0075] Similarly, take one of the flawless partial fabric images I (e.g.) Figure 7 Taking the example shown below, the autocorrelation coefficient is calculated, and the resulting first autocorrelation curve is as follows. Figure 8 As shown, the resulting second autocorrelation curve is as follows: Figure 9 As shown. Comparison Figure 6 and Figure 9 It can be seen that the second autocorrelation function curves obtained from the defective local image and the defect-free local image are significantly different. Therefore, the following steps can be used to distinguish the defective local image.
[0076] (6) Fabric texture correlation extraction: Apply steps (2) to (4) to calculate the correlation coefficients respectively. Figure 1 The autocorrelation curve of the defective fabric image shown (e.g.) Figure 2 (as shown) and the binarized autocorrelation coefficient curve (as shown) Figure 3 As shown in the figure, the autocorrelation coefficient curve after binarization is denoted as... ;
[0077] (7) Defect Judgment: Set a texture structure correlation threshold θ, θ=0.23, μ=0.62, σ=0.13, as follows Figure 10 As shown, the fabric texture correlation T of the defective local fabric image I is lower than the threshold, indicating that the fabric has defects.
[0078] Example 2
[0079] (1) Local image acquisition: [The text abruptly ends here, likely due to an incomplete sentence or a formatting error.] Figure 11 The defective fabric image II shown is divided into 40×40 sub-windows, and each sub-window is expanded row by row into a one-dimensional vector with dimension 1600, denoted as {x i}∈R 1600 ;
[0080] (2) First calculation of autocorrelation coefficient: such as Figure 14 The image shown is a partial fabric image (II) with a defect. Figure 14 partial image of the fabric {x i Calculate the autocorrelation coefficient to obtain the following: Figure 15 The autocorrelation curve shown ;
[0081] Where i=1, =0.51, 0.52, τ=1, N=1600;
[0082] (3) Binarization: For the autocorrelation coefficient curve Binarization is performed using the average value of the autocorrelation curve as the threshold, converting the autocorrelation coefficient curve into a binary curve, denoted as . ;
[0083] (4) Second calculation of autocorrelation coefficient: for binary curves Calculate the autocorrelation coefficient and obtain the following: Figure 16 The autocorrelation curve shown ;
[0084] Similarly, take one of the flawless partial fabric images II (such as...) Figure 17 Taking the example shown below, the autocorrelation coefficient is calculated, and the resulting first autocorrelation curve is as follows. Figure 18 As shown, the resulting second autocorrelation curve is as follows: Figure 19 As shown. Comparison Figure 16 and Figure 19 It can be seen that the second autocorrelation function curves obtained from the defective local image and the defect-free local image are significantly different. Therefore, the following steps can be used to distinguish the defective local image.
[0085] (5) Fabric texture correlation extraction: Apply steps (2) to (4) to calculate the correlation coefficients respectively. Figure 11 The autocorrelation curve of the defective fabric image II shown (e.g.) Figure 12 (as shown) and the binarized autocorrelation coefficient curve (as shown) Figure 13 As shown in the figure, the autocorrelation coefficient curve after binarization is denoted as... ;
[0086] (6) Defect Judgment: Set a texture structure correlation threshold θ, θ=0.51, μ=0.71, σ=0.066, as follows Figure 20 As shown, the fabric texture correlation T of the defective local fabric image II is lower than the threshold, indicating that the fabric has defects.
[0087] To further verify the effectiveness of the method proposed in this invention, defect detection was performed on another 12 images with defects, resulting in a total of 58 local images with defects. The detection results are as follows: Figure 21 As shown, a total of 55 local image patches were identified as defects, with a detection accuracy of 94.8%.
Claims
1. A defect detection method based on fabric texture correlation, characterized in that... Includes the following steps: (1) Local image acquisition: Divide the fabric image A to be detected into w×w sub-windows, and expand each sub-window into a one-dimensional vector of dimension w×w by column or row, denoted as {x i }∈R w×w ; (2) First calculation of autocorrelation coefficient: For the local image of the fabric {x i Calculate the autocorrelation coefficient to obtain the autocorrelation curve. ; (3) Binarization: For the autocorrelation coefficient curve Binarization is performed to convert the autocorrelation coefficient curve into a binary curve, denoted as . ; (4) Second calculation of autocorrelation coefficient: For binary curves Calculate the autocorrelation coefficient to obtain the autocorrelation curve. ; (5) Fabric texture correlation extraction: Applying steps (2) to (4), calculate the autocorrelation curve of the fabric image A to be detected and the autocorrelation curve of the fabric image A after binarization. The autocorrelation curve after binarization is denoted as The fabric texture correlation T is defined as follows: T=PLCC( ); Among them, PLCC ( ) indicates calculation and The Pearson correlation coefficient between them; (6) Defect judgment: Set a texture structure correlation threshold θ. When the fabric texture correlation T is lower than the threshold, it is judged that there is a defect; otherwise, it is judged that there is no defect.
2. The defect detection method based on fabric texture correlation according to claim 1, characterized in that, In step (1), the size of the fabric image A to be detected is 300×300~400×400.
3. The defect detection method based on fabric texture correlation according to claim 1, characterized in that, In step (1), w is 32~40.
4. The defect detection method based on fabric texture correlation according to claim 1, characterized in that, The autocorrelation curve in step (2) The calculation formula is: ; in, It is the pixel value of the i-th pixel. It is 1≦i≦N- Time series { The average value of} yes ≦i≦N time series { The average value of}, where τ is the displacement.
5. The defect detection method based on fabric texture correlation according to claim 1, characterized in that, In step (3), the average value of the autocorrelation curve is used as the threshold for binarization.
6. The defect detection method based on fabric texture correlation according to claim 1, characterized in that, In step (5), the value range of T is [-1, 1].
7. The defect detection method based on fabric texture correlation according to claim 1, characterized in that, In step (6), the texture structure correlation threshold θ = μ - 3σ, where μ is the average value of the fabric texture correlation T of all sub-windows in the fabric image A to be detected, and σ is the standard deviation of the fabric texture correlation T of all sub-windows in the fabric image A to be detected.
8. The defect detection method based on fabric texture correlation according to claim 1, characterized in that, The detection accuracy rate is greater than 94%.
Citation Information
Patent Citations
Defect detection method based on improved Faster R-CNN
CN114078106B
High-precision fabric defect detection method based on lightweight hybrid aggregation network and enhanced generalized feature fusion
CN119444714A
A principal component analysis-based image analysis method and its application in fabric defect detection.
CN102289677A
Period extraction method and device, computer equipment and readable storage medium
CN113936002A
Metal stamping part surface scratch detection method based on artificial intelligence
CN116523904A