Mathematical Problems in Engineering
Volume 2018 (2018), Article ID 3709821, 17 pages
https://doi.org/10.1155/2018/3709821

Research Article

Fabric Defect Detection Based on Pattern Template Correction

Xingzhi Chang,1,2 Chengxi Gu,³ Jiuzhen Liang,³ and Xin Xu³

¹Open Lab of Industrial Cloud for Intelligent Manufacturing, Changzhou College of Information Technology, Changzhou, China
²Changzhou Key Laboratory of Large Plastic Parts Intelligence Manufacturing, Changzhou, China
³School of Information Science and Engineering, Changzhou University, Changzhou, China

Correspondence should be addressed to Jiuzhen Liang; jzliang@cczu.edu.cn

Received 11 December 2017; Accepted 11 February 2018; Published 22 March 2018

Academic Editor: Ivan Giorgio

Copyright © 2018 Xingzhi Chang et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Abstract.

This paper proposes a novel template-based correction (TC) method for the defect detection on images with periodic structures. In this method, a fabric image is segmented into lattices according to variation regularity, and correction is applied to reduce the effect of misalignment among lattices. Also, defect-free lattices are chosen for establishing an average template as a uniform reference. Furthermore, the defect detection procedure is composed of two steps, namely, defective lattices locating and defect shape outlining. Defective lattices locating is based on classification for defect-free and defective patterns, which involves an improved E-V method with template-based correction and centralized processing, while defect shape outlining provides pixel-level results by threshold segmentation. In this paper we also present some experiments on fabric defect detection. Experimental results show that the proposed method is effective.

1. Introduction

Fabric defect detection has drawn a lot of attention in recent years. Although many automated fabric defect detection methods have been proposed in [1, 2], these methods face the following questions: defect position locating, defect shape outlining, detection time consumption, and detected results evaluation.

In general, fabrics can be divided into two categories: unpatterned and patterned. Unpatterned fabrics are usually solid-colored with simple structures. There are many defect detection methods for this type of fabrics, including morphological filter [3], Fourier transforms [4–6], Gabor [7, 8], wavelet [9–12], Markov random field [13, 14], sparse dictionary reconstruction [15–17], neural network [18–20], and support vector machine [21, 22]. Patterned fabrics are in periodic variations with complicated pattern features. To deal with this kind of fabrics, many methods such as WGIS [23], BB [24], RB [25], ID [26], and ER [27] are proposed. For unpatterned fabrics, the key problem is to reduce the influence of texture features. This paper focuses on patterned fabric defect detection.

The patterned fabric detection methods can be further classified into three categories: partition-matching approach, statistical approach, and modal-based approach.

(1) Partition-matching approach includes the WGIS [23] and ER [27] methods. After Haar wavelet decomposition, the WGIS method uses a defect-free partition to perform moving subtraction operation on images to obtain decision boundaries. The ER method obtains the decision boundaries by random competitions. However, the detection results of these two methods are not stable because of the randomness of defect-free partition selection during the training phase.

(2) Statistical approach includes the BB [24] and RB [25] methods. By different combinations of moving average and standard deviation, the BB and RB methods obtain the decision boundaries. Although these methods carried out by threshold segmentation are effective, their excessive model parameters lead to overreliance on human experience.

(3) Modal-based approach includes the ID [26] method. The ID method decomposes an image into cartoon part and texture part. Then, the detection is realized by converting the decomposed cartoon image into a binary image. But this method is unpractical for requiring a defect-free image which is most similar to the defective image to obtain the optimized parameters for image decomposition.

We can see from the previously proposed methods that the features they obtained from defect-free partitions are only used to determine boundaries or optimize the parameters in image decomposition. After that, these methods directly detect image defects at pixel level, resulting in the false inspection of some pixels.

Based on the previous problems, we propose a novel two-step template-based correction method. Our contributions can be summarized as follows:

(1) We propose an adaptive lattice segmentation method, which can automatically segment the images with periodic structures into lattices. Segmented lattices contain roughly same pattern features, providing favorable conditions for feature extraction, analysis, and comparison.

(2) To make the detection results stable, we establish an average template as a uniform reference. Template-based correction which improves detection robustness and accuracy is used in process of template establishing and detection to reduce the effect of misalignment among lattices. Besides, it can also enhance the difference among normal and defective blocks to make feature extraction and defect detection more effective.

(3) In order to make the defect detection both efficient and accurate, we divide the detection process into two steps: defective lattices locating and defect shape outlining. The former provides lattice-level rough defect regions and the latter provides pixel-level outlining defect regions.

The experiments are conducted on fabric databases with ground-truth images, and our TC method achieves 0.7868 TPR and 0.2158 PPV for box-patterned fabrics using 26 defective images, 0.8914 TPR and 0.2089 PPV for star-patterned fabrics using 25 defective images, and 0.9811 TPR and 0.2209 PPV for dot-patterned fabrics using 30 defective images in defective lattices locating. Besides, the TC method achieves 0.5863 TPR and 0.5237 PPV for box-patterned fabrics, 0.4587 TPR and 0.5201 PPV for star-patterned fabrics, and 0.5901 TPR and 0.6459 PPV for dot-patterned fabrics in defect shape outlining. These results are comparable with the developed methods.

The rest of the paper is organized as follows. In Section 2, we introduce the original E-V method. The proposed TC method is introduced in Section 3. The performance of TC method and the comparison of WGIS, BB, RB, and ER methods are presented in Section 4. At last, Section 5 concludes the paper.

2. The Original E-V Method

The original E-V method [28, 29] is proposed for defective lattices classification and it evaluates the E and V values with a process of circular shift and moving subtraction method (similar to the GIS method [23]). For convenience, the key equations are outlined below.

Considering two lattices, a testing sample and a defect-free template size of pixels, the process of circular shift H of B produces new templates such that is defined as

is regarded as a process of replicating the matrix itself by shifting rows or columns. Then the 1-norm metric between and is defined as

