Abstract
In the process of textile production, automatic defect detection plays a key role in controlling product quality. Due to the complex texture features of fabric image, the traditional detection methods have poor adaptability, and low detection accuracy. The low rank representation model can divide the image into the low rank background and sparse object, and has proven suitable for fabric defect detection. However, how to further effectively characterize the fabric texture is still problematic in this kind of method. Moreover, most of them adopt nuclear norm optimization algorithm to solve the low rank model, which treat every singular value in the matrix equally. However, in the task of fabric defect detection, different singular values of feature matrix represent different information. In this paper, we proposed a novel fabric defect detection method based on the deep-handcrafted feature and weighted low-rank matrix representation. The feature characterization ability is effectively improved by fusing the global deep feature extracted by VGG network and the handcrafted low-level feature. Moreover, a weighted low-rank representation model is constructed to treat the matrix singular values differently by different weights, thus the most distinguishing feature of fabric texture can be preserved, which can efficiently outstand the defect and suppress the background. Qualitative and quantitative experiments on two public datasets show that our proposed method outperforms the state-of-the-art methods.
Introduction
Fabric defect detection plays an important role in the quality control of textile production. 1 It is traditionally conducted through visual inspections by the skilled workers, which is time-consuming and highly subjective. Therefore, manual approaches cannot meet the industry requirements. The fabric defect detection based on machine vision has drawn more attention in recent years because it can improve the detection accuracy and efficiency. Currently, some detection systems have been applied in the textile process, such as EVS I-Tex2000, Barco Visions Cyclops, and MQT, and achieve the ideal detection result. However, the details of these fabric defect detection algorithms have not been disclosed because of the intellectual property constraints, moreover, the existing devices are lack of self-adaptability for many kinds of fabric image. Therefore, the fabric defect detection method is still a research hotspot.
The fabric defect detection methods based on machine vision should be adapt to the fabric images with different texture, from simple non-motif fabric patterns (twill and plain fabrics, as shown in Figure 1(a)) to the complex motif fabric patterns (dot-, box-, and star-patterned fabrics, as shown in Figure 1(b)–(d)). For the plain and twill fabrics, the background is homogeneous and the defect is salient. Therefore, it is relative easy to detect defect for these fabrics. Most of the exiting defect detection methods focus on the twill and plain fabrics, and achieve high detection rate. According to the adopted image processing technology, they can be classified into four categories: statistical analysis methods, 2 frequency transform methods, 3 model based methods,4,5 and dictionary learning methods. 6 These methods are lack of adaptivity, and cannot be extended to the patterned fabrics with complex texture.

