# Fabric Defect Detection Using Local Homogeneity Analysis and Neural Network

Authors: Ali Rebhi; Issam Benmhammed; Sabeur Abid; Farhat Fnaiech
Journal: Journal of Photonics
 (2015)

---

## Abstract

In the textile manufacturing industry, fabric defect detection becomes a necessary and essential step in quality control. The investment in this field is more than economical when reduction in labor cost and associated benefits are considered. Moreover, the development of a wholly automated inspection system requires efficient and robust algorithms. To overcome this problem, in this paper, we present a new fabric defect detection scheme which uses the local homogeneity and neural network. Its first step consists in computing a new homogeneity image denoted asH-image. The second step is devoted to the application of the discrete cosine transform (DCT) to the H-image and the extraction of different representative energy features of each DCT block. These energy features are used by the back-propagation neural network to judge the existence of fabric defect. Simulations on different fabric images and different defect aspects show that the proposed method achieves an average accuracy of 97.35%.


---

## Body

## 1. Introduction

Defect detection is one of the main steps in quality control of manufacturing processes. In the fabric field, defect detection becomes an important task due to the widely used material in daily life. Fabric defects are responsible for nearly 85% of the defects found in the garment industry [1]. Also, it has been observed [2] that price of textile fabric is reduced by 45% to 65% due to defects. It is imperative, therefore, to detect, identify, and prevent these defects from reoccurring. A fabric defect is generally represented by a wired variation with respect to the overall surface aspect. Visual human inspection leads to usual errors due to several reasons, namely, the fatigue and fine defects. Hence, the automation of these operations helps to improve quality and reduce labor costs. As confirmed by [3, 4], there are more than 70 kinds of fabric defects defined by the textile industry. A human fabric inspection achieves a success rate about 60 to 75% [3]. Figure 1 shows the same machine automated inspection.Figure 1
Machine automated inspection [4].Automated visual inspection methods are increasingly taken into account in recent years. There are various visual inspection systems such as defect detection of tiles [5], woods [6, 7], ceramic [8], sheet steel [9], and textiles [10–19].Fabric defect detection is one of the most scheming problems in visual inspection. Currently, there are a lot of new studies and researches in fabric inspection [10–19]. This paper emphasizes this problem and investigates some new technique to solve this problem.


### 1.1. Related Work

Texture analysis has a great interest in image processing, and there are many applications in its analyzing and processing, one of which is defect detection. Therefore, numerous methods are typically developed to solve the defect detection task in fabric images. The authors in [4] propose a review of the art field in this state. Chan and Pang [10] provided a comprehensive overview of fabric defect detection by Fourier analysis. Wavelet transform is another method which was applied in [11–14].On the other hand, Latif-Amet et al. [15] proposed an approach that uses wavelet theory and cooccurrence matrix for the detection of defects encountered in textile images and classifies each subwindow as defective or nondefective by a Mahalanobis distance. Gabor filter has been widely used in the field of fabric defect detection. All the detection approaches using Gabor filter can be classified into two categories. One is to use a filter bank, such as [16, 17], and the other one is to use optimal filters, such as [18–21]. In general, filtering with a filter bank can generate excessive data for processing though a set of filters may aid the segmentation. Correspondingly, the quality of localization and recognition is affected dramatically and the time consumption is large as well.Moreover, model based approaches have been successfully used in the fabric defect detection. Some of textural analysis methods are based on the Markov random field model [22]. Campbell et al. [23] used the model based clustering method to detect linear pattern production defects.Recently, neural network has attracted a lot of attention in defect detection applications. Huang and Chen [24] have used back-propagation neural network, with fuzzy logic, to achieve the classification of eight different kinds of fabric defects. In [25] an approach for the segmentation of local textile defects using feed-forward neural network is presented. Recently, Jing et al. in [26] present a machine vision system which uses basic patch statistics from raw image data combined with a two-layer neural network to detect surface defects on arbitrary textured and weakly labeled image data.


### 1.2. Present Work

In textured images, discontinuities represent generally an important feature such as boundaries. It is known that the local homogeneity analysis is the method to detect these discontinuities. Moreover, due to their nonparametric nature and their ability to describe complex decision regions, neural network is one of the best classifiers used for defect detection. In this paper, a new approach for fabric defect detection based on the local homogeneity analysis and neural network is proposed.This paper is organized as follows. In Section2 the local homogeneity computation (H-image) for different window sizes is presented. The discrete cosine transform of the H-image and feature extraction are then described in Section 3. Section 4 provides a system description of the proposed method. It is followed by the experimental results in Section 5. Details of training and test procedures which include our proposed method for fabric defect detection and detection performance are described in Sections 5.1 and 5.2, respectively. Finally, Section 6 draws conclusion and summarizes the paper.