Thus, the and values are defined as

The upper and lower decision boundaries of E-V value are trained to figure out defective lattices from testing lattices. The details of mathematical definitions and proofs are stated in [28].

Although overall detection success rate of the original E-V method has reached 93.28% [28, 29] in wallpaper groups, it is not suitable for the misalignment and distortion situation. When illumination of input images is not uniform, the detection accuracy declines seriously. Apart from this, it is also difficult for the original E-V method to detect small defects.

3. The TC Method

By applying circular shift, the proposed TC method can reduce the effect of misalignment and can also reinforce the sensitivity of defect detection. Through the introduction of a uniform template, the TC method changes the calculation method of E and V values to optimize the selection of decision boundaries and ensure the accuracy of defective lattice locating. Pixel-level detection result is achieved by threshold segmentation on the located defective lattices. In short, the TC method includes preprocessing phase, template establishing phase, training phase, and testing phase.

3.1. Preprocessing Phase

Preprocessing of the TC method includes grayscale conversion, mean filtering with window size of , and lattice segmentation. The grayscale conversion can simplify the detection and the mean filtering helps in smoothing the fabric image to make the subsequent threshold determination more reliable. After mean filtering, the image size is converted from to . Lattice segmentation can segment images into lattices to obtain lattice-level features.

The lattice segmentation of TC method can be briefly described as follows: For each patterned fabric image I with periodic structures, we define a loss function to obtain the ideal pattern size

where and are denoted as the size of segmented blocks; and are considered as the ideal pattern size. Image size of is segmented into blocks in the same size. Furthermore, is defined as follows:

where represents the variance among the segmented blocks.

Consider , , and is the pixel value in the th row and th column of the image . Then, is defined as the mean matrix of all blocks:

Then, is defined as

where , .

However, since the patterned fabric images are in periodic variations, there are many combinations of and that minimize (4). In order to find the proper pattern size, we suppose that the minimum values obtained in the vertical direction are and the minimum values obtained in the horizontal direction are and are defined as (8). Segmentation on images are shown in Figure 1.

(a)

(b)

(c)

Figure 1: Lattice segmentation. (a) Box-patterned fabric. (b) Star-patterned fabric. (c) Dot-patterned fabric.

In Figure 1, the size of the box pattern is , the size of the star pattern is , and the size of the dot pattern is . Partial image regions cannot be segmented because they are not satisfied with the size of a single cycle (at the right side and the bottom) and these parts will not be detected during the testing stage. Thus, the size of resultant box-patterned images is , the size of resultant star-patterned images is , and the size of resultant dot-patterned images is . In patterned fabric images, distortion is an unavoidable problem and it will result in slight misalignment between two lattices. Therefore, it is very necessary to correct the obtained segmented lattices.

3.2. Template Establishing Phase

In order to highlight the pattern features, we use defect-free lattices to establish an average template. To reduce the effect of misalignment mentioned in Section 3.1, we introduce a correction method based on circular shift.

(1) Definitions of Correction. The definitions of correction are concluded as follows. Suppose is a lattice to be corrected and is a defect-free lattice. To minimize the difference between and , the process of circular shift of the TC method is defined as the following model.

where is the number of rows shifted in the vertical direction and is the number of columns shifted in the horizontal direction, , and . and are two matrices sizes of and , which are denoted as follows:

The specific process of correction is shown in Figure 2.

Figure 2: The process of correction.

After calculating and by (9), the lattice is divided into two parts in the horizontal direction size and size . Then, we move the former part to the right of the latter part to finish the horizontal shift. Similar to the process in the horizontal direction, the shift is also applied in the vertical direction. After that, we obtained corrected lattice.

(2) Template Establishing. After lattice segmentation and correction, we have finished the preparation of the uniform template establishing. Lattices selected from k different defect-free images (in our experiment, lattices are selected in the top left, bottom left, top right, and bottom right corner of each image), noted as ,  ,  , are used for establishing the template.

where represents the template and , . which is corrected according to represents the corrected and . To reduce the impact of imbalanced illumination, the lattices we selected are from corners of defect-free images. When the parameter increases, the features extracted from the template will be more reliable and detection results will be more accurate.

3.3. Training Phase

The training phase of the TC method involves an improved E-V method. By quantifying the subtractions among defect-free lattices and the template, we can determine the decision boundaries by analyzing the numerical distribution of these values. The details of the improved E-V method are as follows. Suppose is a lattice that has been corrected by using the template . In order to reduce the influence of illumination variations, and have been centralized in advance. , , and in (2) and (3) are modified as

where and are mean values of and , respectively.

Suppose is a defect-free lattice, the subtraction matrix between and can be denoted by

where is a matrix of difference in grayness caused by the varying illuminations of input images or lattices. Therefore, in (12) can be modified as

Under the premise that the illumination is approximately the same in the neighborhood, . Similarly, .

Suppose is a lattice with defect, the subtraction matrix between and can be denoted by

where is a matrix of defects. Then, can be denoted as

Because of the varying types of fabric defects, the matrix is unpredictable. In this case, the values of and are greater than 0. We can see from the definition of the improved E-V method that lattices which are more similar to the template have smaller and values (the minimum value is 0).

We use defect-free images for training and there is no overlapping with the k images used for template establishing (for dot-patterned and box-patterned fabric, ; for star-patterned fabric, ). After segmentation and correction, we compute the values of and between the corrected lattice and the template. The corrected lattices are denoted as , where . for box-patterned fabric, for star-patterned fabric, and for dot-patterned fabric. The maximum and values are denoted as and , and the boundaries and are defined as

3.4. Testing Phase

The testing phase of the TC method includes two steps: defective lattices locating and defect shape outlining.

(1) Defective Lattice Locating. With the and values between the testing lattices and the template, we can locate the defective lattices by taking advantage of the decision boundaries acquired during the training phase. The and values of each testing lattice are calculated by the improved E-V method, which are denoted as and , where .

