Otwarty dostęp

Local Characterisation and Detection of Woven Fabric Texture Based on a Sparse Dictionary


Zacytuj

Introduction

Fabric texture representation plays a vital role in quality control procedures and automatic inspection, like automatic identification of weave density inspection [1], and detection of abnormal regions[2, 3]. A considerable number of approaches have been proposed for fabric texture analysis. These methods can be categorised into three types: spectral, statistical, and model-based [4]. The majority of these approaches focus on extracting useful texture features [5]. However, conducting an exhaustive survey of all texture features and then identifying a general feature that adapts to various types of fabrics are impractical. Moreover, no straightforward way can be used to judge whether the elements are suitable [6]. To avoid the shortcomings of fabric feature extraction, many researchers have adopted dictionary learning based on sparse representation to characterise fabric texture.

Dictionary learning based on sparse representation has been widely used in image compression [7], face feature recognition [8], and so on. Nevertheless, in the textile field, dictionary learning-based sparse representation is only used to detect defects. For example, Zhou et al. [9] presented a learned dictionary algorithm based on sparse representation. Their experimental results showed robust and improved performance with high precision and acceptable recall rates. Zhu et al. [10] used defect-free fabric images to build an overcomplete basis set via sparse coding. Then, the projections of a defect-free fabric patch in the basis set were regarded as original features. The characteristics of the test fabric were compared with the average of the original features, and their experimental results demonstrated that the algorithm proposed could detect defects on twill, plain, gingham, and striped fabrics efficiently. Therefore, fabric surface texture reconstruction is commonly adopted due to its consideration of the measurement characteristics of fabrics and the quality assessment of essential products.

Therefore, a novel method based on sparse representation for fabric texture analysis was designed. The method proposed was applied in two aspects: fabric characterisation and defects detection. For regular fabric texture, woven fabric parameters like the weave repeat were investigated to determine the impact on texture characterisation. In addition, the method proposed was also validated by inspecting fabric defects. The structure is illustrated in Figure 1.

Fig. 1

Procedure of fabric characterisation and defect detection

Materials and methods

To demonstrate the efficiency of our algorithm, the approach was applied to investigate the effect of the fabric weave repeat on texture reconstruction and detecting fabric defect samples. Firstly, eight weave repeats including plain, twill, honeycomb, warp satin, weft satin, basket, diamond twill, and complicated twill, were woven to explore how the weave pattern affects fabric texture representation. Aside from the weave pattern, other conditions, such as the material, weave density, and yarn count, were the same. Forty fabric samples, 20tex*2 folded yarns (cotton), were used in the warp and weft and then woven on a Sakura rapier loom (a TNY101B-20), which was semiautomatic. Secondly, fabric defects were detected. Among six kinds of samples, four were captured from the production line.

Dictionary learning based on sparse representation

Signal, Y = [y1, y2,…, yn], yiRm which included vectors of dimensionality m and considered the following optimisation problem, was obtained. This problem described the given signal Y as the sparsest representation A over the dictionary D and aimed to find proper representations and the dictionary jointly (Equation 1), minD,Ai=1nYDA22Subjecttoai0T \mathop {\min}\limits_{D,A} \sum\limits_{i = 1}^n {\left\| {Y - DA} \right\|_2^2\,{\rm{Subject}}\,{\rm{to}}\,{{\left\| {{a_i}} \right\|}_0} \le T} where T is a positive integer, which controls the degree of sparsity in A; pseudo-norm ||·||0 counts the number of non-zero entries in the formula. In Equation 1, dictionary D and coefficient matrix A are unknown. This means it is NP-hard, and a natural approach to a solving the problem is to alternate between two variables, minimising one while keeping the other one fixed. For the sparse solution, we computed the coefficient matrix A by using any pursuit algorithm and allowing each coefficient vector to have no more than T. Some efficient methods for approximate solutions, such as matching pursuit (MP) and basis pursuit (BP), are available.

Fabric characterisation

For an arbitrary fabric image, X = [x1, x2, …, xn] xiRm, fabric texture characterisation can be formulated by Equation 2. minD,Ai=1nxiDai22s.t.αi0T,1in \matrix{{\mathop {\min}\limits_{D,A} \sum\limits_{i = 1}^n {\left\| {{x_i} - D{a_i}} \right\|_2^2\,{\rm{s}}.{\rm{t}}.\,\,{{\left\| {{\alpha _i}} \right\|}_0} \le T},} & {1 \le i \le n} \cr}