(a) Plain and twill, (b) star-patterned fabric, (c) box-patterned fabric, and (d) dot-patterned fabric.
The patterned fabrics are defined as fabrics with the repetitive patterned units in their designs. Even within the same type of patterned fabrics, the texture and the pattern sizes are different. Currently, some methods aiming at the patterned fabric defect detection have been proposed, such as the ELO rating (ER) method, 7 and wavelet-preprocessing golden image subtraction (WGIS), 8 and so on, which are performed in a supervised approach, require non-defective samples; In addition, the detection accuracy of these methods depends on the accurate partitions and the selected template, and is lack of the self-adaptivity.
Low-rank decomposition model aiming at recovering the underlying low-dimensional component of matrix can divide the data matrix into the redundant part which spanning several low-rank subspaces and the sparse part which is the outlier, has been successfully applied in object detection, image segmentation, image denoizing, etc.9,10 For any kinds of fabric images, their defect-free regions are macro-homogeneous, and lay in a low-dimensional subspace, while the defective regions are salient and sparse. Therefore, the task of the fabric defect detection can better fit the low-rank decomposition model comparing with the traditional object detection, and several fabric detection methods based on low-rank decomposition have been proposed.
However, the method based on low rank decomposition implicitly assumes that the fabric image is composed of two parts (background part and defect part). In fact, the defect fabric can be regarded as the combination of background part, defect part, and noise part. Therefore, the details between the various parts are not well considered in the method based on low rank decomposition, and the recovery may not be accurate. To deal with mixed data matrix, noise and corrosion better, dictionary learning theory is introduced into low rank decomposition model to generate a more general model, which is denoted as low rank representation model. However, the performance of this kind of methods depends on the effective feature descriptor and low-rank representation model.
Because the convolutional neural network can automatically learn the representative features layer by layer through a continuous propagation channel, the features generated by the convolutional neural network are global, especially can better capture the overall context information, thus it is generally believed that the features obtained by convolution neural network (CNN) are superior to the traditional handcrafted descriptors. Meanwhile, the handcrafted feature can also better characterize the low-level texture feature, and is complementary to the high-level deep feature. 11 Therefore, we propose the deep-handcrafted feature by combining the deep feature with handcrafted feature to further improve the characterization capability for the fabric image.
For the low rank representation models, they usually use nuclear norm to convex surrogate, and are solved by SVT algorithm. 12 However, the SVT method treats each singular value equally, in fact, the larger singular value contains more information, and thus the solution should be improved by differently treat the singular value. The larger singular values corresponding to the main projection direction should be retained to the maximum extent to preserve the main information of background. For smaller singular values, more penalty should be given to reduce the influence of outliers. Therefore, the weighted low rank representation (WLRR) is adopted to separate the sparse defect from background.
In summary, a novel fabric defect detection method based on deep-handcrafted feature and weighted low rank representation (WLRR) is proposed. The main contributions of our method can be summarized as follows:
(1) Because of the complexity of fabric texture, only the deep features or handcrafted features cannot fully characterize the fabric images. In this paper, a novel feature descriptor, denoted as deep-handcrafted features which are constructed by fusing the deep feature with handcrafted feature, is proposed to effectively represent fabric images.
(2) The solution method of low-rank representation model equally treats each singular value, and may causes the sparse defect and background cannot be separated effectively. To address this issue, a weighted low rank representation model is proposed, and treats the different singular values of feature matrix differently, thus it can preserve the main information of background and reduce the influence of outliers.
(3) Extensive experiments are conducted on two public fabric datasets, and the results show that the proposed method has good detection performance for plain or twill fabrics with simple textures as well as for patterned fabrics with complex textures. Moreover, the proposed method is superior to the state-of-the-art methods.
The rest of the paper is arranged as follows. The section II briefly reviews the relevant methods, and the section III introduces the details of the method. In section IV, a comprehensive evaluation of the proposed method is conducted through experiments. Section V summarizes the research.
Related works
Fabric defect detection plays an important role in textile industry. Machine vision provides an ideal solution for this problem. Many researchers focus on this study, and proposed some effective methods. These detection methods based on machine vision can be divided into two categories: one is for fabrics with plain or twill texture, the other is for the fabrics with patterns. The methods for fabric with plain or twill texture include statistical-based method, spectral analysis-based method, model-based method, dictionary learning-based method.
The statistical method divides the test image into image blocks, and then calculates their texture statistics properties. 2 The image blocks which occupy most of the same statistical properties are labeled as defect-free regions, and the others are marked as defect regions. The statistical methods include texton feature methods 13 and histogram method, 14 etc. However, these kinds of method are only applicable for the specific fabric texture, thus are lacking of adaptability.
The model-based methods model the fabric texture as a random process, and the defect detection is treated as a hypothesis testing problem based on the model. The commonly adopted models are Gaussian mixture model 15 and Gaussian Markov random field model, 16 etc. However, these methods often have high computational complexity, and poor performance for the defects with small size.
Dictionary learning methods first construct the dictionary from the test image, and then the defect free image is reconstructed using the dictionary. Finally, the defect detection is realized by subtracting the reconstructed defect free image and the test image. 6 However, for the fabric image with complex texture, the reconstructed images may exhibit regions similar to defects, thus results in the low detection accuracy.
The spectrum analysis methods transform the test image into the spectrum domain, and then utilize the energy standard of filter response to detect defects, such as Gabor transform 17 and wavelet transform. 18 These methods can capture the global characteristics of the image to detect defects, but the computational complexity is high and the detection results depends on the selected filter banks.
The above methods have achieved the ideal detection results for the fabric images with plain or twill texture, but they are lack of adaptivity, and cannot be extended to the patterned fabrics with complex texture. Recently, some researchers have proposed some methods for patterned fabric defect detection, such as the Bollinger band method (BB), 19 the wavelet-preprocessing golden image subtraction method (WGIS), 8 the ELO rating (ER) method, 7 and the TMPM method. 20
The BB methods utilized the property of regularity to detect defects on dot-, box-, and star-patterned fabrics. The WGIS method utilized a golden image to perform a moving subtraction of each pixel along each row of every wavelet-pre-processed test image. The ELO rating (ER) method is a method in which the detection of fabric defects is similar to carrying out fair matches in the spirit of good sportsmanship. The TMPM method used a golden image-like approach to exploit a discrepancy measure as a fitness function to detect defects on patterned textures. These detection methods adopted wavelet transform, Gabor transform, average value, standard deviation and regular bands to characterize the fabric texture, and performs a point-to-point comparison, thus they are inherently sensitive to image noise, misalignment, and distortion.
In recent years, convolutional neural network (CNN) has made great achievements in the field of computer vision. Some researchers have adopted CNN to detect fabric defects. Ruo et al. 21 proposed a fabric defect detection method based on convolution neural network. It uses the pretrained network to construct the classifier, and then convolutes the image to be measured to complete the pixel level prediction. Zhang et al. 22 proposed a supervised convolutional neural network, which is trained to classify each image block and identify defects by thresholding. Although the methods based on convolutional neural network have achieved good performance, but it is a heavy workload to construct the training sets with large-scale. In addition, these CNN methods are difficult to be deployed on the production line.
For any kinds of fabric images, the background is composed of regular repeated textures, which has higher data redundancy. And the defects are sparse and salient among the background. By decomposing the feature matrix into a low-rank matrix corresponding to the background and a sparse matrix corresponding to the object, low-rank decomposition model can be well applied for the fabric defect detection.
Cao et al. 23 proposed a low-rank decomposition model (Robust principal component analysis, RPCA) by introducing noise term to detect fabric defects. However, this method ignores the continuity of sparse pixels, which is not suitable for the continuous defect detection. Liu et al. 24 proposed a fabric defect detection method based on deep convolution neural network and low rank recovery. Firstly, deep convolution neural network is used to extract fabric features and generate feature matrix, and then low rank recovery model was used to locate defects. Ji et al. 25 proposed a detection method based on weighted low rank decomposition and Laplacian regularization term. By introducing Laplacian regularization term to expand the distance between background and defect area, the robustness of the model is enhanced.
Shi et al. 26 proposed a decomposition model based on gradient information, which guided the low rank model to detect defects through the gradient information of the test image. Qizi et al. 27 proposed a low-rank decomposition detection method based on image texture prior information. Firstly, a priori matrix is constructed according to the test image, and then the low rank model is guided by the prior matrix to detect defects. However, the performance of these methods using prior information to guide low rank models is limited by the texture prior matrix. The inaccuracy prior information will decrease the detection performance. Shi et al. 28 proposed a low rank decomposition detection method based on gradient information and structure graph, which effectively solved the problem of inaccurate prior information by using structure graph algorithm. Li et al. 29 proposed a novel fabric defect detection algorithm based on biological vision modeling by simulating the mechanism of biological visual perception. The detection performance is still not satisfactory because the traditional manual feature descriptors cannot efficiently characterize the fabric texture. We have listed a brief list of some methods for detecting fabric defects, as shown in Table 1.
Brief table of different fabric defect detection methods.
In order to improve the detection performance, a new powerful descriptor should be proposed to efficiently characterize the fabric texture, and make the normal regions lay in a low-rank subspace, while the defective regions are far away from the subspace. In addition, an effective low-rank decomposition model also should be developed to separate the defect from the background. However, the above methods still only use traditional manual features or deep features, which are not enough for complex texture fabric images. In addition, SVT algorithm is usually used to solve the existing low rank models, which ignores the different importance of singular values with different sizes. To solve these problems, a fabric defect detection method based on deep-handcrafted feature and weighted low rank representation is proposed in this paper.
The proposed method
A powerful feature descriptor and effective low-rank decomposition model are crucial for the low-rank based fabric defect detection method. In this paper, a fabric defect detection method based on deep-handcrafted features and weighted low rank representation is developed, and it includes three steps. Firstly, multi-layer deep features are extracted by VGG16 after transfer learning, and are cascaded with handcrafted features to effectively characterize the fabric texture. Then, an adaptive weighted low rank representation model is proposed to divide the deep-handcrafted feature matrix into low rank matrix corresponding to background and sparse matrix corresponding to defect. Finally, the defect is located by threshold segmentation algorithm. The flowchart of the proposed method is shown in Figure 2.