If and , is considered defect-free. Otherwise, is considered defective.

(2) Defect Shape Outlining. In order to figure out pixel-level results after locating defective lattices in the images, we propose a segmentation method based on threshold. For each detected defective lattice , we can get a binary resultant lattice through following equation:

where is the template in (11). represents the standard deviation of . is a constant. Thresholds are determined without centralized processing for the reason that mean value and standard deviation are good measures for indicating abnormity of a set of data; therefore the thresholds composed of mean value and standard deviation have a good tolerance for normal variations. Besides, the defect-free pixels in the lattice are greatly influenced by the defective pixels after the centralized processing if defects are large. Defect-free pixels will be false detected under this situation. Normally, is equal to 2 or 3 according to the three-sigma rule [30]. If is equal to 2, more pixels will be mistaken for defective and TPR values will increase while PPV values will decrease. If is equal to 3, some defective pixels will be mistaken for defect-free and TPR values will decrease while PPV values will increase.

Since is corrected, several rows and columns will be shifted. In order to make the testing results consistent with the original defects, we do the following operation on :

where and are matrices defined in (10); and are the sizes of . For each detected defective lattice , and are calculated in (9).

4. Performance Evaluation

In our experiment, we use a total of 156 fabric images provided by Industrial Automation Research Laboratory from Dept. of Electrical and Electronic Engineering of Hong Kong University. In detail, 71 defective images of size in 24-bit depth from the box-, star-, and dot-patterned fabric databases are used for evaluation and 85 defect-free images are used in training phase. The box-patterned fabric database contains 30 defect-free and 26 defective images, the star-patterned database contains 25 defect-free and 25 defective images, and the dot-patterned fabric database contains 30 defect-free and 30 defective images. All defective images have corresponding binary ground-truth images that illustrate the defective regions as white (value 1) and the defect-free regions as black (value 0). There are 5 defect types for box and star pattern, that is, Broken End, Hole, Netting Multiple, Thick Bar, and Thin Bar. There is one more defect type called Knots for dot pattern. Moreover, WGIS (2005), BB (2006), RB (2009), and ER (2016) are implemented for comparison purpose. All the experiments are conducted on a desktop computer with an Intel Pentium J2900 2.41-GHz processor and 4.00 GB memory. The algorithm is implemented in Matlab 7.14.

The rest of this section is organized as follows. Section 4.1 introduces the description of evaluation metrics. Section 4.2 introduces the tuning of the parameters of the TC method. Section 4.3 introduces the results of the original and the improved E-V method. Section 4.4 introduces overall results of the TC method.

4.1. Description of Evaluation Metrics

A number of metrics are obtained for evaluation, true positive (TP), false positive (FP), true negative (TN), false negative (FN), accuracy (ACC), true positive rate (TPR), false positive rate (FPR), positive predictive value (PPV), and negative predictive value (NPV). Related definitions of these metrics can be found in [23], where ACC = (TP + TN)/(TP + FP + TN + FN), and usually the value of TN is larger than TP by more than one order of magnitude. Compared with TN, the value of TP is negligible. Thus, ACC is not a good evaluation metric if defective region is small. To evaluate the detection more correctly, we use the value ( measure) in this paper.

where is the weight and is set to 1 in [31, 32]. Thus (23) can be modified as

The above equation shows that when the FN and FP increase, in other words, the detection results and manual-labeled results are not consistent, the value decreases. Smaller values of FN and FP indicate better detection results and the value is closer to 1. This evaluation index only considers TPR and PPV, which avoids the detection problem of the small defective regions mentioned above. Thus, ACC is replaced by value in this paper.

4.2. Tuning the Parameters of the TC Method

The TC method involves 2 parameters to be predefined, the number of images for establishing the template (mentioned in Section 3.2), and the number for threshold segmentations (mentioned in Section 3.4).

Experiments on the star-, box-, and dot-patterned fabrics are performed with of 4, 6, 8, 10, and 15 and of 2 and 3. Figure 3 illustrates the average values plots of box-patterned (Figure 3(a)), star-patterned (Figure 3(b)), dot-patterned fabrics (Figure 3(c)) with different parameters and .

(a)

(b)

(c)

Figure 3: value versus constant and for (a) box-patterned, (b) star-patterned, and (c) dot-patterned fabrics.

From Figure 3(a) for box-patterned fabrics and Figure 3(b) for star-patterned fabrics, the value plots are in a rising tendency when the parameter increases. As is mentioned previously, if the number of defect-free patterns for template establishing increases, the effect of random errors among defect-free patterns can be reduced, which makes the method more accurate. For star- and box-patterned fabrics, although value increases when parameter increases, the change rate of plots decreases.

Figure 3(a) shows that, for box-patterned fabrics, and provide the highest value. The maximal deviation is about 0.04 with different . For the box-patterned fabrics, except for Thin Bar and Thick Bar, pixel values of other defects are close to backgrounds, which makes it hard for a smaller to distinguish defect-free and defective pixels. That is why a larger provides higher values. Figure 3(b) shows that, for star-patterned fabrics, values of and are close, which means and provide similar detection results. When changes from 4 to 6, value decreases by 0.01, which is due to the slight differences among the patterns used for template establishing.

The regularity in Figure 3(c) is poor for dot-patterned fabrics because the dot-patterned defective images are mostly man-made. The maximal deviation in Figure 3(c) is about 0.01. The TC method achieves similar results with different parameters and .

Thus, in our experiments, is equal to 15 and is equal to 3.

Figure 4 shows detection results of several images when parameter k changes between 4, 6, 8, and 15 with . It is clear that when increases, some small white dots are removed. The detection results are more accurate as analyzed above.

Figure 4: Differences of several images when parameter k changes.

4.3. Results of the Original and the Improved E-V Method

