Abstract
Low-rank decomposition models have potential for fabric defect detection, where a feature matrix is decomposed into a low-rank matrix that corresponding to repeated texture structure and a sparse matrix that represent defective regions. Two limitations, however, still exist. First, previous work might fail to detect some large homogeneous defective block. Second, when the background and defective regions are relatively coherent or the texture of fabric image is complex, it is difficult to use previous methods to separate them. To deal with these problems, a new weighted low-rank decomposition model with Laplace regularization (WLRL) is proposed in this paper: (1) a weighted low-rank decomposition model that can decompose the original image into background and defective regions, and (2) a Laplace regularization that can enlarge the distance between the background and the defective regions. The performance of the proposed method WLRL is evaluated on the box- and star-patterned fabric databases, and superior results are shown compared with state-of-the-art methods, that is, 98.70% ACC (accuracy) and 72.83% TPR (true positive rate) for box-patterned fabrics, 99.09% ACC (accuracy) and 83.63% TPR (true positive rate) for star-patterned fabrics.
Introduction
In the fabric industry, fabric production is usually done on weaving and knitting machines. 1 Therefore, this process always produces various defects, such as oil stain and knotting. Fabric defects are one of the main factors affecting the quality of fabrics. Considering that the loss of fabric profits caused by defects can reach 45%: 65%, 2 defect detection is a necessary step in fabric production. At present, defect detection mainly depends on experienced skilled workers, but this method is too subjective and inefficient. Automated visual inspection of fabrics can make up for these shortcomings. 3 Hence, the research on automatic fabric defect detection has far-reaching significance.
Generally, fabric defect detection can be classified into two main categories: automatic defect detection of un-patterned fabrics (e.g. plain and twill fabrics), and automatic defect detection of patterned fabrics (e.g. lattice fabric). There is a line of researches on un-patterned fabrics defect detection, mainly contain Fourier transforms,4,5 Gabor filter,6,7 Markov random field,8,9 wavelet transform,10,11 support vector machine, 12 and neural network.13,14
Patterned fabrics refer to the images of texture units with periodic variations. In 2017, Ng et al. 15 defined the most basic unit of fabric texture as motif, and the combination of motifs can form a lattice which appears repetitively in patterned fabrics, as shown in Figure 1. Different types of fabrics (e.g. box- and star-patterned) have different sizes and shapes of the lattices. At present, there are many corresponding detection algorithms. For example, in 2005, Ngan et al. 16 proposed the wavelet preprocessed golden image subtraction (WGIS), but WGIS can only detect large defect blocks, which is invalid for small defects. Tang et al. 17 proposed the Elo Rating (ER) algorithm in 2016, which is a defect detection method based on the spirit of sportsmanship that is, fair matches between different image blocks. In 2017, Jia et al. 18 proposed a fabric defect detection method based on Gabor filter, which uses morphological component analysis (MCA) to segment the lattice automatically, and then transform the defect detection problem into lattice similarity problem. This method has achieved superior results, but for different types of defects, the adaptability needs to be further improved. In 2017, Yapi et al. 19 proposed a learning-based fabric detection method, and the experiment on the standard database showed that the method achieved good detection results. Wang et al. 20 proposed a method of fabric defect detection based on deep feature and low-rank recovery in 2018. The experiment shows that this method has a good detection effect. In 2018, Yi et al. 21 proposed a fabric defect detection model based on distance matching function and optimal Gabor filter bank. Experimental results show that the method has short learning time, good robustness, and can quickly and accurately detect fabric defects. In 2020, liu et al. 22 proposed a fabric defect detection method based on deep-feature and low-rank decomposition model. The experimental results show that the low-rank decomposition model can effectively separate defects from the background, and the method has a high detection accuracy.