## 1.1. Related Work

Texture analysis has a great interest in image processing, and there are many applications in its analyzing and processing, one of which is defect detection. Therefore, numerous methods are typically developed to solve the defect detection task in fabric images. The authors in [4] propose a review of the art field in this state. Chan and Pang [10] provided a comprehensive overview of fabric defect detection by Fourier analysis. Wavelet transform is another method which was applied in [11–14].On the other hand, Latif-Amet et al. [15] proposed an approach that uses wavelet theory and cooccurrence matrix for the detection of defects encountered in textile images and classifies each subwindow as defective or nondefective by a Mahalanobis distance. Gabor filter has been widely used in the field of fabric defect detection. All the detection approaches using Gabor filter can be classified into two categories. One is to use a filter bank, such as [16, 17], and the other one is to use optimal filters, such as [18–21]. In general, filtering with a filter bank can generate excessive data for processing though a set of filters may aid the segmentation. Correspondingly, the quality of localization and recognition is affected dramatically and the time consumption is large as well.Moreover, model based approaches have been successfully used in the fabric defect detection. Some of textural analysis methods are based on the Markov random field model [22]. Campbell et al. [23] used the model based clustering method to detect linear pattern production defects.Recently, neural network has attracted a lot of attention in defect detection applications. Huang and Chen [24] have used back-propagation neural network, with fuzzy logic, to achieve the classification of eight different kinds of fabric defects. In [25] an approach for the segmentation of local textile defects using feed-forward neural network is presented. Recently, Jing et al. in [26] present a machine vision system which uses basic patch statistics from raw image data combined with a two-layer neural network to detect surface defects on arbitrary textured and weakly labeled image data.


## 1.2. Present Work

In textured images, discontinuities represent generally an important feature such as boundaries. It is known that the local homogeneity analysis is the method to detect these discontinuities. Moreover, due to their nonparametric nature and their ability to describe complex decision regions, neural network is one of the best classifiers used for defect detection. In this paper, a new approach for fabric defect detection based on the local homogeneity analysis and neural network is proposed.This paper is organized as follows. In Section2 the local homogeneity computation (H-image) for different window sizes is presented. The discrete cosine transform of the H-image and feature extraction are then described in Section 3. Section 4 provides a system description of the proposed method. It is followed by the experimental results in Section 5. Details of training and test procedures which include our proposed method for fabric defect detection and detection performance are described in Sections 5.1 and 5.2, respectively. Finally, Section 6 draws conclusion and summarizes the paper.


## 2. Local Homogeneity Definition

It is known that discontinuities in textured images represent generally an important feature such as boundaries. The main problem is how to detect these discontinuities. A method to resolve this problem is the homogeneity (H). The calculation of H was proposed first by Jing et al. in [26]. Let (x,y) be the coordinates of a pixel and I(x,y) the corresponding intensity level. Let P be a squared window, that is, a mask of (2N+1) width centered on the pixel. In the window P one can define different vectors, such as Cpi=(xi-xc,yi-yc), where (xi,yi) is the neighbor of the center (xc,yc) defined as(1)c-N≤xi≤c+N,c-N≤yi≤c+N,where (xi,yi) is the coordinate of the pixel Pi, c is the coordinate of the centre pixel (Pc), and N is an integer number which defines the mask size.Note that this definition allows computing the homogeneity of a pixel for different mask sizes3×3, 5×5, and so forth.Figure2 shows an example of the different pixels used to compute homogeneity in a window of size 5×5 pixels.Figure 2
Different pixels used to compute the local homogeneity for5×5 mask, for each pixel corresponds to a direction vector fi.Based onCpi a new vector fi is constructed as follows:(2)fi=Ixi,yi-Ixc,ycCpiCpi.For a mask of width (2N+1) we have 2N+12 vectors fi:1≤i≤2N+12.Letf be the sum of the whole vectors defined in the window P, so(3)f=∑i=12N+12fi.The H value measurement (the homogeneity value) is defined as the norm of f, so that(4)H=f.To limit the huge variation of the local homogeneity the normalized homogeneity is used:(5)H^=H-Hmin⁡Hmax⁡-Hmin⁡,where Hmin⁡ and Hmax⁡ are the minimum and the maximum value of homogeneity, respectively. The resulting H-image is constructed by the different values of H^ computed for each pixel value Ic(xc,yc).