Detection success rate (DSR) is defined as the percentage of fraction of the amount of correct detection of lattices over the total number of lattices [28], and the numerical results are presented in Table 1. The parameter is equal to 15 and is equal to 3. From Table 1, the improved E-V method (mentioned in training phrase) shows higher DSR than the original one in the overall results (0.9540 versus 0.8883 for box-patterned fabric, 0.9573 versus 0.8559 for star-patterned fabric, and 0.9251 versus 0.9153 for dot-patterned fabric).

Table 1: DSR of the original and improved E-V methods.

Box-patterned
Star-patterned
Dot-patterned
Method

Broken End
0.8333
0.9456
0.8921
Original

0.9356
0.9811
0.9492
Improved

Hole
0.8911
0.7782
0.9238
Original

0.9578
0.9578
0.9524
Improved

Netting Multiple
0.86
0.9589
0.8825
Original

0.9178
0.9811
0.9048
Improved

Thin Bar
0.92
0.8367
0.9175
Original

0.96
0.9511
0.9778
Improved

Thick Bar
0.937
0.7604
0.9714
Original

0.9537
0.9152
0.9873
Improved

Knots
Not this type
Not this type
0.9048
Original

0.9429
Improved

Overall

0.8883
0.8559
0.9153
Original

0.945
0.9573
0.9254
Improved

For original E-V method on box-patterned fabrics, DSR values achieve about 0.85 in Broken End, Hole, and Netting Multiple while DSR values achieve about 0.92 in Thin Bar and Thick Bar. Pixel values of Broken End, Hole, and Netting Multiple are close to backgrounds. However, defects of Thin Bar and Thick Bar are dark-colored, which are easy to be detected. The average DSR of the improved E-V method for box-patterned fabrics is about 0.94, which means this method can not only detect the obvious defects like Thin Bar and Thick Bar but also detect the defects similar to the backgrounds.

For star-patterned fabrics, this fabric is composed of white and black stars with simple structures. The original E-V method only achieves about 0.8 DSR in Hole, Thin Bar, and Thick Bar. The reason for this phenomenon is similar to the detection on box-patterned fabrics. It is hard for the original E-V method to detect defects which are similar to backgrounds.

For dot-patterned fabrics, defects are man-made with large areas. The original and the improved E-V methods achieve similar results. These two methods can detect large defects.

Figure 5 shows some results detected by the original E-V method and the improved E-V method. The 1st row displays the defective images. The 2nd row displays the corresponding ground-truth images. The 3rd row displays the defective lattices locating of the original E-V method. The 4th row displays the defective lattices locating of the improved E-V method. The 1st and 2nd columns are box-patterned fabrics. The 3rd and 4th columns are star-patterned fabrics. The 5th and 6th columns are dot-patterned fabrics.

Figure 5: Comparison of the original and the improved E-V method.

For box- and star-patterned fabrics, although some defective lattices can be located in the image, there are some missing and false cases for the original E-V method (3rd column). The main reason for missing detection is that defects are similar to the backgrounds. Moving subtraction will lead to insufficient sensitivity in detection. The reason for false detection lies in the misalignment and grayness differences. The improved E-V method can effectively improve the sensitivity of detection and ensure the DSR of defect detection (4th column).

For 5th and 6th rows of dot-patterned fabrics, the two methods can be correctly locating the defective lattices. However, there are false detection situations in 5th row. The proposed TC method contains a subsequent step of pixel-level detection, which can also improve the detection accuracy.

In summary, the improved E-V method proposed in this paper can not only detect large defects but also detect small defects.

4.4. Overall Results of the TC Method

In this section, results of the TC and other methods (WGIS, BB, RB, and ER) are presented in two ways, numerical and graphical results and TPR-PPV graphs. The former part shows numerical results of TPR, PPV, FPR, NPV, and value with some graphical detection results. The latter part shows TPR and PPV in the form of scatter plots. Besides, each scatter also can represent the value. In this way, the results are presented more intuitively.

(1) Numerical and Graphical Results. Detection of the TC method is divided into two parts: the defective lattices locating and defect shape outlining, short for TC locating and TC outlining, respectively. It must be noted that, because of the preprocessing phrase, the resultant images are smaller than the original images and the resultant images need to be zero padded into size of .

Figure 6 depicts the detection results (without zero padding) of TC locating (3rd row) and TC outlining (4th row) with randomly chosen defective images (1st row) and corresponding ground-truth images (2nd row), where the 1st and 2nd columns are the box-patterned defective fabric images; the 3rd and the 4th columns are the star-patterned defective fabric images; the 5th and 6th columns are the dot-patterned defective fabric images. For the star- and box-patterned fabric, the results obtained from TC outlining are close to the manual-labeled results. However, TC outlining on dot-patterned fabric is worse because some small white dots are false detected. Above all, TC outlining performs better than TC locating with more finely defected defect shapes.

Figure 6: Several detection results of TC locating and TC outlining.

Tables 2, 3, and 4, respectively, tabulate the numerical results of each defect type in box-, star-, and dot-patterned fabric images. The results of BB, RB, WGIS, and ER are presented as comparison with results of each part in TC method. For each table, each row represents the average result for a specific method and all rows are categorized based on the defective types.

Table 2: Numerical results of different methods on box-patterned fabric.

Box pattern
TPR
PPV
FPR
NPV
value
Method

Broken End
0.9024
0.2883
0.0487
0.9977
0.437
TC locating

0.6671
0.6188
0.0082
0.993
0.642
TC outlining

0.0356
0.0652
0.0098
0.995
0.0461
BB

0.0429
0.0911
0.0084
0.9982
0.0583
RB

0.3639
0.0294
0.2443
0.984
0.0544
WGIS

0.1026
0.3043
0.0069
0.9588
0.1535
ER

Hole
0.695
0.2167
0.0198
0.9977
0.3303
TC locating

0.3856
0.5215
0.0026
0.9953
0.4434
TC outlining

0.0404
0.0342
0.0086
0.9963
0.037
BB

0.0566
0.0529
0.0075
0.9956
0.0547
RB

0.3117
0.0092
0.2553
0.9931
0.0179
WGIS