Structural analysis of patterned fabrics.
The low-rank decomposition (LR) model can decompose the original image into low-rank components that represent the background of the image and sparse components that corresponding the defective regions. Gao et al. 23 combine GHOG (Gabor-HOG) with low-rank recovery to detect fabric defects. First, extract the GHOG feature of the image, and then use the low-rank recovery model to detect the defects. PN-RPCA 24 proposed a defect prior to guide the low-rank decomposition model and adds noise terms to reduce the influence of noise. Generally, these LR-based (low-rank decomposition model) defect detection methods assume that a fabric image can be represented as a combination of high visual redundancy part (e.g. background regions) and a sparse part (e.g. defective regions).
Although the previous defect detection methods have achieved promising results, there still exist several problems: (1) previous studies might fail to detect some large homogeneous defective block; and (2) when the background and defective regions are relatively coherent or the texture of fabric image is complex, the previous methods are difficult to separate them. In order to overcome these problems, a new weighted LR model with Laplacian regularization (WLRL) is proposed in this paper which is inspired by the LSG 18 and SMD. 25 We have enhanced the traditional low-rank decomposition model 26 with two important components.
First, we get more accurate defect prior by lattice segmentation, and construct weighted low-rank decomposition model by defect prior. Second, in order to enhance the detection efficiency, we add Laplacian regularization 25 to the weighted LR model, which is used to enlarge the distance between the background and the defective regions. The regularizer encourages blocks with similar pixels to share similar representations and eventually separates salient regions from the background as much as possible. These attributes enable the proposed WLRL method to exhibit excellent performance in defect detection. In summary, this paper makes the following contributions:
By combining the properties of the two techniques, a weighted low-rank decomposition with Laplacian regularization (WLRL) is proposed for lattice-based fabric defect detection.
In constructing the weighed low-rank decomposition model the defect prior is introduced to obtain more accurate defects.
In the weighted low-rank decomposition model, a Laplacian regularization term is added to enlarge the distance between the background and the defective regions, which makes the proposed method more accurate and robust.
Related work
Lattice segmentation
Lattice segmentation can be classified into two categories based on computational methods 27 : the local feature-based and the global structure-based methods. The former analyzes local features first and then global structure, while the latter is the opposite. Liu et al. 28 perform lattice segmentation based on local features, which has a better detection result for simple textures, but it is difficult to detect complex textures. Chang et al. 29 used the global variance minimization to perform lattice segmentation. First, an ideal lattice size is assumed, and then the sum of the variances of these lattices is calculated. When the sum is approaching the smallest, the optimal lattice size is obtained. Jia et al. 18 propose a new method, which can perform lattice segmentation without obtaining the corresponding lattice prior knowledge. This paper uses this method for lattice segmentation.
Low-rank decomposition
Candès et al.
26
first proposed the low-rank decomposition model (LR). According to different applications, the low-rank decomposition model can be called robust principal component analysis (RPCA) or robust subspace learning.
30
Bouwmans et al.
31
and Lin et al.
32
analyzed in detail the evolution process of LR model and the optimized solution method. Given a feature matrix
where the nuclear norm
At present, the low-rank decomposition model has been successfully applied in signal processing, computer vision and industrial process. For instance, Pu et al. 33 designs a new structured matrix decomposition method, which decomposes the data matrix of each mode into the superposition of three terms for blind audio-visual location and separation. S. Javed et al. 34 propose a spatiotemporal structured sparse RPCA algorithm for moving objects detection. Li et al. 35 used the low-rank decomposition model to detect the defects of thin-walled structure. The experiment shows that the method has achieved satisfactory results.
The research on different norms and regularization terms in low-rank decomposition is a very active field and their selection is always driven by the application like in background/foreground separation. On the basis of RPCA, Sobral et al. 36 proposed a double-constrained RPCA model called SCM-RPCA, which is used to improve the target foreground detection in the marine scene. The experimental results show that the method has better detection results. Zhou et al. 37 proposed a new graph-regularized Laplace low-rank approximation detecting model (GRLA) for infrared dim target scene. The kernel norm was replaced by non convex Laplacian low-rank regularization, which improved the accuracy of non-uniform background estimation. Shijila et al. 38 used convergence convex optimization algorithm to regularize the total variation (TV) norm in the low-rank decomposition model, which reduced the computational complexity.
The proposed WLRL method
The proposed WLRL method consists of two parts: the acquisition of defect prior and the low-rank decomposition model. First, the defect prior (approximate defective regions) is obtained by lattice segmentation and added into the low-rank decomposition model to construct the weighted low-rank decomposition model. Second, adding Laplacian regularization to enlarge the distance between the backgrounds and defective regions. Last, using the optimal threshold algorithm to segment the saliency map generated by the sparse matrix to locate the defective regions. Figure 2 shows the specific steps.

