Fabric defect detection method based on abnormal perception weighted tensor robust component analysis
By constructing a multidimensional observation feature tensor and utilizing iterative optimization of self-information anomaly degree and spatial prior weights, the problem of inaccurate segmentation of weak fabric defects in existing technologies is solved, achieving efficient and accurate fabric defect detection.
Patent Information
- Application Number
- CN202611123959.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-28
- Publication Date
- 2026-08-25
AI Technical Summary
Existing technologies struggle to accurately segment subtle fabric defects while suppressing high-frequency background textures, resulting in poor detection performance.
A multi-scale, multi-directional Gabor filter bank is used to construct a multi-dimensional observation feature tensor. The probability density function is fitted using the kernel density estimation method. The self-information anomaly degree is constructed and combined with spatial prior weights. Iterative optimization is performed using the alternating direction multiplier method to decompose the feature tensor into a low-rank background tensor and a sparse defect tensor, and finally a defect saliency map is generated.
It achieves high-fidelity reconstruction and segmentation of weak defects, reduces the false positive rate, avoids the cold start problem of deep learning, and performs detection at the original spatial resolution, maintaining the integrity of the defect topology.
Smart Images

Figure CN122636619A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of machine vision, image processing and industrial surface defect detection technology, and in particular to a fabric defect detection method based on anomaly perception weighted tensor robust composition analysis. Background Technology
[0002] As a crucial pillar of global manufacturing, the textile industry plays a vital role in quality control, with fabric surface defect detection being the core of this process. Compared to traditional manual inspection, which is labor-intensive, subjective, and prone to fatigue, automated inspection technology, with its high efficiency and objectivity, has become the mainstream approach in the industry.
[0003] However, due to the diversity of defect morphologies in real fabrics and the high complexity of background textures, accurately highlighting and segmenting subtle defects while strongly suppressing high-frequency background textures remains an extremely challenging task. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a fabric defect detection method based on anomaly-sensing weighted tensor robust component analysis, which aims to strongly suppress high-frequency background interference while reconstructing and accurately segmenting weak defects with high fidelity.
[0005] To achieve the above objectives, this invention provides a fabric defect detection method based on anomaly-sensing weighted tensor robust component analysis, comprising the following steps: S1. A multi-scale, multi-directional Gabor filter bank is used to perform convolution operations on the input two-dimensional fabric image to obtain its amplitude feature map. All the obtained amplitude feature maps are then stacked along the third dimension to construct a multi-dimensional observation feature tensor. ; S2. For each feature channel of the multidimensional observation feature tensor, the probability density function of the feature response value is fitted using the kernel density estimation method. Based on information theory, the probability density function is transformed into self-information anomaly, and a spatial prior weight tensor decoupled from iterative optimization is constructed. ; S3. Construct a dual-constraint optimization model based on the weighted tensor L1 norm guided by spatial prior and the adaptive group sparse norm based on structural quality feedback. Iteratively solve the model using the alternating direction multiplier method under a two-stage optimization strategy to accurately decompose the feature tensor into a low-rank background tensor and a sparse defect tensor. S4. Reconstruct and fuse the sparse defect tensor along the channel dimension to obtain a two-dimensional saliency map, and perform smoothing and normalization processing to output the defect saliency map.
[0006] Preferably, in a multi-scale, multi-directional Gabor filter bank, the mathematical expression of the two-dimensional Gabor function is: ; in, , ; For the filter direction, For wavelength, Let the standard deviation be the Gaussian envelope. For phase shift, The aspect ratio is determined by traversing different scale parameters. and direction parameters Construct a filter bank.
[0007] Preferably, in S2, the spatial prior weight tensor The specific construction steps are as follows: S21. Regarding the characteristic tensor The k-th channel slice In position Characteristic response value at The probability density function is fitted using kernel density estimation. ; S22. Based on self-information theory, calculate the self-information anomaly score of each feature response value. , constitutes the anomaly tensor ; S23, regarding the anomaly tensor Mini-maximum normalization is obtained A spatial prior weight tensor is constructed using an inverse proportional function smoothing mapping. Its matrix elements Defined as: ; in, This is a regulating factor used to control the sensitivity of weights to the degree of anomaly.
[0008] Preferably, in S3, the mathematical expression of the dual-constraint optimization model is: in, The tensor kernel norm of the low-rank background tensor. The balance parameter for the spatial prior weighted L1 norm. The balancing parameter for the adaptive group sparse norm. Let be the adaptive penalty coefficient for the k-th channel. Let Frobenius norm be the value of the k-th channel slice. This represents the total number of feature channels. For the Hadamard product, the constraints are as follows: This indicates that the multidimensional observation feature tensor is decomposed into the sum of low-rank background and sparse defects.
[0009] Preferably, in S3, the two-stage optimization strategy is bounded by a preset iteration threshold T: in the first stage, when the number of iterations t < T, the channel filtering module is turned off, i.e., the balance parameter of the adaptive group sparse norm is set. The background and defects are initially separated using only the spatial prior weight tensor. In the second stage, when the iteration number t≥T, the channel filtering module is activated, and the adaptive group sparsity penalty term is activated. This is achieved by extracting sparse channel slices from each iteration. Calculating the channel penalty coefficient based on macroscopic sparsity and microscopic compactness. Dynamically filter out low-quality channels.
[0010] Preferably, in the second stage of S3, scale-invariant Hoyer sparsity is used. To quantify the sparse channel slice The background purity is calculated using the following formula: ; in, The total number of pixels in a single channel slice. , Channel slices L1 and L2 norms; The higher the value, the cleaner the channel background.
[0011] Preferably, in the second stage of S3, a space compactness based on total variation is adopted. To quantize sparse channel slices The degree of defect aggregation is calculated using the following formula: ; in, Slice the channel Total variational operators, To prevent division by zero of small constants; The higher the value, the more continuous and concentrated the defect energy is in space.
[0012] Preferably, in each iteration, the normalized Hoyer sparsity is fused. With space compactness A nonlinear "soft veto" mechanism is constructed to calculate the overall quality score of each channel. : ; in, This represents the average quality metric for all channels in the current iteration. The gain coefficient used to control the steepness of the nonlinear activation function; based on Constructed adaptive channel penalty coefficient The expression is: ; in, To ensure numerical stability, a minimal constant.
[0013] Preferably, in S3, the constructed augmented Lagrangian function is: ; in, For Lagrange multiplier tensors, For penalty parameters, The Hadamard product is used; in the (t+1)th iteration, the low-rank background tensor is updated alternately. sparse defect tensor and the multiplier until the convergence condition is met. Stop iterating when the time comes.
[0014] Preferably, after S4, the method further includes an adaptive threshold segmentation step for the final defect saliency map: a statistical thresholding strategy based on the 3-sigma principle is used to perform binarization segmentation of the defect saliency map, and morphological closing operation and connected component area filtering are used to output a defect binarized segmentation image.
[0015] The advantages and beneficial effects of this invention compared to the prior art are: 1. By using KDE to adaptively fit the true continuous probability distribution, the statistical probability is transformed into self-information penalty weights, achieving complete decoupling between weight allocation and iterative numerical values. This avoids the algorithm from getting stuck in local optima due to high-amplitude, high-frequency noise interference, and adaptively protects against the weak defects in the long-tail region of the probability.
[0016] 2. By integrating Hoyer sparsity (quantizing background purity) and TV total variation (quantizing spatial compactness), a nonlinear soft veto mechanism is used to dynamically suppress low-quality channels supported by defect-free structures, blocking noise fusion interference between channels and significantly reducing the false positive rate (FPR).
[0017] 3. Achieve completely zero-sample detection, avoiding the cold start and training limitations of deep learning; optimization is always performed at the original spatial resolution, avoiding irreversible loss of spatial structure due to downsampling operations such as pooling and stride convolution, and restoring the topological structure of defects with high fidelity.
[0018] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0019] Figure 1 The overall operation flowchart of the fabric defect detection method based on anomaly-sensing weighted tensor robust component analysis provided by the present invention is shown below. Figure 2 The graph shows the average convergence and standard deviation bands of the algorithm of this invention during the ADMM iterative solution process; Figure 3 A comparison of intermediate sparse plots and weight allocations for different channel screening strategies in typical defective and noisy channels; Figure 4 This is a visual segmentation comparison of the method of this invention with standard TRPCA, PSTNN, HLSTD, and ETRPCA algorithms on real fabric defect samples. Figure 5 This is a comparison of ROC and PRO curves between the method of this invention and the unsupervised deep learning detection algorithm in the low false positive rate range. Detailed Implementation
[0020] In the description of this invention, it should be noted that the terms "upper," "lower," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product is in use. They are used only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. In the description of this invention, it should also be noted that, unless otherwise explicitly specified and limited, the terms "set," "install," and "connect" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal communication between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0021] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0022] like Figure 1As shown, this invention proposes a fabric defect detection method based on anomaly-aware adaptive weighted tensor robust principal component analysis (ADCA) using a dual adaptive regularization constraint process. It adaptively adjusts the penalty weights at the spatial and channel levels in a single iteration, balancing strong background suppression with high-fidelity reconstruction of subtle defects. The method includes the following steps: S1, convolving the input two-dimensional fabric image using a multi-scale, multi-directional Gabor filter bank to construct a multi-dimensional observation feature tensor; S2, adaptively fitting the probability density distribution of the feature response values of each channel using kernel density estimation, mapping it to self-information anomaly, and constructing a spatial prior weight tensor using an inverse proportional function; S3, within the ADMM solution framework, employing a two-stage alternating iterative solution algorithm, guided by spatial prior weights and combined with adaptive group sparsity constraints based on structural quality feedback, decomposing the feature tensor into a low-rank background tensor and a sparse defect tensor; S4, performing multi-channel fusion and Gaussian smoothing filtering on the sparse defect tensor to obtain a defect saliency map, and then using an adaptive threshold for binarization segmentation to output the final defect binarized mask image.
[0023] Specifically, in S1, the construction of the multidimensional feature tensor involves inputting a two-dimensional fabric image to be detected. In constructing a multi-scale, multi-directional Gabor filter bank, the mathematical expression for the two-dimensional Gabor function is: ; in, , By traversing different scale parameters and direction parameters A total of A two-dimensional Gabor filter is used. The two-dimensional fabric image I is convolved with each Gabor filter in two dimensions, and the amplitude of the convolution output is extracted as a feature map. The resulting 8 feature maps are stacked along the third dimension to construct a multidimensional feature tensor. .
[0024] Specifically, in S2, the spatial prior weight tensor The construction is as follows: For the k-th channel slice of the feature tensor Because normal textures exhibit high regularity and redundancy in space, their corresponding feature response values... The target exhibits a high probability density distribution; however, defective targets disrupt this regularity, exhibiting an extremely low probability distribution. This invention utilizes non-parametric kernel density estimation (KDE) to fit the characteristic response values at location. Continuous probability density function at Subsequently, Shannon's self-information principle was introduced to calculate the self-information anomaly score of the feature response value, which was defined as the anomaly score. Thus, the anomaly tensor is constructed. For the anomaly tensor Mini-maximum normalization is obtained Finally, an inverse proportional mapping function is used to construct a prior weight tensor that is completely "numerically decoupled" from subsequent iterative optimization solutions. Its matrix elements As shown below: ; Prior weights A smooth transition is achieved in both spatial and channel dimensions, and smaller regularization penalty weights are assigned to suspected defective regions.
[0025] Specifically, in S3, the construction and two-stage solution process of the dual-constraint optimization model is as follows: First, the AAW-TRPCA optimization model is constructed, and its objective function formula is shown below: ; Among them, the low-rank background tensor Using tensor nuclear norm constraints, sparse defect tensors It is simultaneously constrained by both the spatial prior weighted L1 norm and the adaptive group sparse norm. To solve this model, its corresponding augmented Lagrangian function is constructed, as shown in the following formula: ; This invention employs the ADMM algorithm for alternating iterative variable updates. To ensure algorithm stability, a two-stage solution strategy is designed with a preset iteration threshold T=50 as the boundary. In the first stage (iteration number t<T), the channel filtering module is disabled, i.e., the balance parameter of the group sparsity norm is set. Low-rank background items Solving using the tensor singular value threshold shrinkage (t-SVT) operator; sparse defect term The weighted soft threshold operator is used to solve this problem, and its formula is shown below: ; in This stage initially achieved macroscopic isolation between the background and defects. The second stage is activated (iteration number t≥T), enabling the channel filtering module and activating the adaptive channel filtering module. First, the first-stage method is used for weighted L1 contraction to obtain intermediate variables. Subsequently, slices of each feature channel are extracted. Hoyer sparsity and space compactness The formula is shown below: ; In this study, Hoyer sparsity is used to quantify the purity of the channel background, while total variation (TV) spatial compactness is used to constrain spatial continuity defects and penalize isolated noise. The normalized indices are then input into a nonlinear soft rejection function to calculate the channel composite score. The formula is shown below: ; The gain coefficient is set to Therefore, the adaptive channel penalty coefficient is calculated. The soft threshold operator is used to adaptively shrink each channel, as shown in the following formula: ; This step dynamically cuts off fusion interference from low-quality feature channels that lack physical structural support. It involves alternating updates using double multipliers until the convergence condition is met. Stop iteration.
[0026] Specifically, in S4, the saliency map generation and segmentation are as follows: The optimized sparse defect slices... Calculate the L1 norm along the channel dimension for reconstruction and fusion: ; The feature image M is smoothed using Gaussian filtering and then normalized to output a defect saliency map. A statistical thresholding strategy based on the 3-sigma principle is used to binarize the defect saliency map, and morphological closing operations and connected component area filtering are combined to output the final binary segmented defect image.
[0027] In this embodiment, the SP-WTL1-norm of this invention is directly compared with the standard L1 norm, the reweighted L1 norm, and the non-convex Lp norm in a controlled simulated fabric feature space. The experimental results are shown in Table 1: The prior weighting mechanism of this invention is comprehensively superior, achieving the purest background stripping, with a true probability per square (TPR) of 0.916, a precision per square (PPV) of 0.207, and an area under the curve (AUC) of 0.992. This mathematically confirms the superiority of "numerical decoupling" in protecting extremely weak defects.
[0028] Table 1 Comparison of quantization performance under different sparse norm constraints
[0029] This embodiment further compares the proposed adaptive group sparse norm with conventional channel selection strategies based on energy amplitude and spatial variance in the real fabric feature space. Experimental results are as follows: Figure 3As shown in Table 2, for low-quality channels dominated by strong background noise (such as Channel 7), conventional strategies incorrectly assign high weights, leading to the spread of false positive noise during multi-channel fusion. However, this invention accurately identifies the impure and discontinuous background of this channel and adaptively assigns an extremely low weight (nearly zero), perfectly blocking interference from noisy channels and resulting in a significantly higher defect extraction accuracy.
[0030] Table 2 Comparison of Quantization Performance of Different Feature Channel Selection Strategies
[0031] This embodiment performs a comprehensive comparison on a test set of 300 fabric defect samples, including TILDA and actual industrial samples. The comparison algorithms include those within the TRPCA framework: standard TRPCA, PSTNN, HLSTD, and ETRPCA. Detailed comparisons of the quantitative performance of each algorithm are shown in Table 3. Visual segmentation results for some samples are detailed in […]. Figure 4 And for three unsupervised deep learning models—SimpleNet, PaDiM, and PatchCore—the ROC and PRO curves for each algorithm in the key low false positive rate region are detailed below. Figure 5 In comparison with algorithms within the TRPCA framework, this invention achieves significant advantages across all metrics (TPR increased to 0.584, PPV increased to 0.577, F1 score reached 0.529, and AUC reached 0.945). Visual segmentation results show that this invention eliminates residual periodic background textures and preserves defect structures with high fidelity. Furthermore, in the core working range with low false positive rates (FPR≤0.1), the ROC curve of this invention rises most rapidly, indicating that this invention can capture weak defects with minimal false positives. Moreover, due to solving at the original spatial resolution, this invention comprehensively outperforms all deep learning models in terms of the PRO curve (high-fidelity defect morphology reconstruction capability).
[0032] Table 3. Quantitative performance comparison of this invention with algorithms under other TRPCA frameworks.
[0033] Finally, to verify the numerical convergence and stability of the algorithm of this invention, this embodiment plots the relative error convergence curve during the ADMM solution process, as shown below. Figure 2 As shown, after introducing the nonlinear adaptive channel filtering module, the algorithm did not exhibit divergence or severe oscillations, but rather smoothly transitioned and quickly converged to a stable state. Actual runtime tests show that the standard TRPCA takes an average of 16.4 seconds to process a single image, while the average processing time of this invention is only 16.9 seconds, because the newly added low-order complexity module is completely absorbed by the high-order SVD operation. This invention successfully achieves a significant improvement in detection accuracy with only a 3% time overhead.
[0034] In this application, unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. In case of any inconsistency, the meaning set forth in this specification or derived from the content described herein shall prevail. Furthermore, the terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit the scope of this application.
[0035] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.
Claims
1. A fabric defect detection method based on anomaly-perception weighted tensor robust component analysis, characterized in that, Includes the following steps: S1. A multi-scale, multi-directional Gabor filter bank is used to perform convolution operations on the input two-dimensional fabric image to obtain its amplitude feature map. All the obtained amplitude feature maps are then stacked along the third dimension to construct a multi-dimensional observation feature tensor. ; S2. For each feature channel of the multidimensional observation feature tensor, the probability density function of the feature response value is fitted using the kernel density estimation method. Based on information theory, the probability density function is transformed into self-information anomaly, and a spatial prior weight tensor decoupled from iterative optimization is constructed. ; S3. Construct a dual-constraint optimization model based on the weighted tensor L1 norm guided by spatial prior and the adaptive group sparse norm based on structural quality feedback. Iteratively solve the model using the alternating direction multiplier method under a two-stage optimization strategy to accurately decompose the feature tensor into a low-rank background tensor and a sparse defect tensor. S4. Reconstruct and fuse the sparse defect tensor along the channel dimension to obtain a two-dimensional saliency map, and perform smoothing and normalization processing to output the defect saliency map.
2. The fabric defect detection method based on anomaly-perception weighted tensor robust component analysis according to claim 1, characterized in that: In S1, the mathematical expression of the two-dimensional Gabor function in the multi-scale, multi-directional Gabor filter bank is: ; in, , ; For the filter direction, For wavelength, Let the standard deviation be the Gaussian envelope. For phase shift, The aspect ratio is determined by traversing different scale parameters. and direction parameters Construct a filter bank.
3. The fabric defect detection method based on anomaly-perception weighted tensor robust component analysis according to claim 2, characterized in that: In S2, the spatial prior weight tensor The specific construction steps are as follows: S21. Regarding the characteristic tensor The k-th channel slice In position Characteristic response value at The probability density function is fitted using kernel density estimation. ; S22. Based on self-information theory, calculate the self-information anomaly score for each feature response value: , constitutes the anomaly tensor ; S23, regarding the anomaly tensor Mini-maximum normalization is obtained A spatial prior weight tensor is constructed using an inverse proportional function smoothing mapping. Its matrix elements Defined as: ; in, This is a regulating factor used to control the sensitivity of weights to the degree of anomaly.
4. The fabric defect detection method based on anomaly-perception weighted tensor robust component analysis according to claim 3, characterized in that: In S3, the mathematical expression for the dual-constraint optimization model is: in, The tensor kernel norm of the low-rank background tensor. The balance parameter for the spatial prior weighted L1 norm. The balancing parameter for the adaptive group sparse norm. Let be the adaptive penalty coefficient for the k-th channel. Let Frobenius norm be the value of the k-th channel slice. This represents the total number of feature channels. For the Hadamard product, the constraints are as follows: This indicates that the multidimensional observation feature tensor is decomposed into the sum of low-rank background and sparse defects.
5. The fabric defect detection method based on anomaly-perception weighted tensor robust component analysis according to claim 4, characterized in that: In S3, the two-stage optimization strategy is bounded by a preset iteration threshold T: in the first stage, when the number of iterations t < T, the channel filtering module is turned off, i.e., the balance parameter of the adaptive group sparse norm is set. The background and defects are initially separated using only the spatial prior weight tensor. In the second stage, when the iteration number t≥T, the channel filtering module is activated, and the adaptive group sparsity penalty term is activated. This is achieved by extracting sparse channel slices from each iteration. Calculating the channel penalty coefficient based on macroscopic sparsity and microscopic compactness. Dynamically filter out low-quality channels.
6. The fabric defect detection method based on anomaly-perception weighted tensor robust component analysis according to claim 5, characterized in that: In the second stage of S3, scale-invariant Hoyer sparsity is used. To quantify the sparse channel slice The background purity is calculated using the following formula: ; in, The total number of pixels in a single channel slice. , Channel slices L1 and L2 norms; The higher the value, the cleaner the channel background.
7. The fabric defect detection method based on anomaly-perception weighted tensor robust component analysis according to claim 6, characterized in that: In the second phase of S3, a space compactness based on total variation is adopted. To quantize sparse channel slices The degree of defect aggregation is calculated using the following formula: ; in, Slice the channel Total variational operators, To prevent division by zero of small constants; The higher the value, the more continuous and concentrated the defect energy is in space.
8. The fabric defect detection method based on anomaly-perception weighted tensor robust component analysis according to claim 7, characterized in that: In each iteration, the normalized Hoyer sparsity is fused. With space compactness A nonlinear "soft veto" mechanism is constructed to calculate the overall quality score of each channel. : ; in, This represents the average quality metric for all channels in the current iteration. The gain coefficient is used to control the steepness of the nonlinear activation function; based on Constructed adaptive channel penalty coefficient The expression is: ; in, To ensure numerical stability, a minimal constant.
9. The fabric defect detection method based on anomaly-perception weighted tensor robust component analysis according to claim 8, characterized in that: In S3, the constructed augmented Lagrangian function is: ; in, For Lagrange multiplier tensors, For penalty parameters, The Hadamard product is used; in the (t+1)th iteration, the low-rank background tensor is updated alternately. sparse defect tensor and the multiplier until the convergence condition is met. Stop iterating when the time comes.
10. The fabric defect detection method based on anomaly-perception weighted tensor robust component analysis according to claim 1, characterized in that: Following S4, the process also includes an adaptive thresholding step for the final defect saliency map: a statistical thresholding strategy based on the 3-sigma principle is used to binarize the defect saliency map, and morphological closing operations and connected component area filtering are used to output a binarized defect segmentation image.