0
0
0.0003
0.9769
0
ER

Netting Multiple
0.6826
0.1508
0.0607
0.9968
0.2471
TC locating

0.4495
0.3911
0.0112
0.994
0.4183
TC outlining

0.0422
0.0467
0.0099
0.9913
0.0443
BB

0.1983
0.1051
0.0195
0.9966
0.1374
RB

0.33
0.0128
0.2568
0.9887
0.0246
WGIS

0.0015
0.04
0.0004
0.9581
0.0029
ER

Thin Bar
0.8378
0.1177
0.0706
0.9985
0.2064
TC locating

0.7083
0.4759
0.0095
0.9974
0.5693
TC outlining

0.3154
0.2983
0.0078
0.9935
0.3066
BB

0.3221
0.3079
0.0066
0.9958
0.3148
RB

0.269
0.0102
0.242
0.9907
0.0197
WGIS

0.0584
0.0236
0.0451
0.9768
0.0336
ER

Thick Bar
0.8161
0.3189
0.0429
0.9976
0.4586
TC locating

0.7211
0.6114
0.0097
0.9952
0.6618
TC outlining

0.6012
0.5304
0.0105
0.9856
0.5636
BB

0.7975
0.4091
0.0225
0.9847
0.5408
RB

0.4908
0.043
0.2424
0.9877
0.0791
WGIS

0.2276
0.424
0.0168
0.9693
0.2962
ER

Overall
0.7868
0.2185
0.0485
0.9977
0.3359
TC locating

0.5863
0.5237
0.0083
0.995
0.5469
TC outlining

0.207
0.195
0.0093
0.9923
0.1995
BB

0.2835
0.1932
0.0129
0.9942
0.2212
RB

0.3531
0.0209
0.2482
0.9888
0.0391
WGIS

0.078
0.1584
0.0139
0.968
0.0972
ER

Table 3: Numerical results of different methods on star-patterned fabric.

Star pattern
TPR
PPV
FPR
NPV
value
Method

Broken End
0.9249
0.1703
0.0294
0.9994
0.2876
TC locating

0.5142
0.4337
0.0042
0.9962
0.4705
TC outlining

0.0283
0.0333
0.0078
0.9899
0.0306
BB

0.0454
0.0752
0.0045
0.9919
0.0566
RB

0.0026
0.0009
0.0356
0.9924
0.0013
WGIS

0.0879
0.0717
0.0116
0.9927
0.079
ER

Hole
0.8970
0.1273
0.0434
0.9995
0.223
TC locating

0.474
0.3932
0.0049
0.9972
0.4298
TC outlining

0.0269
0.0816
0.0016
0.9931
0.0405
BB

0.069
0.2599
0.0012
0.9939
0.109
RB

0.0034
0.0005
0.0366
0.9945
0.0009
WGIS

0.2447
0.1168
0.0123
0.9954
0.1581
ER

Netting Multiple
0.9270
0.3702
0.027
0.9990
0.5291
TC locating

0.4167
0.6683
0.0031
0.9899
0.5133
TC outlining

0.1158
0.3711
0.0042
0.9799
0.1765
BB

0.1523
0.4799
0.0025
0.9834
0.2312
RB

0.0103
0.0088
0.0361
0.9825
0.0095
WGIS

0.1642
0.1261
0.0082
0.9854
0.1426
ER

Thin Bar
0.8277
0.117
0.0738
0.9994
0.2051
TC locating

0.5269
0.4909
0.0063
0.9961
0.5082
TC outlining

0.0676
0.2216
0.0023
0.9882
0.1036
BB

0.0314
0.2769
0.0008
0.9889
0.0564
RB

0
0
0.0365
0.99
0
WGIS

0.4547
0.125
0.0283
0.9945
0.1961
ER

Thick Bar
0.8802
0.2595
0.0813
0.9967
0.4008
TC locating

0.3614
0.6146
0.0071
0.9777
0.4552
TC outlining

0.3067
0.6318
0.0049
0.9688
0.4129
BB

0.1961
0.7711
0.0032
0.9686
0.3127
RB

0.0437
0.0509
0.0344
0.9663
0.047
WGIS

0.6952
0.5452
0.0167
0.9881
0.6111
ER

Overall
0.8914
0.2089
0.051
0.9988
0.3291
TC locating

0.4587
0.5201
0.0051
0.9914
0.4754
TC outlining

0.1091
0.2679
0.0042
0.984
0.1528
BB

0.0988
0.3726
0.0024
0.9853
0.1532
RB

0.012
0.0122
0.0358
0.9851
0.0117
WGIS

0.3293
0.197
0.0154
0.9912
0.2374
ER

Table 4: Numerical results of different methods on dot-patterned fabric.

Dot pattern
TPR
PPV
FPR
NPV
value
Method

Broken End
0.9737
0.3031
0.1779
0.9994
0.4623
TC locating

0.3611
0.5679
0.0115
0.9081
0.4415
TC outlining

0.0546
0.7424
0.0009
0.8857
0.1017
BB

0.1423
0.6028
0.0041
0.8884
0.2302
RB

0.5463
0.2559
0.1171
0.9166
0.3485
WGIS

0.3232
0.562
0.0344
0.9226
0.4104
ER

Hole
0.9792
0.1563
0.1521
0.9993
0.2696
TC locating

0.5288
0.4056
0.022
0.9861
0.4591
TC outlining

0.2619
0.5528
0.0065
0.9779
0.3554
BB

0.1509
0.4126
0.0069
0.97
0.221
RB

0.7633
0.1056
0.189
0.9915
0.1855
WGIS

0.6921
0.3063
0.0458
0.9907
0.4247
ER

Netting Multiple
0.939
0.2679
0.1037
0.9972
0.4169
TC locating

0.2967
0.7054
0.0046
0.9718
0.4177
TC outlining

0.2943
0.9081
0.0015
0.9081
0.4445
BB

0.2115
0.9639
0.0005
0.9562
0.3469
RB