The procedure of the proposed WLRL method.
Acquisition of defect prior
One disadvantage of LR model is that it may fail to detect some large homogeneous defective block. In order to avoid this error and improve the detection effect of LR, the defect prior will be introduced in the paper. Defect prior is a penalty matrix used to guide LR, which can improve the detection probability of defects and reduce the detection probability of defect-free regions. The acquisition of defect prior is generally divided into two stages: training stage and testing stage.
The parameters

The procedure of acquiring the fabric defect prior.
Weighted LR and laplacian regularization
In order to improve the detection accuracy of the LR model for different defect types, based on LR, a weight matrix is added to guide the decomposition process, which makes the model more accurate and robust. Meanwhile, it can avoid failure when the previous studies might fail to detect some large homogeneous defective block. In addition, in order to make the model adapt to different types of defects, we add Laplacian regularization to enlarge the distance between the backgrounds and the defects.
WLR model
Considering that LR may fail to detect some large homogeneous defective block. Therefore, a valid weighting matrix
where the weight matrix
where
Laplacian regularization
When the difference between the backgrounds and defects is not obvious or the texture of fabric image is complex, the backgrounds will be highly correlated with the defects. Therefore, the previous WLR-based method will be difficult to work facing this situation. To solve this problem, a Laplacian regularization 25 is introduced to enlarge the distance between the backgrounds and the defects, so as to distinguish the defective regions from the background. We define Laplacian regularization as follows:
where
where
Essentially, Laplacian regularization enlarges the distance between feature subspaces by smoothing the vectors in
WLRL model
Based on the WLR, Laplacian regularization is added to construct the WLRL model. The model is defined as follows:
where the first term is a low-rank restriction, which is used to represent the background of fabrics. The second term is a sparse restriction, which is used to indicate the defective regions of fabrics. The third term is Laplacian regularization to enlarge the distance between the low-rank part and the sparse part, and
In order to facilitate the solution, the auxiliary variable
Optimization
Considering the efficiency and accuracy of the algorithm, the ADM 42 is used to solve the convex optimization model WLRL, and the minimum augmented Lagrange function is:
where
where
Note that
where
The closed solution of
where shrink(⋅) is a soft threshold operator, expressed as:
WLRL-based fabric defect detection
By explaining the optimization process in the previous section, the WLRL-based defect detection method can be defined now. The framework for patterned fabric defect detection consists of four steps: image representation, defect prior, low-rank decomposition and generating a saliency map and its segmentation.
Step 1: Image representation
First, Gabor filter is used to preprocess the pattern fabric image to generate Gabor maps. Then the image is segmented into
Step 2: Defect prior
First, the fabric image is segmented according to the period size by using lattice segmentation. Then, Gabor features of each lattice are extracted, and the Chebyshev distance between each lattice is calculated. By comparing the lattices, the defect prior is obtained, as shown in Figure 3. By adding defect prior, the model has a higher detection rate and robustness.
Step 3: Low-rank decomposition
When
Step 4: Generating a saliency map and its segmentation
The feature matrix
Then the saliency map
Finally, the improved adaptive threshold segmentation algorithm 45 is used to segment G, and the final binary detection results are obtained.
Experiments and performance evaluation
To fully evaluate the proposed method, a series of experiments are conducted by using standard datasets, including four state-of-the-art solutions for comparison. In particular, the dataset is provided by the Industrial Automation Research Laboratory from Dept. of Electrical and Electronic Engineering of Hong Kong University, which includes 106 standard datasets of box- and star-patterned, with a size of 256-by-256 in 24-bit depth. The box-patterned database has 30 defect-free images and 26 defective images. The star-patterned database has 25 defect-free images and 25 defective images. There are five types of defects in all the defective images, including Broken end, Hole, Netting multiple, Thick bar and Thin bar. All defective images have corresponding binary ground-truth images (manually labeled images) which has value 1 and 0 corresponding to the defects and background, respectively. The comparison methods in this paper include ER 17 (2016), PN-RPCA 24 (2016), GHOG-LR 23 (2016) and LSG 18 (2017).
In order to further evaluate the effectiveness and applicability of the proposed method, some evaluation indexes are defined, accuracy (ACC), true positive rate (TPR), false positive rate (FPR), positive predictive value (PPV) and negative predictive value (NPV). These five indicators are used as the standard for the evaluation of the detection algorithm. The details of these metrics are provided in. 17 All the experiments are conducted on a notebook computer with an Intel Core i5-3320 processor and 6GB memory. The algorithm runs in the environment of MATLAB 2016a.
Experimental results and analysis
Component analysis in the proposed model
In order to further analyze the role of the various components of the WLRL model, we compared LR, WLR and WLRL on the same data set.The corresponding objective functions are shown in Table 1. Figure 4 shows the test results of some LR, WLR and WLRL. The 1st row displays original defective images; the 2nd row is corresponding ground-truth (GT) images; the 3rd row displays the results of the LR method; the 4th row exhibits the results of the WLR method; the 5th row shows the WLRL detection results.
Objective functions of different models related to WLRL.

