Using the Dual-Tree Complex Wavelet Transform for Improved Fabric Defect Detection

The dual-tree complex wavelet transform (DTCWT) solves the problems of shift variance and low directional selectivity in two and higher dimensions foundwith the commonly used discrete wavelet transform (DWT). It has been proposed for applications such as texture classification and content-based image retrieval. In this paper, the performance of the dual-tree complex wavelet transform for fabric defect detection is evaluated. As experimental samples, the fabric images from TILDA, a textile texture database from the Workgroup on Texture Analysis of the German Research Council (DFG), are used. The mean energies of real and imaginary parts of complex wavelet coefficients taken separately are identified as effective features for the purpose of fabric defect detection. Then it is shown that the use of the dual-tree complex wavelet transform yields greater performance as compared to the undecimated wavelet transform (UDWT) with a detection rate of 4.5% to 15.8% higher depending on the fabric type.


Introduction
The discrete wavelet transform has been commonly used for feature extraction in fabric defect detection research.For example, Lambert and Bock [1] performed experiments using several wavelet bases and compared the defect detection performance in fabric images.Other related research results have been published [2][3][4][5].
However, the discrete wavelet transform (DWT) in its critically sampled form suffers from the problem of shift variance that makes it unsuitable for pattern recognition applications such as fabric defect detection [6].The solution that has been usually used is the undecimated discrete wavelet transform (UDWT) [7][8][9].
Even if the UDWT solves the problem of shift variance, it has a high redundancy rate of 3+1 for image representation, where  is the number of wavelet decomposition levels.That leads to increased computational requirements [10].In addition, it does not solve the shortcoming of poor directional selectivity for diagonal features in 2D.This weakness of UDWT lowers the discrimination power of its texture features.
The dual-tree complex wavelet transform (DTCWT), first introduced by Kingsbury in 1998 [10,11], is approximately shift invariant and allows directional wavelets in 2 and higher dimensions with only 2x redundancy in 1D (2  for -dimensional signals, in general) [12].It has been used in several research papers especially for texture characterisation.For example, Costin and Ignat [13] discussed the effectiveness of the cosine similarity measure, the Pearson coefficient, and the Frobenius norm applied to the magnitudes of DTCWT coefficients of texture images in order to decide on their similarities.Other applications include content-based image retrieval [14,15], image segmentation [16], and texture classification [17,18].Specific to textiles, Wang et al. used the 2D dual-tree complex wavelet transform to separate the fabric texture and the pilling information from the image of the pilled nonwoven fabric.They then used that pilling information and a supervised neural network classifier for objective pilling evaluation [19].
However, there is limited literature on the application of the dual-tree complex wavelet transform to fabric defect detection.In this paper, the dual-tree complex wavelet to extract texture features and then a Euclidean distance classifier are used in order to detect defects in textile fabrics.The objective is twofold: (i) to identify the best features for the DTCWT and (ii) to show that the features extracted using DTCWT are more powerful in discriminating the fabric defects from the sound fabric than those extracted using UDWT.
The remaining part of this paper is organised as follows.Section 2 describes the wavelet transform methods with emphasis on the dual-tree complex wavelet transform.Section 3 briefly describes the Euclidean distance classifier while Section 4 describes the dataset and the experiments.Section 5 presents the results as well as their interpretation and, finally, Section 6 concludes the paper.

The Wavelet Transform Methods
This section briefly introduces the discrete wavelet transform, the undecimated discrete wavelet transform, and the dualtree complex wavelet transform.

The Discrete Wavelet
Transform.The one-dimensional discrete wavelet transform allows one to decompose a digital signal into a low-frequency component called "approximation" and a high-frequency component called "details."The low-frequency component can further be decomposed into approximation and details, and so forth.This process is illustrated by Figure 1 for a three-level decomposition.(ℎ, ) form a system of specially designed filters called "quadrature mirror filters." For two-dimensional signals (images) the decomposition algorithm is applied in two phases.In phase 1, the filtering (high-pass and low-pass) followed by downsampling is done along the columns while in phase 2 the filtering (high-pass and low-pass) followed by downsampling is applied to the results of phase 1 along the rows [20].