Framework of the proposed method.
Deep-handcrafted feature extraction
A powerful feature descriptor can make the normal background lay in a low-rank subspace, while the defective regions are far away from the subspace. Therefore, feature extraction is crucial for fabric defect detection based on low rank decomposition model. The performance of traditional handcrafted descriptors depends on professional knowledge, and this designed handcrafted descriptor can be used for better characterizing some specific feature. The fabric images have complex texture, thus low-level texture feature is important for characterizing the fabric image. In this paper, we designed a handcrafted texture feature by modeling the human vision. In addition, Li et al. 11 proposed that deep features contain enough high-level abstract semantic information, while low-level comparative information is insufficient. It is worth noting that deep features and handcrafted low-level features are complementary. Wang et al. 30 found that deep features can be enhanced by adding handcrafted features. By combining the respective advantages of handcrafted and deep feature, the representation ability of fabric image can be enhanced.
Hand-crafted feature extraction
Weng et al. 31 pointed that the feature descriptors based on the mechanisms of the human visual system are suitable for characterizing complex textures, and have proposed a novel feature descriptor, denoted as distinctive efcient robust features (DERF). In this paper, we adopted this feature descriptor for better characterizing the fabric low-level texture. And it can be described as follow in detail.
Firstly, the test fabric image is divided into the image blocks
where
Then, the DERF descriptor is established by simulating the structure of the receptor region of P-ganglion cells in the
where
where
Deep feature extraction
Considering that VGG16 network has the expansibility advantage, the pre-trained VGG16 models are adopted for extracting high-level abstract semantic information in our method. Since the size of the output feature map of the convolution layer in VGG16 is not consistent, in order to improve the detection accuracy of the detects with small size, we resize the feature map to the input image. For each pixel, the deep feature is formed by concatenating the value of the feature map in the same position. Let
where
Then deep feature matrix can be obtained by stacking the features of all image blocks.
To facilitate the fusion of depth feature and handcrafted feature, we use principal component analysis (PCA) to reduce them to the same
Weighted low rank representation model construction
The low rank decomposition model decomposes the feature matrix into a low rank matrix and a sparse matrix which representing the background region and the defect region of an image, respectively. Therefore, the low rank decomposition model can be used for defect detection, and has been proven applicable. Given an feature
where
Optimization problem (10) is a bi-objective optimization problem, which is difficult to solve. Thus we should transform it into the following single objective optimization problem.
where
where
where
The problem (13) is convex and can be solved by ALM method. However, this solution method treats each singular value equally. In fact, the matrix singular values represent different information, and the larger singular value contains more information. When decomposing the feature matrix, the larger singular values corresponding to the main projection direction should be retained to the maximum extent, and it can retain the main information. For smaller singular values, more penalty should be given to reduce the influence of outliers. Therefore, the weighted nuclear norm minimization (WNNM) is proposed to shrunk the singular values of the matrix differently. The definition of WNNM is
where
where
Optimization of WLRR
In order to facilitate the optimization solution, the variable
Then, the augmented Lagrangian function of equation (17) can be described as follows.
where
Let
is
Based on the above lemma, equation (18) can be solved using Alternating Direction Method of Multipliers (ADMM), 37 and specifically described as follows.
(1) Updating
The optimization problem of
For fabric defect detection, the larger singular value of matrix contains more important components, while the traditional solution method treats all singular values equally, so the results deviate from the real solution. In this paper, we set the different weights for each singular value based on their value, and the weights are calculated as follows:
where
(2) Updating
(3) Updating
The proposed WLRR can be solved by the iterative algorithm, can it can be described as Algorithm 1.
Saliency map generation
After the final sparse matrix
Then, the corresponding saliency map
where
Experiment result
Experiments setup
Dataset
Two public fabric databases are adopted to conduct comprehensive evaluation of the proposed methods. One is TILDA fabric image dataset, 39 constructed by workgroup on texture analysis of German Research Council. It is mainly composed of unpatterned fabric images. The other is from the Research Associate of Industrial Automation Research Laboratory, Department of Electrical and Electronic Engineering, Hong Kong University. It mainly includes the patterned fabric images with complex texture, such as the star-, box-, and dot-patterned fabric.
WLRR solution
Implementation details
First, we transfer the domain-specific VGG16 to fit our fabric database by replacing the original softmax layer (i.e. whether it belongs to defect image) with 2-way output. Then, the transfer learning is carried out by stochastic gradient descent with a batch size of 16, momentum of 0.9, weight decay of 0.0001, and the learning rate is initially of 0.0001. For the WLRR model, the model parameters set to 0.001.
All parameters are kept fixed for all the experiments to demonstrate the robustness and stability of our method. The simulation is performed in MATLAB 2019a, running on a PC with an i7-7700 CPU accelerated by a HD Graphics 630 (1024MB) GPU.
Evaluation criteria
To perform a comprehensive evaluation, the statistical parameters are introduced to verify the performance, including true positive (TP), true negative (TN), false positive (FP), and false negative (FN). Based on the above parameters, evaluation criteria are defined as follows:
Moreover, F-measures (F) is also shown based on the above evaluation criteria. It should be noted that because of the lack of ground-truth in the TILDA fabric database, the above quantitative evaluation will only be conducted for the patterned fabric databases.
Experimental results and analysis
Comparison of deep features and handcrafted features
Activation of each convolution layer is used to form deep feature. We present the detection results of the first eight layers of VGG16, as presented in Figure 3. The first column is the original image; the second column to the last column are the generated saliency map using the Conv