## 3. Discrete Cosine Transform (DCT) and Features Extraction from the DCT Block

### 3.1. Brief Description of DCT Transform

The DCT of anH-image Hx,y of size M×N is given by (6). This expression must be computed for values of u=0,1,2,…,M-1 and also for v=0,1,2,…,N-1.The variablesu and v are frequency variables, x and y are spatial variables, and P and Q are the size of the DCT block:(6)Du,v=σuσv∑x=0P-1∑y=0Q-1Hx,ycos⁡2y+1uπ2Pcos⁡2x+1vπ2Q,where(7)σu=1P,foru=02P,otherwise,σv=1Q,forv=02Q,otherwise.


### 3.2. Feature Extraction

In order to characterize the frequency domain within texture image, this paper proposes to use the features energy distribution in the 2D-DCT domain from theH-image, which is presented as follows [27]:(i)
The horizontal energy value of the DCT block:(8)EH=∑u=0P-1∑v=0Q-1v+12×Hx,y21/2foru+v≠0.(ii)
The vertical energy value of a DCT block:(9)EV=∑u=0P-1∑v=0Q-1u+12×Hx,y21/2foru+v≠0.(iii)
The diagonal energy value of a DCT block:(10)ED=∑u=0P-1∑v=0Q-1u+1×v+1×Hx,y21/2foru+v≠0.(iv)
The average energy value of a DCT block:(11)EM=1P×Q∑u=0P-1∑v=0Q-1Hx,y2.(v)
The standard deviation energy value of a DCT block:(12)ES=1P×Q-1∑u=0P-1∑v=0Q-1Hx,y-EM2.Then the features vector of each pixel is expressed as(13)T=EHEVEDEMES.In the next section, the principal component analysis (PCA) is introduced to eliminate correlations between features and reduce the dimensionality of the original feature vectors.


### 3.3. Features Reduction

Feature reduction means transforming the original features into a lower dimensional space [28, 29]. Most of the feature extraction techniques have been based on linear techniques such as principal component analysis (PCA). PCA is a quantitatively rigorous method for achieving data dimensionality reduction. The method generates a new set of variables, called principal components (PCs), which maximize the variance of the projected vectors. Each PC is a linear combination of the original variables. All the PCs are orthogonal to each other, so there is no redundant information. The PCs as a whole form an orthogonal basis for the space of the data. Thus, the first PC consists of the highest variability, the second PC consists of the next highest variability, and so on for other directions. The first few components are kept and others with less variability are discarded. As shown in Figure 3, in the proposed work, the first 4 PCs are used to feed to the feed-forward neural networks (FFN) classifier.Figure 3
Eigenvalues of covariance matrix for feature reduction.


## 3.1. Brief Description of DCT Transform

The DCT of anH-image Hx,y of size M×N is given by (6). This expression must be computed for values of u=0,1,2,…,M-1 and also for v=0,1,2,…,N-1.The variablesu and v are frequency variables, x and y are spatial variables, and P and Q are the size of the DCT block:(6)Du,v=σuσv∑x=0P-1∑y=0Q-1Hx,ycos⁡2y+1uπ2Pcos⁡2x+1vπ2Q,where(7)σu=1P,foru=02P,otherwise,σv=1Q,forv=02Q,otherwise.


## 3.2. Feature Extraction

In order to characterize the frequency domain within texture image, this paper proposes to use the features energy distribution in the 2D-DCT domain from theH-image, which is presented as follows [27]:(i)
The horizontal energy value of the DCT block:(8)EH=∑u=0P-1∑v=0Q-1v+12×Hx,y21/2foru+v≠0.(ii)
The vertical energy value of a DCT block:(9)EV=∑u=0P-1∑v=0Q-1u+12×Hx,y21/2foru+v≠0.(iii)
The diagonal energy value of a DCT block:(10)ED=∑u=0P-1∑v=0Q-1u+1×v+1×Hx,y21/2foru+v≠0.(iv)
The average energy value of a DCT block:(11)EM=1P×Q∑u=0P-1∑v=0Q-1Hx,y2.(v)
The standard deviation energy value of a DCT block:(12)ES=1P×Q-1∑u=0P-1∑v=0Q-1Hx,y-EM2.Then the features vector of each pixel is expressed as(13)T=EHEVEDEMES.In the next section, the principal component analysis (PCA) is introduced to eliminate correlations between features and reduce the dimensionality of the original feature vectors.


## 3.3. Features Reduction