0.6391
0.1415
0.1458
0.9828
0.2317
WGIS

0.4561
0.8133
0.0056
0.9782
0.5844
ER

Thin Bar
0.9974
0.1054
0.2182
0.9999
0.1906
TC locating

0.9308
0.6839
0.0118
0.9981
0.7885
TC outlining

0.5371
0.5867
0.0126
0.9839
0.5608
BB

0.5393
0.7517
0.0063
0.9854
0.628
RB

0.6678
0.1123
0.1449
0.991
0.1923
WGIS

0.8056
0.2701
0.058
0.9946
0.4046
ER

Thick Bar
0.9973
0.337
0.3046
0.9992
0.5037
TC locating

0.9354
0.9347
0.0102
0.9899
0.9351
TC outlining

0.6449
0.7574
0.0352
0.9456
0.6966
BB

0.6646
0.8254
0.0231
0.9497
0.7363
RB

0.7324
0.3323
0.1923
0.9614
0.4572
WGIS

0.8596
0.5011
0.1175
0.9766
0.6331
ER

Knots
1
0.1559
0.221
1
0.2697
TC locating

0.4879
0.578
0.0152
0.9795
0.5291
TC outlining

0.3122
0.6685
0.0055
0.9785
0.4256
BB

0.2256
0.6652
0.0044
0.9675
0.3369
RB

0.3934
0.0574
0.1958
0.9781
0.1002
WGIS

0.5346
0.6853
0.0109
0.9814
0.6006
ER

Overall
0.9811
0.2209
0.1963
0.9992
0.3521
TC locating

0.5901
0.6459
0.0126
0.9723
0.5952
TC outlining

0.3508
0.7027
0.0104
0.9466
0.4308
BB

0.3224
0.7036
0.0076
0.9529
0.4166
RB

0.6237
0.1675
0.1642
0.9702
0.2526
WGIS

0.6119
0.523
0.0454
0.974
0.5096
ER

From Table 2 of the box-patterned fabric, overall results of the TC method reach 0.7868 TPR, 0.2185 PPV, 0.0485 FPR, 0.9977 NPV, and 0.3359 value for TC locating and 0.5863 TPR, 0.5237 PPV, 0.0083 FPR, 0.9950 NPV, and 0.5469 value for TC outlining. According to the TPR of TC locating, most defective lattices are detected. However, about 0.2 PPV means only about one-fifth of detected pixels are real defective ones. For the results of TC outlining, TPR drops to 0.5863 (25 percent of decrease) but PPV rises to 0.5273 (141 percent of increase). That is the reason that value of TC outlining is higher than TC locating. The BB and RB provide about 0.05 TPR and PPV values in Broken End and Hole defect detection while these two methods are good competitive rivals for the proposed TC method in Thick Bar defect detection. Also, the BB and RB methods outperform the WGIS and ER methods in Thick Bar and Thin Bar defect detection. The BB and RB methods seem unable to detect small defects like Broken End and Hole but are good at detecting obvious defects like Thin Bar and Thick Bar. The TPR and PPV values of the WGIS method are around 0.35 and 0.02, which means although the WGIS method provides stable results on these five kinds of defects, it is still not practical because of much false detection. According to the results, it is difficult for the ER method to detect fabrics defects with complex structures. Figure 7 depicts the detection results (without zero padding) of the WGIS, RB, and TC outlining; TC outlining performs better than the WGIS and RB in defect types of Broken End, Thin Bar, and Thick Bar. However, TC outlining is not good at detecting defect types of Hole and Netting Multiple. Especially for Hole, only a few defective pixels are detected (2nd row in Figure 7).

Figure 7: Box-patterned fabric: (1st column) defective sample names; (2nd column) defective images; (3rd column) ground-truth image; (4th column) detection results of WGIS; (5th column) detection results of RB; (6th column) detection results of TC.

From Table 3 of the star-patterned fabric, overall results of the TC method reach 0.8914 TPR, 0.2089 PPV, 0.051 FPR, 0.9988 NPV, and 0.3291 value for TC locating and 0.4587 TPR, 0.5201 PPV, 0.0051 FPR, 0.9914 NPV, and 0.4754 value for TC outlining. TPR value of TC outlining drops sharply (48 percent of decrease), especially for defect types of Broken End (0.9249 versus 0.5142), Netting Multiple (0.9270 versus 0.4167), and Thick Bar (0.8802 versus 0.3614). This means although the TC method on star-patterned fabric can locate defective lattices correctly, it is difficult to outline the defect shapes. According to the numerical results of other methods, the BB, RB, WGIS, and ER methods provide lower TPR and FPR values than the TC method in Broken End, Hole, Netting Multiple, and Thin Bar defect detection. The ER method shows higher TPR and value than TC outlining in Thick Bar defect detection. The average TPR values of BB and RB methods are less than 0.2. The BB and RB method detect defects by different combinations of moving average and standard deviation and the star-patterned fabrics consist of black and white stars. It is hard for these statistical approaches to detect dark-colored defects. The ER method has good performances except for Broken End because this kind of defect is small. In Figure 8, TC outlining provides good results of Hole and Thin Bar. However, it is hard to detect dark defects in black backgrounds, such as Netting Multiple (3rd row). Besides, TC outlining provides many false detected white dots, such as Thick Bar (5th row).

Figure 8: Star-patterned fabric: (1st column) defective sample names; (2nd column) defective images; (3rd column) ground-truth image; (4th column) detection results of WGIS; (5th column) detection results of RB; (6th column) detection results of TC.