Comparison of the Rank, nuclear norm and weighted nuclear norm.
The numerical results of the first eight convolution layers.
Bold indicates the best performance.
As can be seen from Figure 4 and Table 2, the deepest and shallowest convolution layers produce worse results, while the middle layer achieves better detection results. Among them, the Conv

The saliency maps of different convolution layers.
In order to perform a quantitative evaluation, we list the detection results of handcrafted features and deep-handcrafted features to prove the effectiveness of the proposed fusion strategy, as shown in Figure 5. And the numerical results are shown in Table 3. According to the quantitative and qualitative experiments, we can conclude that the deep features and handcrafted features complement each other, and the detection results are better than the single feature.

Detection results for the unpattern images and pattern fabric images with three configurations. The first row is the original image, detection results of LRR, PLRR, WLRR are listed from the second row to the fourth row.
The numerical results of the deep features, handcrafted features, and deep-handcrafted features.
Bold indicates the best performance.
Comparisons of saliency inference models
In section III, a saliency inference model WLRR is proposed to generate the defect saliency map. To validate its effectiveness, we compare our proposed model with the other two models: (1) original LRR (i.e. RPCA when dictionary matrix is identity matrix); (2) LRR based on other weighted nuclear norms (Schatten p norm, see Ref. 40 ). The results are shown in Figure 6. The first row is the original image, and the last three lines are saliency maps generated by LRR, PLRR, and WLRR.