Feature reduction means transforming the original features into a lower dimensional space [28, 29]. Most of the feature extraction techniques have been based on linear techniques such as principal component analysis (PCA). PCA is a quantitatively rigorous method for achieving data dimensionality reduction. The method generates a new set of variables, called principal components (PCs), which maximize the variance of the projected vectors. Each PC is a linear combination of the original variables. All the PCs are orthogonal to each other, so there is no redundant information. The PCs as a whole form an orthogonal basis for the space of the data. Thus, the first PC consists of the highest variability, the second PC consists of the next highest variability, and so on for other directions. The first few components are kept and others with less variability are discarded. As shown in Figure 3, in the proposed work, the first 4 PCs are used to feed to the feed-forward neural networks (FFN) classifier.Figure 3
Eigenvalues of covariance matrix for feature reduction.


## 4. Fabric Defect Detection Method

### 4.1. Fabric Defect Classification Based on FFN

This method consists in scanning the acquired image with a squared window and computing the local homogeneity for each pixel and constructing theH-image. In our work we have used a window of size 11×11 pixels. Then, we divided the H-image into overlapping squared blocks. The five aforementioned types of energy are computed through the DCT applied for each block which produces these energies. Every pixel of the acquired image is characterized by a feature vector (five types of energy). Then, the statistical or Z-score normalization technique is applied to all the features vectors that form the input to the neural network. The number of the inputs of the neural network is not equal to the same number of feature extractions. They are obtained using a principal component analyzing (PCA) routine. This routine is applied in order to limit the number of inputs of neural network. In this case the number of inputs equals four (i.e., the number of chosen principal components). The number of the training vectors equals the number of pixels in the considered field of view of the investigated fabric surface. The network has a single output.The concept diagram of the fabric defect detection scheme is presented in Figure4.Figure 4
Block diagram of fabric defect detection usingH-image and FFN.The procedure of the proposed method can be summarized as follows.Step 1. Scanning of the input image I with a squared window and computing the local homogeneity for each pixel.Step 2. Normalization of the local homogeneity.Step 3. Division of the H-image into overlapping squared blocks and application of a DCT transform.Step 4. Features extraction from the DCT block.Step 5. Features reduction using the PCA method.Step 6. Normalization of all features using Zero mean and unity variance technique.Step 7. Classification process for fabric defect by FFN based on H-image (since only 2 conditions (block contains defect regions or not) need to be identified in this paper).


### 4.2. Learning Defect Classifier

After a feature calculation step, now we use the training data to train a neural network using back-propagation. An example of a FFN structure is shown in Figure4 FFN classification. The size of the input layer is equal to the feature dimension; here k=4 (after applying a PCA technique the number of features is reduced to 4). The second layer, called the hidden layer, hasL1 nodes. In the output layer, all nodes from the hidden layer are mapped to one final node showing the classification result. All weights in the neural network are initialized by random numbers. Training a network means optimizing network detection performance. This is realized by minimizing the performance function. The performance measurement function in this case is the mean squared error (MSE). The final classification result is a value between [-1,1] and predicts whether an unknown block contains defect regions or not.


## 4.1. Fabric Defect Classification Based on FFN

This method consists in scanning the acquired image with a squared window and computing the local homogeneity for each pixel and constructing theH-image. In our work we have used a window of size 11×11 pixels. Then, we divided the H-image into overlapping squared blocks. The five aforementioned types of energy are computed through the DCT applied for each block which produces these energies. Every pixel of the acquired image is characterized by a feature vector (five types of energy). Then, the statistical or Z-score normalization technique is applied to all the features vectors that form the input to the neural network. The number of the inputs of the neural network is not equal to the same number of feature extractions. They are obtained using a principal component analyzing (PCA) routine. This routine is applied in order to limit the number of inputs of neural network. In this case the number of inputs equals four (i.e., the number of chosen principal components). The number of the training vectors equals the number of pixels in the considered field of view of the investigated fabric surface. The network has a single output.The concept diagram of the fabric defect detection scheme is presented in Figure4.Figure 4
Block diagram of fabric defect detection usingH-image and FFN.The procedure of the proposed method can be summarized as follows.Step 1. Scanning of the input image I with a squared window and computing the local homogeneity for each pixel.Step 2. Normalization of the local homogeneity.Step 3. Division of the H-image into overlapping squared blocks and application of a DCT transform.Step 4. Features extraction from the DCT block.Step 5. Features reduction using the PCA method.Step 6. Normalization of all features using Zero mean and unity variance technique.Step 7. Classification process for fabric defect by FFN based on H-image (since only 2 conditions (block contains defect regions or not) need to be identified in this paper).


