1 Introduction

Fabric defect detection plays an important role in the quality control of fabric products. The traditional manual detection results depend on human subjectivity to a large extent. But due to human fatigue, high labor costs, and slow inspection speed, their performance is often unreliable. Therefore, the automatic detection technology of fabric defect based on image processing has become a research focus.

The existing automatic fabric defect detection algorithms can be divided into four categories: model-based method, spectral analysis method, statistical-based method, and learning-based method [1]. (1) The model-based methods extract image texture features via modeling and parameter estimation techniques. The defect detection problem can be treated as a statistical hypothesis-testing problem on the statistics derived from this model. It includes Gauss Markov random field model [2], Poisson model [3] and Wold model [4]. However, the model-based methods share high computational complexity, and the detection results are not satisfactory. (2) Spectral analysis methods transform fabric images into the spectral domain and then detect the defects by some energy criterions, such as Fourier transform, wavelet transform and Gabor filter. But the detection performance depends on the selection of filter banks [5]. (3) Statistical-based methods employ the spatial distribution of gray values to detect fabric defects. However, they have the disadvantages that we should design the specific detection method for different fabric types, and they are hard to detect the defects with small size [6,7,8]. (4) The performance of the learning-based methods highly depends on the large scale training dataset. In addition, it is difficult to establish an effective and stable defect model through the limited training dataset because some fabric defects rarely occur, which causes the unsatisfactory results [9].

The low-rank decomposition model is consistent with the low-rank sparsity of human visual system. It can divide the image matrix into a low-rank part which corresponds to the background and a sparse matrix which corresponds to the object, and it has achieved good results in saliency detection and object detection [10,11,12]. For fabric images with complex texture, the background is highly redundant and the defects are saliently sparse, so the low-rank decomposition model is more suitable for the fabric defect detection than the object detection in the natural scene. Recently, we and some other researchers have exploited the low-rank decomposition model for fabric defect detection [8, 13, 14] and obtained good results in the fabric images with relatively simple texture. It demonstrates that it is feasible to use the low-rank decomposition model for fabric defect detection.

Effective image representation is crucial for fabric defect detection based on low-rank decomposition model, it can make the background of fabric images lie in a low-dimensional subspace, and the salient defects deviate from this subspace. Therefore, the low-rank decomposition model can easily divide the image into the background part and object part. However, the proposed fabric defect detection methods based on low-rank decomposition model adopted the traditional feature extraction methods, such as local binary pattern (LBP), Gabor filtering and histogram of oriented gradient (HOG), they cannot effectively represent the fabric image with complex texture, which lead to poor detection performance. Hence, it is necessary to propose an effective feature representation method for different fabric images. Fabric is woven by warp and weft. The normal fabric image has specific orientation information and the defects destroy the normal orientation information. For this reason, the effective extraction of orientation feature is crucial for the final detection results. However, the orientation information varies with the different fabric texture. Therefore, the multi-orientation feature should be extracted to efficiently describe the fabric texture.

In this paper, we proposed a novel fabric defect detection algorithm based on the multi-channel feature extraction and joint low-rank decomposition. First, the fabric image is filtered to generate multiple gradient orientation maps, a multi-channel robust feature is extracted by adopting the approach proposed in literature [15] by simulating the biological visual perception mechanism for multiple gradient orientation maps. Then, joint low-rank decomposition algorithm is employed to divide the multi-channel feature matrix into low-rank matrices and sparse matrices. Finally, an improved threshold segmentation algorithm is used to segment the saliency map generated by sparse matrices to localize the defective region.

2 McDerf Feature Extraction

The great progress of the visual perception mechanism research demonstrates that invariant feature extraction is one of the most important information processing tasks for the human visual system and is also a common characteristic of senior cortex cells in the process of information integration. Therefore, the feature descriptors based on the mechanism of the human visual system are more suitable to characterize the complex texture of all kinds of fabric. In the literature [15], the authors proposed a local image descriptor denoted as Distinctive Efficient Robust Feature (DERF) by modeling the response and distribution properties of the ganglion cells in the retina, it is superior to the traditional design methods based on artificial experience hand-crafted local descriptors.

Fig. 1.
figure 1

Construction process of the proposed McDerf

In this paper, we proposed an improved multi-channel Derf denoted as McDerf to efficiently describe the orientation feature based on the DERF proposed by Weng et al. [15]. First, the gradient orientation maps generated by DERF are filtered by DoG (Difference of Gaussian), respectively. And then the filtered gradient orientation maps are pooled according to the ganglion cell coding, so we can get the orientation feature matrix for each gradient orientation map respectively. It is necessary to divide the fabric image into image patches in the process of defect detection and combine the McDerf features of image patches into multiple feature matrices so as to realize the localization of the defective regions. The specific extraction process includes: (1) multi-channel Derf feature extraction; (2) feature matrix generation. The feature extraction process is shown in Fig. 1.

2.1 Multi-channel Derf Feature Extraction