From Table 4 of the dot-patterned fabric, overall results of the TC method reach 0.9811 TPR, 0.2209 PPV, 0.1963 FPR, 0.9992 NPV, and 0.3521 value for TC locating and 0.5901 TPR, 0.6459 PPV, 0.0126 FPR, 0.9723 NPV, and 0.5952 value for TC outlining. TPR values of TC outlining drop sharply on Broken End (0.9737 versus 0.3611) and Netting Multiple (0.9390 versus 0.2967) but it provides highest PPV values on Thick Bar (0.9347). Defects of dot-patterned fabrics are usually large, such as Thick Bar and Knots. However, with obvious texture features, it is hard for these methods to maintain TPR and PPV values. The BB and RB methods provide higher PPV values than the TC, WGIS, and ER methods while the TC, WGIS, and ER methods provide higher TPR values than the BB and RB methods. According to values, the TC and ER outperform other methods. In Figure 9, the WGIS method provides a better result than RB and TC outlining on Netting Multiple (3rd row) and Knots (6th row). The WGIS and TC outlining perform better than RB on Broken (1st row) and Hole (2nd row) end. These three methods are all good at detection on Thin Bar (4th row) and Thick Bar (5th row) while the WGIS method provides many false detected pixels.

Figure 9: Dot-patterned fabric: (1st column) defective sample names; (2nd column) defective images; (3rd column) ground-truth image; (4th column) detection results of WGIS; (5th column) detection results of RB; (6th column) detection results of TC.

(2) TPR-PPV Graphs with Optimized Parameters. Figure 10 shows TPR-PPV graphs between the WGIS, BB, RB, ER, and TC (including TC locating and TC outlining). The TPR-PPV graphs are formulated by the average TPR and PPV values of each defective sample of the dot-, star-, and box-patterned fabrics. TPR estimates how many true defective pixels are detected among the manually labeled defective pixels while PPV estimates how many true defective pixels are among the detected pixels. For performance evaluation, PPV values are much better than FPR. Furthermore, TPR and PPV are usually called recall and precision in information retrieval and natural language processing. In TPR-PPV graphs, a point located closer to the top right corner is regarded as an optimized result.

(a)

(b)

(c)

Figure 10: TPR-PPV graphs of detection results on different kinds of fabric. (a) Box-patterned fabric, (b) star-patterned fabric, and (c) dot-patterned fabric.

The magenta stars represent TC locating and the blue crosses represent TC outlining. The red squares, green pentagrams, cyan diamonds, and black hexagrams represent the BB, RB, WGIS, and ER method, respectively. Each mark represents TPR-PPV value of a defect type.

The locating and outlining of the TC method show good results for these three fabrics. The TC locating shows good TPR distributions. The TC outlining maintains the TPR and PPV, which makes the values higher than the TC locating. For the box-patterned fabric, the blue crosses in Figure 10(a) clearly show the TPR-PPV points of the TC outlining are close to the top right corner of the graph, which means the TC outlining performs better than the other methods. Besides, magenta stars (the TC locating) are close to the right bottom corner of the graph with higher TPR values and lower PPV values than the TC outlining. For the star-patterned fabric (Figure 10(b)), the TC outlining does not perform as well as that in the box-patterned fabric. Most blue crosses are around (0.45, 0.55), which means only about a half of defective pixels are detected and only about a half of detected pixels are real defective ones. For the dot-patterned fabric (Figure 10(c)), the TPR-PPV points of the TC outlining are dispersed. Four blue crosses are around (0.45, 0.6) and two blue crosses are around (0.9, 0.8).

5. Conclusion

This paper presents a new method of patterned fabric inspection called the TC method. With an adaptive method of lattice segmentation, fabric images are segmented into lattices automatically. A method of correction is used to reduce the effect of misalignment among lattices. Detection is then carried out in two steps: defective lattices locating and defects shape outlining. The former step is good at locating the defective lattices in the images (over 0.92 DSR and over 0.78 TPR) and the latter step provides finely defected defect shapes. When it comes to unpatterned fabric defect detection, the proposed TC method is not suitable because most unpatterned fabrics do not contain periodic variations. Thus, lattice segmentation and template-based correction are not necessary. The TC outlining achieves the highest values and the TPR and PPV values are over 0.45 and 0.52. For the definition of value, it can be regarded as the weighted harmonic average of TPR and PPV. The TC method performs worse in shape outlining for dot-patterned fabrics than in star- and box-patterned fabrics, which results in the fact that some defect-free pixels are false detected. The reason is that most of the dot-patterned fabric defective images are synthetic with large defects which are similar to backgrounds such as Knots, Netting Multiple, and Broken End. The TC method is too sensitive to deal with these defects. The TC method still has room for improvement in feature extraction such as LBP or Gabor. In the future, additional theoretical development involving feature extraction should be carried out. Such research will be beneficial for defect detection in the textile, tile, ceramics, and wallpaper.

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

Acknowledgments

The database employed in this research is kindly provided by Industrial Automation Research Laboratory from Department of Electrical and Electronic Engineering of Hong Kong University. This work was supported by Changzhou High-Tech Key Laboratory (CM20153001).

References

H. Y. T. Ngan, G. K. H. Pang, and N. H. C. Yung, “Automated fabric defect detection—a review,” Image and Vision Computing, vol. 29, no. 7, pp. 442–458, 2011.

A. Kumar, “Computer-vision-based fabric defect detection: a survey,” IEEE Transactions on Industrial Electronics, vol. 55, no. 1, pp. 348–363, 2008.

K. L. Mak, P. Peng, and K. F. C. Yiu, “Fabric defect detection using morphological filters,” Image and Vision Computing, vol. 27, no. 10, pp. 1585–1592, 2009.

C.-H. Chan and G. K. H. Pang, “Fabric defect detection by Fourier analysis,” IEEE Transactions on Industry Applications, vol. 36, no. 5, pp. 1267–1276, 2002.

G.-H. Hu, Q.-H. Wang, and G.-H. Zhang, “Unsupervised defect detection in textiles based on Fourier analysis and wavelet shrinkage,” Applied Optics, vol. 54, no. 10, pp. 63–80, 2015.

D.-M. Tsai and T.-Y. Huang, “Automated surface inspection for statistical textures,” Image and Vision Computing, vol. 21, no. 4, pp. 307–323, 2003.