## 4.2. Learning Defect Classifier

After a feature calculation step, now we use the training data to train a neural network using back-propagation. An example of a FFN structure is shown in Figure4 FFN classification. The size of the input layer is equal to the feature dimension; here k=4 (after applying a PCA technique the number of features is reduced to 4). The second layer, called the hidden layer, hasL1 nodes. In the output layer, all nodes from the hidden layer are mapped to one final node showing the classification result. All weights in the neural network are initialized by random numbers. Training a network means optimizing network detection performance. This is realized by minimizing the performance function. The performance measurement function in this case is the mean squared error (MSE). The final classification result is a value between [-1,1] and predicts whether an unknown block contains defect regions or not.


## 5. Experimental Results: Application of the Proposed Method in Fabric Defect

This section presents the experimental results for fabric defect detection. The dataset used is established and the results are analyzed in Section5.1. The performance of the proposed algorithm for a number of sample images is presented and analyzed in Section 5.2. Discussion and comparison with some previous works are given in Section 5.3.


### 5.1. Dataset

The dataset used in this work is provided by PARTNER textile industry in Tunisia [30]. The dataset consists of 89 images, of which 13 have no defects and 76 have various fabric defects. The total databases were divided into two sets: one for training (containing 60% of the samples) and the other for test (containing 40% of the samples). Table 1 summarizes some fabric defects types used in this study, their definition, and their reasons.Table 1
Example of fabric defect types.
Defect type
Definition
Reasons
Floats
A portion of a yarn in a fabric that extends or floats, unbound, over two or more adjacent ends or picks
It is caused by missing of interlacement of two series of threads
Holes
A fabric area free of both warp and weft threads
It is a mechanical fault caused by a broken machine part
Oil stains
Fabric area contains oil spots
It is caused by too much oiling on loom parts or from other external sources
Slubs
A local uneven fabric thickness
It is caused by an extra piece of yarn that is woven into fabric. It can also be caused by thick places in the yarn or by fly waste being spun in yarn during the spinning process
Knots
A fabric place where two ends of yarn have been tied together and the tails of the knot are protruding from the surface
It is caused by tying spools of yarn ends together
Miss-end
A warp thread is absent in the fabric for a short or long distance
It is due to incorrect warping or by a broken warp thread that never replaced by another one
Miss-pick
A weft thread is absent in the fabric for a short or long distance
It is caused by incorrect picking or if the weaver restarted the loom after any stoppage without adapting the position for the new insertionAll simulations were implemented on a personal computer (Intel core 2Duo CPU T5870 @2 GHz and 3 GB of RAM). The programs were tested first in MATLAB language and after that they were rewritten in C++ language for the purpose to be implemented in a real time process. We note that once the neural network is trained in the learning phase (offline step) it will be inserted in the defect detection process and then the global needed time is considerably reduced.Training of the network was carried out with the error back-propagation algorithm by using a set of fabric images data containing 46 images with defect and 8 images without defect covering every possible pattern of defect blocks and nondefect blocks.Initially, all the weight values of the neural network were randomly set to small values between 0 and 0.1 and the learning coefficients were set to 0.6. Several experiments were conducted for selecting the best FFN. The factors that played a significant role in the performance of the system were the number of hidden layer neurons, the learning coefficients of the hidden layer neurons and the output layer, the activation function, and the learning rule. The parameters of the best architecture for FFN are summarized in Table2.Table 2
Training parameters.
Parameter
Value
Number of inputs/outputs
4/1
Number of hidden layers
1
Number of hidden layer neurons
9
Learning coefficient for hidden layer
0.6
Activation function
Bipolar Sigmoid
Initial weight values (random)
0~0.1
Learning rule delta
Delta
Convergence error
2.8
e
-
5
Number of iterations
50120


### 5.2. Performance Detection