The algorithm proposed included two parts: sparse coding and reconstruction. In the sparse coding part, the sample image was divided into small patches, and then every small patch was decomposed by fixing the dictionary to obtain the sparse coefficient matrix. The Discrete Cosine Transform dictionary (DCT) [12] was highly suitable for period signals because the woven fabric texture exhibited homogeneous subpatterns and a stable cycle. In this work, Orthogonal Matching Pursuit (OMP)[11] was adopted because of its simplicity and efficiency.

When the value XDA22 \left\| {X - DA} \right\|_2^2 reaches the predefined representation error tolerance, Â can be the output (Equation 3). A^=argminXDA22 \hat A = \arg\min \left\| {X - DA} \right\|_2^2

In the reconstruction part, an approximated image could be obtained using the product of the dictionary and coefficient matrix (Equation 4). X^=DA^ \hat X = D\hat A

Small image patch

In the sparse reconstruction, we represented the small patches instead of the entire image due to the computation burden. An image Z with a size of P× Q was obtained. Supposing that the patch size was l×l, the total number of patches was U=(P/l)×(Q/l) without overlaps [13], and V=(Pl+1)×(Pl+1) with overlaps l (Figure 2). In this framework, the sample was divided in different ways according to the aims.

Fig. 2

Flow chart of a small patch partition

Measurement of fabric texture period