The detection results of handcrafted features and deep-handcrafted features.
In our method, the weight operator can preserve more defects information in sparse matrix, thus can get the accurate results. From Figure 6, espically for the sixth image, we can see that WLRR retain more defect profile information comparing with LRR and PLRR.
To further prove the efficiency of the proposed methods, the numerical results of the three methods in the pattern fabric image are shown in Table 4. We can conclude that WLRR performs better than the other two. Both qualitative and quantitative experiments confirm that the effectiveness of WLRR is more suitable for the fabric defect detection.
The numerical results of LRR, PLRR, WLRR.
Bold indicates the best performance.
Comparisons with the state of the arts
In this section, we compare the detection results of our method with the state-of-the art, including GABOR, 41 LSF-GSA, 42 ESP, 43 and SOMC. 44 All of the saliency maps are shown in Figures 7 to 9, which show comparisons of box-patterned fabrics, dot-patterned fabrics and star-patterned fabrics. The first row is the original fabric image, and the second to the sixth rows are saliency maps generated by the GABOR, LSF-GSA, ESP, SOMC methods, and our proposed method. The seventh row is the segmentation results generated by our method and the last row is the ground-truth images.

Detection results for box-patterned fabric images: The defect types are (a) broken end, (b) hole, (c) netting multiple, (d) thick bar, and (e) thin bar.