After the FFN is trained with 54 images, its performance has been tested with the remaining ones (35 images). The performance of this algorithm is validated by calculating the following performance measure for the train set and test set separately. The classification accuracy (CA) is as follows: ratio between the total number of correctly classified test samples and the total number of test samples. Generally, detection accuracy, also known as detection success rate, is defined as(14)CA[%]=TP+TNTP+FN+TN+FP×100.Table3 outlines definitions of true positive (TP), false positive (FP), true negative (TN), and false negative (FN) in defect detection.Table 3
Definitions of true positive (TP), false positive (FP), true negative (TN), and false negative (FN) in defect detection.
Actually defective
Actually defect-free
Detected as defective
True positive (TP)
False positive (FP)
Detected as defect-free
False negative (FN)
True negative (TN)The classification results of all classifiers in the training and testing processes are presented in Table4. In the training process, all the FFN classifiers achieve an average accuracy of 98.30% and 99.05% in the whole dataset and the reduced dataset, respectively. This indicates that the classifiers are well trained and can be applied for fabric defect detection. However, in the testing process these classifiers are validated against the test data; the average accuracy is about 97.35% and 96.25% for the reduced and original features, respectively.Table 4
The testing accuracy for different blocks conditions using FNN.
Blocks conditions
FNN including all features
FNN including selected features
Classification accuracy [%]
Classification accuracy [%]
Training
Testing
Training
Testing
Defective blocks
97.50
95.30
98.30
96.60
Nondefective blocks
99.10
97.20
100
98.10
Average
98.30
96.25
99.15
97.35From the test results shown in Table4 it can be seen that the FNN classifiers recognize the blocks defects effectively. The recognition results of FNN are ideal because of its high accuracy and a good generalization capability, when the average classification efficiency close to 97.35% is reasonably good.For256×256 image the time needed for defect detection by scanning all the image is about 0.8 seconds. Taking into account the production rate (knitting speed), the algorithm can be used in a real time application.


### 5.3. Discussion and Comparison with Some Previous Works

In this experiment, theH-image is obtained after scanning the input image using a window of size 11×11 pixels. The features extractions are produced by dividing the H-image into overlapping blocks of size 4×4 pixels after applying the DCT transform. The final classification result is obtained from a feed-forward network trained with the back-propagation (BP). Figure 5 shows detection examples of the fabric dataset. The kinds of fabric defects vary in size, shape, and orientation.Figure 5
Defect detection results. (a) Images of fabrics with different types of defects, (b) the correspondingH-image, and (c) the corresponding defect detection results.
(a)
(b)
(c)In Figure5, column (a) shows the original images. Columns (b) and (c), respectively, correspond to the H-image and defect detection results. Image in the first line represents the “hole” defect. The proposed algorithm was able to correctly detect the defect. Image in the second line shows another type of defect (slub defect) and the corresponding defects detection results which were accurately detected. Other types of sample defects are shown in the rest of the figure.It is interesting to note that despite the varying size and orientation of the defects, the algorithm managed to identify accurately most of the defects.Based on these results, it can be concluded that the DCT features extraction method effectively improves classification performance for the given fabric defect classification problem.Table5 provides a summary of the studies on automated fabric defect detection. Bissi et al. (2013) [29] proposed an approach for automated texture defect detection in uniform and structured fabrics based on a complex symmetric Gabor filter bank and PCA. The performance of their algorithm has been extensively evaluated by using images of the TILDA Textile Texture Database and reported an accuracy of 98.8%. Tabassian et al. (2011) [31] used a wavelet based feature extraction method beside binary thresholding technique and morphological operations and classified them by MLP neural networks. The Dempster-Shafer theory of evidence was then employed for combining different evidence to decrease the value of uncertainty. It achieved a detection accuracy of 89.48%. Zhang et al. (2010) [32] used the neighborhood of each pixel to extract the features and to reduce them using PCA and classified them using radial basis function (RBF) network improved by Gaussian mixture model (GMM) with an accuracy of 83.4%. Qiuping et al. (2014) [33] used an approach for defect detection applied to twill, plain, gingham, and striped fabric using Gabor filter and sparse coding with an accuracy of 93%.Table 5
Comparison of the proposed method with some previous research.
Literature
Features
Classifier
Accuracy [%]
[29]
Complex symmetric Gabor filter bank and principal component analysis (PCA)
PCA + Euclidean norm
98.8
[31]
Wavelet based feature extraction and morphological operations + Dempster-Shafer theory
MLP neural networks
89.48
[32]
Radial basis function (RBF) network and gray level arrangement in the neighborhood of each pixel + PCA
PCA + RBF network with Gaussian kernel
83.4
[33]
Small scale overcomplete basis set and Gabor filter
Sparse coding
93
Proposed Methodology
Features derived from DCT transform ofH-image and FFN
PCA + FFN
97.35In conclusion, the evaluation of our method versus those in previous researches, given in Table5, shows that our experiment has good potential for improving fabric defect detection. The features derived from the DCT transform of H-image with the FFN classifier produce a good classification performance: the average CA result is 97.35%. This combination of the feature and classifier is promising for a high accuracy of fabric defect detection.