Besides the description above, the influence of weave patterns on fabric texture reconstruction was investigated using a novel method to measure the fabric texture period. For an arbitrary grey level fabric image f(i, j) ∈ Rm×n, all of its rows are connected end-to-end to form a one-dimensional row vector XrRmn, and all its columns are connected end-to-end to form a one-dimensional row vector YcRmn. For Xr and Yc, their Fourier frequency domain amplitude curves PXr and PYc under the different periods can be plotted by one-dimensional Fourier transformation. Then we introduced the calculation process for the fabric weft cycle. Firstly, the value d1, corresponding to the maximum peak point in the frequency-domain amplitude curve, is extracted as the main period. Secondly, the value d2, corresponding to the maximum peak point in the frequency-domain amplitude curve, is extracted as the second period. Thirdly, the final period p for the weft can be obtained by Equation 5: p={d1,ifmin(d1,d2)/max(d1,d2)>m×n;min(DMF1,DMF2),elsemin(d1,d2)/max(d1,d2)m×nwhere,DMFs=1(m×nds)i=1m×nds|Xr(i)Xr(i+ds)|,s=1,2 \eqalign{& p = \left\{{\matrix{{{d_1},\,if\,min ({d_1},{d_2})/max ({d_1},{d_2}) > m \times n;} \hfill \cr {min (DM{F_1},DM{F_2}),\,else\,min \,({d_1},{d_2})/max ({d_1},{d_2}) \le m \times n} \hfill \cr}} \right. \cr & {\rm{where}},\,{\rm{DM}}{{\rm{F}}_s} = {1 \over {(m \times n - {d_s})}}\sum\limits_{i = 1}^{m \times n - {d_s}} {\left| {{X_r}(i) - {X_r}(i + {d_s})} \right|,\,s = 1,2} \cr}

Performance evaluation

In this study, we could measure the likeness between an arbitrary original fabric image X of M × N size and its approximated version X^ \hat X . The structural similarity index (SSIM) [14] and peak signal-to-noise ratio (PSNR) [15] were adopted as similarity measurements to evaluate the reconstructed image quality. The perceptual quality metric SSIM was introduced first. Its definition is shown in Equation 5, SSIM(X,X^)=[l(X,X)]α[c(X,X)]β[s(X,X)]γ {\rm{SSIM}}(X,\hat X) = {[l(X,X)]^\alpha}{[c(X,X)]^\beta}{[s(X,X)]^\gamma} where the dynamic range of SSIM is [−1, 1]. The higher the SSIM value is, the better the reconstructed image will be. The other index was PSNR, a common metric for evaluating the intensity similarity of a recovered image. Its definition is shown in Equation 6. MSE=i=1Mj=1N((X(i,j)X^(i,j)))2M×N,PSNR=10log10((255)2/MSE) {\rm{MSE}} = {{\sum\limits_{i = 1}^M {\sum\limits_{j = 1}^N {{{\left({\left({X(i,j) - \hat X(i,j)} \right)} \right)}^2}}}} \over {M \times N}},\,\,{\rm{PSNR}} = 10 \cdot {log _{10}}({(255)^2}/{\rm{MSE}})

From Equation 6, PSNR is a positive quantity, signifying how similar the original and reconstructed images are. Its trend is similar to that of SSIM.

Results and discussion

To avoid the influence of illumination conditions and other uncontrollable factors, the fabric samples were scanned using a Cano Scan 9000F Mark II in the grayscale mode, with auto scan, and at a resolution of 600 dpi. The images were cropped to a size of 256×256 pixels (shown below) with 256 grey levels. All experiments were implemented in MATLAB R2014a on a computer with a 1.8 GHz processor and 6 GB memory. The method proposed was applied to investigate the impact of the fabric weave repeat on texture representation and to detect fabric defects based on a variety of fabric samples (48 fabric samples), including 40 defect-free fabric images of different weave patterns and eight defective samples.

Fabric texture representation
Selection of dictionary size

From Equation 1, the coefficient matrix A was obtained using signal Y and dictionary D via OMP. Therefore, the size of D exerted a great effect on the fabric texture reconstruction. The influence of the dictionary size k on the fabric texture reconstruction should be explored. We selected five different sizes k with values of 16, 64, 100, 144, and 256. In the visual aspect, the reconstructed fabric samples looked the same as the original ones for k=256 (Figure 3).

Fig. 3

Visual reconstruction samples with different dictionary sizes: (a) reconstruction of plain fabric image; (b) reconstruction of twill fabric image.

In the quantity aspect, as the dictionary size k increased, the two quantitative indexes presented a sharp increase (Figure 4) at the beginning, and then they increased slowly. Until k=256, the values of PSNR and SSIM reached the maximum. For example, the SSIM value for twill was 0.9. Consequently, the dictionary size selected was 256 because it had the best performance.

Fig. 4

Representation result of the fabric samples with different dictionary sizes k: (a) PSNR; (b) SSIM

Selection of a small patch size and the cardinality of sparse representation

In the framework, the algorithm was operated on an image patch because of the higher computation cost for the entire image. Woven fabric is made of a cross combination of warp and weft yarns following a weave pattern. In general, partitioning images into small patches is important. Therefore, three different patch sizes, 8×8, 16×16, and 32×32, were explored for fabric texture reconstruction. We also tested two samples of T =1, 2, 3, 4, 5, 6, 7, 8, 9, 10 to investigate the influence of the cardinality T on fabric texture characterisation. Specifically, a fabric sample was divided by the three different patch sizes, and different values of T were used to reconstruct the sample. The performance was evaluated concerning PSNR and SSIM. The two samples adopted are shown in Figures 2a and 2b.

The test results of the fabric samples are illustrated in Figure 5, where the dictionary size was 256. From Figure 5, the difference is not evident for the two samples, and the trends are remarkably similar. For the same dictionary size, the smaller the patch size was, the more texture details were reconstructed.

Fig. 5

Representation results for two fabric samples: (a) and (b) are plain fabric's PSNR and SSIM for different patch sizes with various sparse cardinality T; (c) and (d) are twill fabric's PSNR and SSIM for different patch sizes with various sparse cardinality T

Thus, the quality of the reconstructed one and the similarity to the original sample for 8×8 were better than those for the other patch sizes. Generally, patch size 8×8 presented the best performance in terms of PSNR and SSIM for fabric texture representation; hence, it was selected to characterise fabric texture. Given that the approach proposed was based on sparse representation, the size of the cardinality of the sparse coefficient matrix exhibited an enormous effect on our method. When T was smaller than 6, PSNR and SSIM had fast growth, especially for 8×8 and 16×16. When T=6, the PSNR for the plain fabric was higher than 35 dB for the test samples, and the SSIM could reach approximately 0.96. As the value of T increased, namely, T >6, the rising rate of the two indexes slowed down, and the SSIM curves became almost convergent. The computation cost sharply increased with the rise in cardinality T. To determine the value of T, we considered the reconstruction performance and computation cost. In this regard, the final value of T=6 was adopted for fabric texture representation.

In this part, we represented the original fabric texture with a patch size of 8×8 and T=6. To evaluate the performance of output images, we compared the reconstructed samples with the original ones in visual and quantity aspects. Subsequently, we explored the relationship between fabric texture representation and weave pattern and then classified the fabric samples. In the visual aspect, we observed the original fabric samples. From the 40 samples we chose one for every weave repeat (Figure 6).

Fig. 6

Original fabric sample with different weave patterns: (a) plain, (b) twill, (c) weft satin,(d) warp satin, (e) basket weave, (f) honeycomb, (g) compound twill, (h) diamond twill

The reconstructed images for every weave pattern looked the same as the original fabrics. Nonetheless, the reconstructed images looked smoother and clean (Figure 6). This result could be attributed to the fact that the algorithm proposed could efficiently remove noise or blur, which might be caused by some inevitable factors, such as illumination and ash. In the quantity aspect, the values of SSIM for all the test samples were greater than 0.81 (Figure 7). Therefore, the experimental results demonstrated that the reconstructed images were identical to the original ones in visual and quantity aspects.

Fig. 7

Reconstructed fabric samples: (a) plain, (b) twill, (c) weft satin, (d) warp satin, (e) basket weave, (f) honeycomb, (g) compound twill, (h) diamond twill.

Effect of the weave pattern on woven fabric texture representation

To explore the relationship between weave pattern and texture presentation, we calculated the representation results of all the fabric samples (every weave pattern with five samples) in terms of PSNR and SSIM (Figure 8).

Texture period for various weave patterns, for every weave pattern, the left is warp period and the right is weft period

No. Sample Plain twill warp satin weft satin basket weave honey comb compound twill diamond twill
1 11 17 14 14 5 19 15 14 11 10 5 5 20 22 25 20
2 6 7 7 10 5 5 13 17 8 7 10 10 11 18 17 9
3 3 3 6 7 14 17 14 10 6 8 9 12 11 13 16 9
4 7 7 8 6 12 13 6 16 7 7 16 14 15 12 12 9
5 11 8 9 9 28 14 17 23 6 6 9 26 13 12 28 28
Average 8 8 9 9 13 14 13 16 8 8 10 13 14 15 20 15

Fig. 8

Representation results of all test samples; (a) PSNR, (b) SSIM

From Figure 8 it can be seen that every weave pattern might have diverse results; but the plain fabric generally had the best performance in the quality of reconstructed images regarding PSNR. The basket weave had the best similarity to the original fabric sample in terms of SSIM. The average PSNR for the basket weave was next to that for the plain one, and the SSIM for the plain weave was after that for the basket weave. Therefore, the plain and basket weave patterns showed better performance than the other weave patterns, which had a highly similar representation performance. The diamond twill, complicated twill, warp satin, and twill were after the best ones because their PSNR and SSIM had extremely small differences. Although a difference existed between the warp satin and honeycomb, the average result was the worst one.

As stated above, the weave pattern was roughly divided into three groups in terms of PSNR and SSIM. The texture period both in the direction of warp and weft was studied for all the test samples (see Table 1) to investigate their structure. To be more precise, the texture period and representation result were combined to classify the weave pattern. From Table 1, the texture period for plain, basket weave, and diamond were the same, which was the smallest among the weave patterns. In addition, the representation result for plain and basket weave was the best on the basis of PSNR and SSIM, as stated above. Therefore, the plain and basket weave was the first type. Except for the twill, the other weave patterns had a very similar period, it was very hard to classify the weave pattern. Considering the representation result, the warp satin, diamond twill, and compound twill belong to the second type. The warp satin, honeycomb, and twill were of the third kind.

Fabric defect detection

The method proposed could also be applied in fabric defect detection. To evaluate its efficiency, different kinds of fabric defects, eight in total, were detected. Firstly, the approximated image, which could be seen as a ‘standard template’, was obtained by the sparse dictionary with a non-overlapping small patch. Secondly, a subtraction was undertaken between the original image and reconstructed image. Finally, the defects were pointed out by setting an appropriate threshold patch by patch. The results are illustrated in Figure 9, from which different defects could be accurately located.

Fig. 9

Fabric defect detection result

Conclusions

In this paper, a novel algorithm is proposed based on sparse representation to address the fabric texture characterisation problem. The method proposed can efficiently approximate columns of regular fabric image samples with a linear combination of their elements. The parameter is flexible, and with different small patch division methods, the reconstructed woven fabric texture image can be applied to regular fabric texture and defective fabrics.

For fabric characterisation, the experimental results showed that different weave patterns have various representation results. The eight different weave patterns were preliminarily classified into three groups regarding the representation result and texture period. The plain and basket weave patterns had the best performance. The defects can be inspected well by the designed algorithm.

In the future, more kinds of fabric types and parameters may be taken into account to improve the representation result. The approach will be extended to detect complex fabric defect samples.