The Undecimated Discrete Wavelet
Transform.The DWT as described in the previous subsection is common but is inappropriate in some applications because it is shift variant.In such cases, the UDWT can be used.One-level UDWT is similar to one-level DWT with the exception that the results of filtering the original signal are not downsampled.Therefore, one ends up with the wavelet approximation coefficients with as many samples as the original signal and the wavelet detail coefficients with as many coefficients as the original leading to the overall results with twice as much data as the original signal.For multilevel decomposition, the filters coefficients are upsampled from one level to the next one.Figure 2 illustrates a two-level UDWT decomposition [20].

The Dual-Tree Complex Wavelet
Transform.Figure 3 shows the implementation of 1D dual-tree complex wavelet transform using Finite Impulse Response (FIR) realcoefficient filters.ℎ 0 (1) , ℎ 0 ,  0 (1) , and  0 are low-pass filters while ℎ 1 (1) , ℎ 1 ,  1 (1) , and  1 are high-pass filters.Those filters are designed so that the corresponding wavelets  ℎ () and   () form approximately a Hilbert pair.Similarly the resulting scaling functions  ℎ () and   () should be such that   () is approximately the Hilbert transform of  ℎ ().Therefore the complex wavelet () and complex scaling function () described by the following equation would be approximately analytic: Consequently referring to Figure 3, the output coefficients of the top tree (tree ℎ) and those of the bottom tree (tree ) can be considered, respectively, as real and imaginary parts of the complex wavelet coefficients.
The conditions specified in the previous paragraph can be met if the filters satisfy the following requirements [12]: (i) They meet the perfect reconstruction conditions.
(ii) One of the two low-pass filters ℎ 0 and  0 should be approximately a half-sample shift of the other.
One way to meet those requirements is to design orthogonal Q-shift filters by minimizing energy in the frequency domain as proposed by Kingsbury [21].The extension to 2 dimensions Figure 2: Two-level UDWT decomposition.ℎ up and  up are upsampled versions of ℎ and , respectively.cA1, cA2, cD1, and cD2 are wavelet coefficients as described in Figure 1.
Figure 3: Implementation of 1D dual-tree complex wavelet transform using FIR real-coefficient filters.
is achieved by 2D complex separable wavelets described by (2) and a 2D complex separable scaling function described by (3).They are implemented by separable filters along columns and then rows: where (⋅) and (⋅) are as shown in (1).Therefore, the 2D DTCWT is implemented separably by 2 trees used for the rows of the image and 2 trees for the columns.The resulting wavelet coefficients are then combined by simple sum and difference operations to give real and imaginary wavelet coefficients.This gives 6 wavelets approximately shift invariant and oriented at ±15 ∘ , ±45 ∘ , and ±75 ∘ .The reader can find the details in [12].

Euclidean Distance Classifier
For a Euclidean distance classifier, each pattern class   is characterised by a vector m  which is the mean vector of the features of the patterns of that class that are part of the training set as described by the following equation: where   is the number of training pattern vectors for class   and the summation is taken over these vectors.
Determining the class membership of an unknown pattern with feature vector x consists in computing the distance measures given by ( 5) and assigning x to the class   for which   is the smallest distance: where  is the number of classes.
The above procedure of training the Euclidean distance classifier, whereby for each pattern class a characteristic feature vector is the mean vector of the corresponding feature vectors in the training set, is called "maximum likelihood training" (ML) training [9].
The "Minimum Classification Error" (MCE) training of the classifier provides a better way of obtaining the classifier characteristic feature vectors of different pattern classes [9].The MCE training algorithm starts with the characteristic feature vectors obtained by the ML method and then adjusts them adaptively in order to achieve the highest classification rate of the feature vectors in the training set.The mentioned process is illustrated by Figure 4 for the experiments of this paper.
The fabric images of the training set are submitted to a feature extraction operation using a wavelet transform method.The features are extracted for each 32 × 32 window of the fabric image.The features of each window are compared to the reference feature vector (Λ) of the defective and defectfree classes and the window is classified as defective or defectfree.The detection results are then compared to the true training sample labels and the value of the detection loss function is evaluated.Using that loss value, the reference vectors (Λ) are adjusted in order to decrease the value of the loss function.New detection results are computed using the adjusted reference vectors and the new loss value of detection is evaluated.That process continues until the loss value of detection is minimized or is below a predefined threshold.For each of the 4 fabric classes, the dataset contains two representatives named R1, R2, or R3. Figure 5 shows samples of the four fabric classes contained in the dataset.