Comparative experimental results of LR, WLR, and WLRL on box and star samples.
It can be seen from Figure 4 that WLR increases the detection rate of large homogeneous defects, indicating that the defect prior plays an important role in ensuring the detection of large homogeneous defects. Compared with WLR, the detection effect of WLRL is further improved, and the detection results of small defects are increased, which confirms the effect of Laplace regular term. Compared with LR, WLRL has a significant improvement in detection results. For the fabric images whose foreground and background share similar appearance, WLRL successfully separates the defects from the background, while LR often fail. These results illustrate the robustness of the WLRL model, and confirm the effectiveness of the proposed weighted low-rank decomposition with Laplacian regularization. From the figure we can conclude that (1) through the defect prior, the detection rate of large homogeneous defect regions can be increased, and (2) after adding the Laplace regular term, the experimental results show that the detection results Significant improvement.
Tables 2 and 3 are the comparison table of LR and WLRL test results on box- and star-patterned fabrics. It can be seen from Table 2 that WLRL has the best detection effect, that is, with overall highest ACC and highest TPR. And the total TPR increased by more than 20%, but at the same time, the FPR is inevitably slightly improved. It can be seen from Table 3 that the detection effect of WLRL has been greatly improved, especially for Thin Bar defect type, because WLRL has higher sensitivity to small and fine defects. In particular, the experimental results show that the WLRL can make up for the lack of LR and improve the detection accuracy.
The numerical comparison between LR and WLRL on box-patterned fabric.
The numerical comparison between LR and WLRL on star-patterned fabric
Adjusting the parameters of WLRL method
WLRL uses the weight parameter

Detection results under different parameters
Tables 4 and 5 show the TPR and FPR detection results of box- and star-patterned fabrics with different parameter
TPR and FPR w. r. t. different parameters for box-patterned fabric.
TPR and FPR w. r. t. different parameters for star-patterned fabric.
Comparison with state-of-the-arts
In this section, we test the WLRL on two categories of defective images: box- and star-patterned fabrics. In order to perform an intensive evaluation and clearly understand how accurate detection of the WLRL, we now compare the WLRL with other comparison methods in all respects (ER, PN-RPCA, GHOG-LR, and LSG).
Experimental results
For each defect type in the fabric image database, a defect image is randomly selected. The results of ER, PN-RPCA, GHOG-LR, LSG, and WLRL are illustrated in Figures 6 and 7. Figure 6 depicts the detection results of defective images chosen from box-patterned fabric database. LSG and WLRL detection results are significantly higher than other methods. PN-RPCA has a good detection result for Thick Bar, but the detection result of Hole is not ideal. In detail, GHOG-LR can detect the defective regions roughly but causes a large number of false detection. The main reason is that GHOG feature is not sensitive to box-patterned fabrics. In contrast, WLRL has strong adaptability to different types of defects and can accurately locate the defective regions.

Box-patterned fabric:Defective sample names (first row), testing images (second row), ground-truth(third row), detected results by ER (fourth row), PN-RPCA (fifth row), GHOG-LR (sixth row), LSG (seventh row), and our proposed WLRL (eighth row).