## 5.1. Dataset

The dataset used in this work is provided by PARTNER textile industry in Tunisia [30]. The dataset consists of 89 images, of which 13 have no defects and 76 have various fabric defects. The total databases were divided into two sets: one for training (containing 60% of the samples) and the other for test (containing 40% of the samples). Table 1 summarizes some fabric defects types used in this study, their definition, and their reasons.Table 1
Example of fabric defect types.
Defect type
Definition
Reasons
Floats
A portion of a yarn in a fabric that extends or floats, unbound, over two or more adjacent ends or picks
It is caused by missing of interlacement of two series of threads
Holes
A fabric area free of both warp and weft threads
It is a mechanical fault caused by a broken machine part
Oil stains
Fabric area contains oil spots
It is caused by too much oiling on loom parts or from other external sources
Slubs
A local uneven fabric thickness
It is caused by an extra piece of yarn that is woven into fabric. It can also be caused by thick places in the yarn or by fly waste being spun in yarn during the spinning process
Knots
A fabric place where two ends of yarn have been tied together and the tails of the knot are protruding from the surface
It is caused by tying spools of yarn ends together
Miss-end
A warp thread is absent in the fabric for a short or long distance
It is due to incorrect warping or by a broken warp thread that never replaced by another one
Miss-pick
A weft thread is absent in the fabric for a short or long distance
It is caused by incorrect picking or if the weaver restarted the loom after any stoppage without adapting the position for the new insertionAll simulations were implemented on a personal computer (Intel core 2Duo CPU T5870 @2 GHz and 3 GB of RAM). The programs were tested first in MATLAB language and after that they were rewritten in C++ language for the purpose to be implemented in a real time process. We note that once the neural network is trained in the learning phase (offline step) it will be inserted in the defect detection process and then the global needed time is considerably reduced.Training of the network was carried out with the error back-propagation algorithm by using a set of fabric images data containing 46 images with defect and 8 images without defect covering every possible pattern of defect blocks and nondefect blocks.Initially, all the weight values of the neural network were randomly set to small values between 0 and 0.1 and the learning coefficients were set to 0.6. Several experiments were conducted for selecting the best FFN. The factors that played a significant role in the performance of the system were the number of hidden layer neurons, the learning coefficients of the hidden layer neurons and the output layer, the activation function, and the learning rule. The parameters of the best architecture for FFN are summarized in Table2.Table 2
Training parameters.
Parameter
Value
Number of inputs/outputs
4/1
Number of hidden layers
1
Number of hidden layer neurons
9
Learning coefficient for hidden layer
0.6
Activation function
Bipolar Sigmoid
Initial weight values (random)
0~0.1
Learning rule delta
Delta
Convergence error
2.8
e
-
5
Number of iterations
50120


## 5.2. Performance Detection

After the FFN is trained with 54 images, its performance has been tested with the remaining ones (35 images). The performance of this algorithm is validated by calculating the following performance measure for the train set and test set separately. The classification accuracy (CA) is as follows: ratio between the total number of correctly classified test samples and the total number of test samples. Generally, detection accuracy, also known as detection success rate, is defined as(14)CA[%]=TP+TNTP+FN+TN+FP×100.Table3 outlines definitions of true positive (TP), false positive (FP), true negative (TN), and false negative (FN) in defect detection.Table 3
Definitions of true positive (TP), false positive (FP), true negative (TN), and false negative (FN) in defect detection.
Actually defective
Actually defect-free
Detected as defective
True positive (TP)
False positive (FP)
Detected as defect-free
False negative (FN)
True negative (TN)The classification results of all classifiers in the training and testing processes are presented in Table4. In the training process, all the FFN classifiers achieve an average accuracy of 98.30% and 99.05% in the whole dataset and the reduced dataset, respectively. This indicates that the classifiers are well trained and can be applied for fabric defect detection. However, in the testing process these classifiers are validated against the test data; the average accuracy is about 97.35% and 96.25% for the reduced and original features, respectively.Table 4
The testing accuracy for different blocks conditions using FNN.
Blocks conditions
FNN including all features
FNN including selected features
Classification accuracy [%]
Classification accuracy [%]
Training
Testing
Training
Testing
Defective blocks
97.50
95.30
98.30
96.60
Nondefective blocks
99.10
97.20
100
98.10
Average
98.30
96.25
99.15
97.35From the test results shown in Table4 it can be seen that the FNN classifiers recognize the blocks defects effectively. The recognition results of FNN are ideal because of its high accuracy and a good generalization capability, when the average classification efficiency close to 97.35% is reasonably good.For256×256 image the time needed for defect detection by scanning all the image is about 0.8 seconds. Taking into account the production rate (knitting speed), the algorithm can be used in a real time application.