Based on the Derf feature proposed in [15], we proposed the McDerf, and its construction can be described as follows.

  1. (1)

    The H gradient orientation maps are calculated using Eq. (1).

    $$\begin{aligned} G_o = (\frac{{\partial I}}{{\partial o}})^ +,1 \le o \le H \end{aligned}$$
    (1)

    where I is the input image, o is the orientation of the derivative, \((\cdot )^ +\) and is the operator such that \((a)^ + = \max (a,0)\).

  2. (2)

    Each gradient orientation map of H is convolved \(S+1\) times using Gaussian kernels with different value \(\varSigma \) to obtain Gaussian convolution orientation maps \(G_o^\varSigma \) for the sake of allowing the gradients without abrupt changes under the circumstance of neighborhood slight changes, the standard deviation of the Gaussian kernel is proportional to the radius of the given neighborhood.

    $$\begin{aligned} G_o^\varSigma = G_\varSigma *G_o \end{aligned}$$
    (2)

    where \(G_\varSigma \) is a Gaussian kernel with scale \(\varSigma \).

    For each orientation of the Gaussian convolution orientation maps, the DoG convolution orientation maps is obtained by subtracting the large scale from the small scale of the two adjacent Gaussian convolution orientation maps.

    $$\begin{aligned} D_o^{\varSigma _1 } = G_o^{\varSigma _1 } - G_o^{\varSigma _2 }, \varSigma _1 < \varSigma _2 \end{aligned}$$
    (3)
  3. (3)

    We assemble the feature vector by sampling the DoG convolution orientation maps. The sampling grid points are located in many concentric rings with different radii increasing in exponential manner, and the corresponding DoG convolution kernel scale is also increased in exponential manner, as shown in Fig. 1. Therefore, there are four parameters that determine the shape of the pooling arrangement, i.e. the radius of the region (R), number of concentric rings with different scales (S), the number of gradient orientations (H), number of grid points on each concentric ring (T). Let \(F_{so}\) represent the single scale vector of one channel constructed of the values at location (xy) in the DoG convolution orientation maps:

    (4)

    where \(1 \le o \le H\), \(l_{jo} (x,y,\varSigma )\) is location with the orientation o on different scales \(\varSigma \) in the orientation given by j grid point.

    Researchers have recently found that the receptive field of ganglion cells can be resized to a certain extent [16,17,18], which results in the variable size of the receptive field. But the degree of size change is slight. Considering this modulation mechanism of receptive field of ganglion cells, we add two neighboring scales to the inherent scale of each grid point, which results in a total of three scales for each grid. However, for the grids with the smallest scale, we add the second scale to each grid, and for the grids with the largest scale, we add the reciprocal second scale. Formally, the multiple scales one channel of McDerf descriptor centered at (xy) is defined as follows:

    (5)

    where \(1 \le o \le H\), we can extract H channel features for the fabric image.

2.2 Feature Matrices Construction

In order to localize the defective region, the fabric image is divided into N image patches with the same size. Then we extract their multi-channel features \(f_i^k\) (where i is the image patches index, \(i = 1,2, \cdots , N\), k is the channel index, \(k = 1, 2, \cdots , H\)) to project the normal image patches into a low-dimension subspace. All the features of the image patches are concentrated into H feature matrices \(F^K = [f_1^k, f_2^k, \cdots , f_N^k]\), and then low-rank decomposition model can divide the feature matrix into low-rank part and sparse part. Finally, fabric defect detection is transformed into the low-rank decomposition of the feature matrix F, where the low-rank matrix L is the normal fabric image, the sparse matrix S corresponds to the salient object.

3 Joint Low-Rank Decomposition

For one feature matrix \(F^k\), it can be decomposed into a low-rank matrix \(L_0\) and a sparse matrix \(S_0\) corresponding to the non-salient background and the salient object, respectively. It is defined as low-rank matrix recovery problem, and can be realized by the following equation:

(6)

where \(\left\| \cdot \right\| _*\) denotes the matrix nuclear norm (sum of the singular values of a matrix), which is a convex relaxation of the rank function. \(\left\| \cdot \right\| _1\) is the \(l_1\)norm to improve the sparsity, \(\lambda > 0\) is used to balance the effect of the two parts.

The above low-rank decomposition model only can model a single type of visual features, which cannot be directly used for multi-channel feature case. To combine the low-rank decomposition model with the multi-channel feature, we adopt a new solution of multi-task sparsity pursuit (MTSP) [19] for fabric defect detection, as shown in Fig. 2.

Fig. 2.
figure 2

Multi-task sparsity pursuit model: for a given image, we extract H orientation feature matrices \(F^1, F^2, \cdots , F^H\), with F corresponding to a certain orientation of feature. Its saliency map is inferred by seeking the consistently sparse elements S from the joint decompositions of multiple feature matrices \(F^i\) into pairs of low-rank and sparse matrices.

MTSP model looks for a joint sparse matrix S by solving the following convex optimization problem:

(7)

where \(\left\| \cdot \right\| _{2,1}\) is the \(l_{2,1}\)norm defined as the sum of \(l_2\)norm of the columns of a matrix:

$$\begin{aligned} \left\| S \right\| _{2,1} = \sum \limits _i {\sqrt{\sum \limits _j {(S(j,i))^2 } } } \end{aligned}$$
(8)

The minimization of \(l_{2,1}\)norm leads the column of S to be sparsity (most of its elements are zeros). \(S = [S_1; S_2; \cdots ; S_H ]\) is formed by vertically concatenating \(S_1, S_2, \cdots , S_H\) together along column. The integration of multiple channel features is achieved by minimizing the \(l_{2,1}\)norm of S, which requires the columns of \(S_1, S_2, \cdots , S_H\) to have jointly consistent magnitudes. Since the columns in different matrices with the same index correspond to the same image patch, this method is also to encourage different features with synergistic effect to produce consistent saliency maps.

The Eq. (7) is a convex optimization problem. In this paper, we adopted the augmented Lagrange multiplier (ALM) algorithm to solve it [20]. Let \(\left\{ {S_1^*, S_2^*, \cdots , S_H^* } \right\} \) be the sparse part which is obtained by the optimal solution of the Eq. (7). We quantify the response of the sparse matrices to obtain a saliency score for the \(i\mathrm{{ - th}}\) patch \(P_i\). And the calculation equation can be describes as follows:

$$\begin{aligned} S(P_i) = \sum \limits _\mathrm{{k}}^H {\left\| {S_k^* (:,i)} \right\| _2 } = \sum \limits _k^H {\sqrt{\sum \limits _j {(S_k^* (j,i))^2 } } } \end{aligned}$$
(9)

where \(\left\| {S_k^* (:,i)} \right\| _2\) is the \(l_2\)norm of the \(i\mathrm{{ - th}}\) column of \(S_k^*\), the higher saliency score \(S(P_i)\) represents the image patch i belongs to the defect with high probability. Finally, the threshold segmentation algorithm [21] is adopted to segment the saliency map generated by multiple sparse matrices to localize the defect region.

4 Experimental Results and Analysis

In order to verify the effectiveness of our algorithm for different fabric images, we randomly select several kinds of fabric defect images from the fabric image database (TILDA, patterned fabrics datasets: dot-, box-, star-patterned datasets) (including: broken end, netting multiple, hole, thick bar, thin bar, etc.). The fabric image size is \(256 \times 256\), and they are divided into image patches with size of \(16 \times 16\) for localizing the defect region. All experiments are implemented in the environment of Intel(R) Core(TM) i5-4570, 8 GHz CPU by using software Matlab 2011a.

We first analyze the influences of different channel. The McDerf feature with different channel is extracted for detecting the defects, and the results are shown in Fig. 3. The first column is the original fabric image, detection results are listed from the second column to the last by setting \(H = 2,4,6,8\). From the detection results we can see that when the number of channel is small, some detected defects are not continuous. The detection performance is improved with increasing the channel number. When the channel number is greater than 6, the detection accuracy keeps unchanged. Therefore, the channel number is set to 6 for the tradeoff between efficiency and accuracy.

Fig. 3.
figure 3

The saliency detection for different channel: the first column is the original fabric image. Detection results are listed from the second column to the last by setting \(H = 2, 4, 6, 8\).

In order to further verify the effectiveness of the proposed algorithm, we have compared our method with the existing saliency detection methods, such as the unified method based on low-rank matrix recovery (ULR) [22], wavelet transform method (WT) [23], histogram of oriented gradient (HOG) [13], least squares regression (LSR) [8]. The experimental results are demonstrated in Fig. 4. The first column is the original images. The detection results of ULR, WT, HOG, LSR and our method are listed from the second column to the sixth column. From Fig. 4, we can see that the results of ULR, WT and HOG methods have serious noise and error. This demonstrates that the three methods are only suitable for the fabric images with simple texture, while not for the fabric images with complex texture. For the LSR method, it can nearly localize all the defective regions, but the defective regions are not precise enough, such as the fourth and the last image in Fig. 4. The result of our method is shown in the sixth column, and the last column is the binarization result obtained by threshold segmentation. It can be seen from Fig. 4 that our method not only precisely localize the defective region of all the fabric images, but also can outline the correct defect shape.

Fig. 4.
figure 4

Comparison of the detection results for different methods: the first column is the original fabric images. Detection results of ULR [22], WT [23], HOG [13], LSR [8] and our method are listed from the second column to the six column, the last column is the final segmentation result generated by our method.

5 Conclusion

Fabric defect detection is a key part of quality control in the textile industry. In this paper, a novel fabric defect detection algorithm based on multi-channel feature extraction and joint low-rank decomposition is proposed. The proposed method has two contributions: (1) the multi-channel orientation features are extracted by gradient calculation and spooling technology based on the ganglion cell coding; (2) the joint low-rank decomposition technology is adopted to decompose the multiple feature matrixes into low-rank part and sparse part. The detection results are obtained by segmenting the saliency map generated by the sparse part. Experimental results demonstrate that our method can accurately detect the defect regions of various fabric defects, even for the image with complex texture.