Star-patterned fabric:Defective sample names (first row), testing images (second row), ground-truth (third row), detected results by ER (fourth row), PN-RPCA (fifth row), GHOG-LR (sixth row), LSG (seventh row), and our proposed WLRL (eighth row).
Figure 7 depicts the detection results of defective images chosen from the star-patterned fabric database. All methods except ER show relatively accurate detection results, especially WLRL. Although GHOG-LR cannot accurately detect defects of Thin Bar type, it can roughly locate defects of other types, and its performance on star-patterned fabrics is better than box-patterned fabrics. Generally, WLRL shows accurate detection results compared with other methods.
Tables 6 and 7 tabulate the numerical results of each defect type in box- and star-patterned fabrics. The results of the recent fabric detection method ER, PN-RPCA, GHOG-LR, and LSG are compared with the WLRL.
Numerical results for each defect type of box-patterned fabric.
Numerical results for each defect type of star-patterned fabric.
The WLRL obtains overall results of 98.70% ACC, 72.83% TPR, 1.67% FPR, 36.78% PPV, and 99.63% NPV for the box-patterned fabrics (Table 6). The overall detection effect of WLRL is the best among all methods, that, with overall highest TPR and highest NPV. In all methods, the overall TPR (7.8%) of ER is the lowest, which indicates that it was less adaptable to the box-patterned fabrics. LSG achieves the highest overall PPV (75.8%) and the lowest overall FPR (1.06%), but its overall TPR (60.67%) is lower than WLRL (72.83%). GHOG-LR achieves the highest overall TPR (54.41%) for Thin Bar defect type, but the defect detection results for other types are poor. The ACC of several detection methods is more than 95%. In general, the results show that WLRL has stronger discriminative power to detect defects for box-patterned fabrics.
The WLRL obtains overall results of 99.09% ACC, 83.63% TPR, 1.75% FPR, 39.12% PPV, and 99.56% NPV for the star-patterned fabrics (Table 7). The overall detection effect of WLRL is the best among all methods, that is, with overall highest ACC and TPR. Although for defect type Thin Bar PN-RPCA outperforms WLRL about TPR (72.96%), it has a much worse TPR for other types while WLRL has the highest TPR for other types. LSG is a competitive rival for WLRL, but it has a much worse TPR than WLRL. Generally, the result of WLRL is very satisfactory and encouraging for defect detection on this kind of star-patterned fabrics.
In short, The WLRL compelling performances among all compared methods, both in numerical results and visualization for box-patterned fabrics and star-patterned fabrics.
Running time comparison
The real-time property of fabric algorithm is very important in industrial application. Therefore, the efficiency of the method is tested by using 50 fabric images and the running time is shown in Figure 8 Here x-coordinate represents the index of the fabric images and y- coordinate represents the running time of the method. The comparison methods used here include ER, PN-RPCA, GHOG-LR, and LSG, all of which run on the same device. In order to evaluate the method fairly, the running time does not include the training time. LSG is the most time-consuming of all methods because it needs to acquire cartoon components through morphological component analysis (MAC). Compared with PN-RPCA and GHOG-LR, WLRL is the most time-consuming, because WLRL consumes time in acquiring defect prior. Therefore, the performance of WLRL is better than other methods when considering accuracy.

The running time of ER, PN-RPCA, GHOG-LR, LSG and WLRL.
Conclusion
This paper presents a novel method for patterned fabric detection called WLRL, which combines weighted low-rank decomposition with Laplace regularization. A defect prior is added to the low-rank decomposition model to construct the weighted low-rank decomposition model, then add the Laplacian regularization to increase the distance between backgrounds and defects. Experiments show that WLRL can efficiently pinpoint the locations of defective objects in patterned fabric images with sharp edges. The average ACC and TPR of box- and star-patterned fabrics are 99.1% and 79.73%, respectively.
The database employed in this research is kindly provided by Industrial Automation Research Laboratory from Department of Electrical and Electronic of Hong Kong University
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This study was supported in part by the Postgraduate Research & Practice Innovation Program of Jiangsu Province (Grant No. KYCX19_1773) and Zhejiang Public Welfare Technology Research Social Development Project (Grant No. 2017C33223).