Detection results for star-patterned fabric images: The defect types are (a) broken end, (b) hole, (c) netting multiple, (d) thick bar, and (e) thin bar.

Detection results for dot-patterned fabric images: The defect types are (a) broken end, (b) hole, (c) knots, (d) netting multiple, (e) thick bar, and (f) thin bar.
It can be observed that there are more discontinuous regions in Gabor method, and there are many missing results. LSF-GSA combines local texture features with global analysis to generate saliency map, but the detection effect is poor and there are many noises. The ESP method has poor detection effect, especially in the detection of defects similar to the background, which shows that the method is not suitable for the detection of complex pattern fabrics. SOMC method can effectively detect the location and contour of defects, but its detection effect on dot fabric is worse than the other two fabrics. In addition, the performance of this method is poor for the defect with large size. Our method can not only detect the location of defect area, but also describe the defect contour of fabric image. The binary image obtained by segmentation is similar to the true value image. In addition, as shown in Figures 7(d) and 8(a), the proposed method can detect fabric images with large defects more effectively than other methods.
In the quantitative evaluation, we give the evaluation results of the above methods on box, dot, and star pattern fabric images. The best performing data will be shown in bold. Since the saliency map generated by ESP method are binary graphs, they are not evaluated numerically. From Table 5, we can see that in most cases, the performance of our proposed method on three patterned fabric datasets is better than the existing methods. In summary, the qualitative and quantitative experiments prove the superiority of our method.
Average numerical detection results of different patterns of fabric images.
Bold indicates the best performance.
Conclusion
In this paper, we proposed a novel fabric defect detection method on deep-handcrafted feature and WLRR. Based on the fact that manual low-level features and deep features can complement each other, the deep features extracted from VGG16 are fused with handcrafted features to improve the representation ability of fabric texture. Then, the fabric image is decomposed into background part and sparse defect part by LRR. At the same time, the weighted kernel norm is used to regularize the background matrix, so that the singular value of the matrix can be shrunk differently to retain the most important information. We also compare the performance of the proposed method with the previous methods (e.g. Gabor, GSA, ESP, SOMC). The results of qualitative and quantitative experiments show that our method is more effective than the state-of-the-art. In addition, the proposed method provides a new solution for the surface anomaly detection of other industrial products.
Footnotes
Acknowledgements
The authors would like to thank Dr. Henry Y.T. Ngan, Industrial Automation Research Laboratory, Department of Electrical and Electronic Engineering, The University of Hong Kong, for providing the database of patterned fabric images.
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 work was supported by NSFC (No. U1804157, 61772576, No. 62072489), Henan science and technology innovation team (CXTD2017091), IRTSTHN (21IRTSTHN013), Program for Interdisciplinary Direction Team in Zhongyuan University of Technology. ZhongYuan Science and Technology Innovation Leading Talent Program (214200510013).