D.-M. Tsai, C.-P. Lin, and K.-T. Huang, “Defect detection in coloured texture surfaces using Gabor filters,” Imaging Science Journal, vol. 53, no. 1, pp. 27–37, 2005.

Y. Zhang, Z. Lu, and J. Li, “Fabric defect detection and classification using gabor filters and gaussian mixture model,” in Proceedings of the 9th Asian Conference on Computer Vision - Volume Part II, vol. 5995, pp. 635–644, Springer, Heidelberg, Berlin.

K. Yildiz and A. Buldu, “Wavelet transform and principal component analysis in fabric defect detection and classification,” Pamukkale University Journal of Engineering Sciences, vol. 23, no. 5, pp. 622–627, 2017.

X. Z. Yang, G. K. H. Pang, and N. H. C. Yung, “Discriminative fabric defect detection using adaptive wavelets,” Optical Engineering, vol. 41, no. 12, pp. 3116–3126, 2002.

Z. Wen, J. Cao, X. Liu, and S. Ying, “Fabric defects detection using adaptive wavelets,” International Journal of Clothing Science and Technology, vol. 26, no. 3, pp. 202–211, 2014.

X. Yang, G. Pang, and N. Yung, “Robust fabric defect detection and classification using multiple adaptive wavelets,” IEE Proceedings-Vision, Image and Signal Processing, vol. 152, no. 6, pp. 715–723, 2005.

F. S. Cohen, Z. Fan, and S. Attali, “Automated inspection of textile fabrics using textural models,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 13, no. 8, pp. 803–808, 1991.

A. Dogandžić, N. Eua-Anant, and B. Zhang, “Defect detection using hidden Markov random fields,” in Proceedings of the AIP Conference, vol. 760, pp. 704–711, USA, July 2005.

L. Tong, W. K. Wong, and C. K. Kwong, “Fabric Defect Detection for Apparel Industry: A Nonlocal Sparse Representation Approach,” IEEE Access, vol. 5, pp. 5947–5964, 2017.

J. Zhou, D. Semenovich, A. Sowmya, and J. Wang, “Sparse dictionary reconstruction for textile defect detection,” in Proceedings of the 11th IEEE International Conference on Machine Learning and Applications, ICMLA 2012, pp. 21–26, USA, December 2012.

J. Cao, J. Zhang, Z. Wen, N. Wang, and X. Liu, “Fabric defect inspection using prior knowledge guided least squares regression,” Multimedia Tools and Applications, vol. 76, no. 3, pp. 1–17, 2015.

M. T. Habib and M. Rokonuzzaman, “Distinguishing feature selection for fabric defect classification using neural network,” Journal of Multimedia, vol. 6, no. 5, pp. 416–424, 2011.

Z. Kang, C. Yuan, and Q. Yang, “The fabric defect detection technology based on wavelet transform and neural network convergence,” in Proceedings of the 2013 IEEE International Conference on Information and Automation, ICIA 2013, pp. 597–601, China, August 2013.

P. Li, J. Liang, X. Shen, M. Zhao, and L. Sui, “Textile fabric defect detection based on low-rank representation,” Multimedia Tools and Applications, vol. 3, pp. 1–26, 2017.

H.-G. Bu, J. Wang, and X.-B. Huang, “Fabric defect detection based on multiple fractal features and support vector data description,” Engineering Applications of Artificial Intelligence, vol. 22, no. 2, pp. 224–235, 2009.

A. Ghosh, T. Guha, R. B. Bhar, and S. Das, “Pattern classification of fabric defects using support vector machines,” International Journal of Clothing Science and Technology, vol. 23, no. 2, pp. 142–151, 2011.

H. Y. T. Ngan, G. K. H. Pang, S. P. Yung, and M. K. Ng, “Wavelet based methods on patterned fabric defect detection,” Pattern Recognition, vol. 38, no. 4, pp. 559–576, 2005.

H. Y. T. Ngan and G. K. H. Pang, “Novel method for patterned fabric inspection using Bollinger bands,” Optical Engineering, vol. 45, no. 8, Article ID 087202, 2006.

H. Y. T. Ngan and G. K. H. Pang, “Regularity analysis for patterned texture inspection,” IEEE Transactions on Automation Science and Engineering, vol. 6, no. 1, pp. 131–144, 2009.

M. K. Ng, H. Y. T. Ngan, X. Yuan, and W. Zhang, “Patterned fabric inspection and visualization by the method of image decomposition,” IEEE Transactions on Automation Science and Engineering, vol. 11, no. 3, pp. 943–947, 2014.

C. S. C. Tsang, H. Y. T. Ngan, and G. K. H. Pang, “Fabric inspection based on the Elo rating method,” Pattern Recognition, vol. 51, pp. 378–394, 2016.

H. Y. T. Ngan, G. K. H. Pang, and N. H. C. Yung, “Motif-based defect detection for patterned fabric,” Pattern Recognition, vol. 41, no. 6, pp. 1878–1894, 2008.

H. Y. T. Ngan, G. K. H. Pang, and N. H. C. Yung, “Patterned fabric defect detection using a motif-based approach,” in Proceedings of the 14th IEEE International Conference on Image Processing, ICIP 2007, pp. II33–II36, USA, September 2007.

F. Pukelsheim, “The three sigma rule,” The American Statistician, vol. 48, no. 2, pp. 88–91, 1994.

N. Lazarevic-McManus, J. Renno, and G. A. Jones, “Performance evaluation in visual surveillance using the F-measure,” in Proceedings of the 4th ACM International Workshop on Video Surveillance and Sensor Networks (VSSN '06), pp. 45–52, Santa Barbara, California, USA, October 2006.

Y. J. Huang, R. Powers, and G. T. Montelione, “Protein NMR recall, precision, and F-measure scores (RPF scores): Structure quality assessment measures based on information retrieval statistics,” Journal of the American Chemical Society, vol. 127, no. 6, pp. 1665–1674, 2005.