## 5.3. Discussion and Comparison with Some Previous Works

In this experiment, theH-image is obtained after scanning the input image using a window of size 11×11 pixels. The features extractions are produced by dividing the H-image into overlapping blocks of size 4×4 pixels after applying the DCT transform. The final classification result is obtained from a feed-forward network trained with the back-propagation (BP). Figure 5 shows detection examples of the fabric dataset. The kinds of fabric defects vary in size, shape, and orientation.Figure 5
Defect detection results. (a) Images of fabrics with different types of defects, (b) the correspondingH-image, and (c) the corresponding defect detection results.
(a)
(b)
(c)In Figure5, column (a) shows the original images. Columns (b) and (c), respectively, correspond to the H-image and defect detection results. Image in the first line represents the “hole” defect. The proposed algorithm was able to correctly detect the defect. Image in the second line shows another type of defect (slub defect) and the corresponding defects detection results which were accurately detected. Other types of sample defects are shown in the rest of the figure.It is interesting to note that despite the varying size and orientation of the defects, the algorithm managed to identify accurately most of the defects.Based on these results, it can be concluded that the DCT features extraction method effectively improves classification performance for the given fabric defect classification problem.Table5 provides a summary of the studies on automated fabric defect detection. Bissi et al. (2013) [29] proposed an approach for automated texture defect detection in uniform and structured fabrics based on a complex symmetric Gabor filter bank and PCA. The performance of their algorithm has been extensively evaluated by using images of the TILDA Textile Texture Database and reported an accuracy of 98.8%. Tabassian et al. (2011) [31] used a wavelet based feature extraction method beside binary thresholding technique and morphological operations and classified them by MLP neural networks. The Dempster-Shafer theory of evidence was then employed for combining different evidence to decrease the value of uncertainty. It achieved a detection accuracy of 89.48%. Zhang et al. (2010) [32] used the neighborhood of each pixel to extract the features and to reduce them using PCA and classified them using radial basis function (RBF) network improved by Gaussian mixture model (GMM) with an accuracy of 83.4%. Qiuping et al. (2014) [33] used an approach for defect detection applied to twill, plain, gingham, and striped fabric using Gabor filter and sparse coding with an accuracy of 93%.Table 5
Comparison of the proposed method with some previous research.
Literature
Features
Classifier
Accuracy [%]
[29]
Complex symmetric Gabor filter bank and principal component analysis (PCA)
PCA + Euclidean norm
98.8
[31]
Wavelet based feature extraction and morphological operations + Dempster-Shafer theory
MLP neural networks
89.48
[32]
Radial basis function (RBF) network and gray level arrangement in the neighborhood of each pixel + PCA
PCA + RBF network with Gaussian kernel
83.4
[33]
Small scale overcomplete basis set and Gabor filter
Sparse coding
93
Proposed Methodology
Features derived from DCT transform ofH-image and FFN
PCA + FFN
97.35In conclusion, the evaluation of our method versus those in previous researches, given in Table5, shows that our experiment has good potential for improving fabric defect detection. The features derived from the DCT transform of H-image with the FFN classifier produce a good classification performance: the average CA result is 97.35%. This combination of the feature and classifier is promising for a high accuracy of fabric defect detection.


## 6. Conclusions and Future Work

In this paper a novel method is proposed to solve the problem of fabric defect detection, which is based on the local homogeneity analysis and the feed-forward neural networks. A DCT transform based feature extraction method beside the PCA was used. The performance of this algorithm has been extensively evaluated by using images of the PARTNER Textile Texture Database. The comparison with other existing algorithms reported in literature highlights the effectiveness of the proposed approach. The average accuracy of block condition was 97.35%; the results show that the proposed algorithm is a strong technique for fabric defect detection. The algorithm presents some drawbacks, namely, the arbitrarily choice of the windows size of the mask used to compute theH-image. This in its turn affects intensively the defect detection of the algorithm. Indeed if the mask size is chosen relatively large (such as 15×15) this will homogenize even some different regions and then this will cause some false alarms. If the mask size is chosen relatively small (such as 3×3 or 5×5) this will induce a poor homogenization and, therefore, similar areas (especially in stochastic textures) will be considered as different areas and may be seen as defects by the algorithm.



---

*Source: 376163-2015-03-17.xml*