Experiments
Fabric images with four types of defects were considered: holes and cuts, oil stains and colour fading, thread errors, and finally foreign body on the fabric.Figure 6 shows examples of those defect types for the fabric of class 2.
Table 1 shows the detailed numbers of images from the TILDA dataset considered in this paper.In total 1600 images of different fabric classes and containing different types of defects were used.Each image had a size of 512 × 768 pixels.
Each fabric image was divided into nonoverlapping windows of size 32 × 32 pixels.That gave a total number of 614,400 windows from all the 1,600 images.Among those 614,400 windows, 37,546 were defective while the rest were defectfree.
All the 37,546 defective windows as well as 37,546 defectfree windows chosen randomly were selected to make up the experimental dataset.The selection of the defect-free samples was done in such a way to get from each image an equal number of defective and defect-free samples.The experimental dataset was then divided into two parts of the same size: the training set and the testing set, each containing the same number of defective and defect-free samples.(i) A 5-level wavelet decomposition of each fabric image in the dataset was performed using the dual-tree complex wavelet transform.The filters used to implement the wavelet transform were Q-shift FIR filters of length 14, designed according to the method proposed by Kingsbury [21].The results of wavelet decomposition were six complex directional subbands for each (ii) For each sample of the training set, the corresponding complex wavelet coefficients for each level of wavelet decomposition and each of the directional subbands were extracted.The complex wavelet coefficient from the subband with decomposition level  and orientation  is denoted by  , .
(iii) From the complex wavelet coefficients extracted from each subband as mentioned in step 2, the following features were calculated: (a) Mean energy of real parts of wavelet coefficients is (b) Mean energy of imaginary parts of wavelet coefficients is (c) Mean energy of wavelet coefficients taking into account both real and imaginary parts is  For ( 6) through ( 10)  ,, denotes the th complex wavelet coefficient from the subband with decomposition level  and orientation  corresponding to the current sample, while  ,, and  ,, denote its real and imaginary parts, respectively. denotes the total number of complex wavelet coefficients for the current sample for decomposition level  and orientation .
(iv) The features calculated for each subband were then grouped into the following feature sets.(v) For each feature set, all the feature values were normalized to fall into the range [0, 1] for the samples of the training set using where   is the normalized feature value,  min is the minimum feature value of all the feature vectors of the training set, and  max is the maximum feature value of all the feature vectors of the training set.
(vi) For each feature set, the normalized features were used to train a Euclidean distance classifier using the Minimum Classification Error (MCE) algorithm [9].
For each of the four feature sets (Set 1, Set 2, Set 3, and Set 4) a testing experiment was performed using all the samples of the testing dataset.That was done in order to identify the most powerful feature set among the four.Each testing experiment was performed as follows.
(i) The features for the current feature set for all the samples of the testing dataset were calculated as described in steps 1 through 4 of the classifier training process.
(ii) The obtained feature values were normalized using the same scaling parameters ( min and  max ) as those used for normalizing the corresponding features of the training set.
(iii) Those normalized features were fed into the trained classifier to classify the testing samples as defective or defect-free and then the correct classification rate was recorded.
To compare the performance of DTCWT-based features with UDWT-based features, similar experiments were performed on the same dataset but using UDWT-(undecimated wavelet transform-) based features instead of DTCWT-based features.The filters used to implement the UDWT were also of length 14 and were designed using a cascade-form factorization procedure of the low-pass and high-pass filters [(), ()] as described by Yang [9].The choice of the UDWT was motivated by the fact that it is also shift invariant, what makes it suitable for applications of fabric defect detection.
As the wavelet coefficients obtained using the UDWT wavelet decomposition are real, they can only lead to feature sets Set 3 and Set 4 (as defined in step 4 of the training process above).Set 2 is not applicable as it involves imaginary parts of wavelet coefficients while Set 1 is the same as Set 3 in that context.to make it possible to assess the relative discriminating power of those different feature sets.Feature set Set 1 is made up of mean energy of real part of wavelet coefficients for all the 6 directional subbands and for all the 5 levels of decomposition.To get Set 2, the mean energy of imaginary parts of wavelet coefficients for all the 6 directional subbands and for all the 5 levels of decomposition was added to Set 1.It can be seen from Figure 7 that that addition improved significantly the detection rate.The features of Set 3 are the mean energies of complex wavelet coefficients.For each directional subband and each level of decomposition, those features of Set 3 can be obtained by summing together the two corresponding features of Set 2. The defect detection rate drops with respect to Set 2 (the mean energies of real and imaginary wavelet coefficients taken separately) but generally remains higher than that obtained using mean energy of real part of wavelet coefficients alone (Set 1).The use of the mean and variance of magnitudes of complex wavelet coefficients (Set 4) leads to a slightly lower detection rate than the mean energies of real and imaginary parts of wavelet coefficients taken separately (Set 2) for most of the considered fabric categories and defect types.The detection performance of Set 4 is higher than that of Set 2 only for the fabric category C4, representative R1, and for the defect type E3 of the TILDA dataset.

Results and Interpretation
In the experiments, the use of the entropies of real parts, imaginary parts, and magnitudes of DTCWT coefficients as features was also tried, but they did not show significant variation for most of the experimental samples.Therefore it was decided not to consider them any further as it was clear that they would not add any improvement to the detection performance.
Therefore the use of the mean energies of the real and imaginary parts of complex wavelet coefficients obtained using the dual-tree complex wavelet decomposition as features for fabric defect detection is recommended.If, for any reason, those features cannot be used, then the mean and variance of magnitudes of the complex wavelet coefficients would be used.
Figure 8 compares the fabric defect detection performance of DTCWT-and UDWT-based features.The comparison is made for two different feature sets: Set 3 (mean energy of wavelet coefficients) and Set 4 (mean and variance of magnitudes of wavelet coefficients).To increase the validity of the deduction from the comparison, samples from each of the four fabric classes and the two representatives of each fabric category were considered.Additionally, defective samples were taken from different types of defects.
It can be seen clearly that for any fabric category and any defect type, the DTCWT-based features outperformed the UDWT-based features for each of the two considered feature sets.The difference of fabric defect detection rate varies from 4.5% to 15.8%.One possible explanation of that difference of performance is the analyticity of the complex wavelet implemented by DTCWT which allows discriminating texture in 6 different directions.UDWT on the other hand implements a real wavelet and thus can discriminate texture in only three directions (horizontal, vertical, and diagonal).Furthermore, for the diagonal orientation, UDWT cannot distinguish the texture features oriented at +45 ∘ from those oriented at −45 ∘ .

Conclusions
In this paper, the fabric defect detection performance of features extracted using the dual-tree complex wavelet transform (DTCWT) was investigated.One of the advantages of that method is its approximate shift invariance, property that is important in pattern recognition applications such as fabric defect detection.It was shown that the mean energies of real and imaginary parts of complex wavelet coefficients taken separately are effective features for the purpose of fabric defect detection, outperforming the mean and variance of magnitudes of the coefficients as well as the mean energies of real parts alone or the mean total energies of the coefficients.The undecimated discrete wavelet transform (UDWT) also has the shift invariance property.However, it was shown that the defect detection performance of features obtained by DTCWT is much higher than that obtained using UDWT.

4. 1 .
Experimental Samples.The experiments were performed using the fabric images from the TILDA dataset[22].That dataset contains images of four different classes of fabrics: Class 1: very fine fabrics with or without visible internal structure; Class 2: fabrics with a low variance stochastic structure.The surface of this case contains no imprints; Class 3: fabrics with a clearly visible periodic structure; Class 4: printed materials with no apparent periodicity.

4. 2 .
Experimental Procedures.The fabric defect detection experiments were divided into 2 phases: (i) training the classifier using the training set and (ii) classifying the samples of the testing set as defective or not using the trained classifier.The steps of training the classifier were as follows.

Figure 6 :
Figure 6: Examples of the 4 types of defects considered in this paper.

Figure 7
Figure 7 compares the fabric defect detection rates obtained for four different DTCWT-based feature sets.That was done

Figure 7 :
Figure 7: Comparison of detection rate of the 4 sets of the DTCWTbased features for different fabric categories and different defect types.

Figure 8 :
Figure 8: Comparison of detection rate of DTCWT-and UDWTbased features for different fabric categories and defect types.

Table 1 :
The TILDA images used in this paper.