# Classification of Woven Fabric Faulty Images Using Convolution Neural Network

Authors: Rehan Ashraf; Yasir Ijaz; Muhammad Asif; Khurram Zeeshan Haider; Toqeer Mahmood; Muhammad Owais
Journal: Mathematical Problems in Engineering
 (2022)

---

## Abstract

Convolution neural network (CNN) is one of the most popular machine learning techniques that is being used in many applications like image classification, image analysis, textile archives, object recognition, and many more. In the textile industry, the classification of defective and nondefective fabric is an essential and necessary step to control the quality of fabric. Traditionally, a user physically inspects and classifies the fabric, which is an ineffective and tedious activity. Therefore, it is desirable to have an automated system for detecting defects in the fabric. To address these issues, this research proposes a solution for classifying defective and nondefective fabric using deep learning-based framework. Therefore, in this research, an image processing technique with CNN-based GoogleNet is presented to classify defective and nondefective fabric. To achieve the purpose, the system is trained using different kinds of fabric defects. The performance of the proposed approach was evaluated on the textile texture TILDA dataset, and achieved a classification accuracy of 94.46%. The classification results show that the proposed approach for classifying defective and nondefective fabric is better as compared to other state-of-the-art approaches such as Bayesian, BPNN, and SVM.


---

## Body

## 1. Introduction

Fabric texture refers to how the fabric surface feels [1]. Raw material is important to achieve the high quality of the fabrics. This can be achieved with concentration to remove all faults that are on fabrics such as missing needles, dirt spots, hooks, crack points, holes, scratches, fly, color bleedings, oil spots, broken, lack, or any other [2, 3]; some of the fabric defects are shown in Figure 1. There are different competitors in the marketplace; for survival, it should be the ultimate priority for the textile industry to maintain its quality [4]. After manufacturing the fabric, it is categorized into different types, the first category of the fabric is 100% defect-free. Second, the fabric contains some kind of defect on the fabric surface. The defective fabric is sold in 45% to 65% of the first category, and it represents a major loss for any textile industry [1, 5]. However, the quality of the fabric can be improved by applying the latest technologies during the manufacturing because customer expectations vary with the quality [6]. Therefore, the fabric inspection has a significant role in controlling the fabric quality for any textile industry; without controlling the quality and missing the monitoring of the fabric structure, a manufacturer bears the main loss that results in a downfall in the market as well. In this regard, there are two techniques to improve the quality of the fabric, one is the fabric quality inspection by the human, which is called manual inspection, which is an old strategy to control the fabric quality and has various drawbacks and limitations; the other one is the fabric quality monitoring by an automatic system that overcomes several drawbacks of the manual inspection method [7, 8]. The fabric surface may be velvety smooth, rough, silky, or any other [1]. The texture features depend upon the weaving machine used in the textile industry. The texture is very important for any type of cloth like cotton, silk, leather, wool, flax, or any other. Therefore, there is a slight difference or damaged area on the fabric surface that may create a significant loss for manufacturers [8, 9]. To categorize the fabric, a 4-point system is used in the textile industry; the 4-point system categorizes the fabric on the basis of significance, defect size, and type of defect, as given in Table 1.Figure 1
Some fabric defects which occur during manufacturing processing: (a) end-out, (b) soiled-filling, (c) sloughed-filling, (d) mispick, (e) soiled-end, (f) warp-slub, (g) knot, (h) oil spot, (i) end-out, (j) missing-yarn (k) slub (l) hole.
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)Table 1
Four-point system.
Defect sizeAllocated pointUp to 3 inch defectPoint 13 to 6 inch defectPoint 26 to 9 inch defectPoint 3Over 9 inchPoint 4In woven fabric, the fabric yarn is formed in the horizontal and vertical directions: the horizontal direction is known as the warp direction, and the vertical direction is known as the weft direction as shown in Figure2. In woven fabric, the defects appeared in a longitudinal direction (warp direction) or in a horizontal direction (weft direction) these defects appear due to missing yarn. The yarn represents whether the fabric is defective or not, where the defect occurs due to yarn presence or absence, such as end-out, miss-end, and broken-end or picks. The other yarn defects, such as waste or contamination, slubs, and trapped, occur during the weaving process. Some other machine-related defects exhibit structural change (holes or tears) or machine residue (specks of dirt or oil spots). The number of defects and their source of occurrence have been discussed previously. Therefore, it is of high importance to study and propose an automated solution to handle fabric defects that the textile industry is facing that will help to increase revenue as well.Figure 2
Structure of woven fabric: (a) knit fabric and (b) woven fabric.
(a)(b)Faulty fabric shackles the overall quality of woven garments such as jackets, trousers, pants, and shirts [8]. In the fashion market, woven fabric defects such as a loose wrap, double end, tight end, hole thick, and thin place [10] are classified as the major defect. In recent years, researchers are proposing deep learning-based frameworks to overcome the challenges of traditional fabric inspection [11, 12].There are three main challenges to pointing out fabric faults and classifying them. First, there is a lot of fabric, and their characteristics vary; the fabrics can be classified into 17 groups such as pm, pg, p1, p2, p4, p31m, p3, p3m1, p4m, p4g, pmg, pgg, p6, p6m, cm, cmm, and pmm, and these fabrics or organized repetitively along square, rectangular, parallelogram, hexagonal, and rhombic shapes [13, 14].In Figure3, we show some fabric samples with 2D textures. Second, the defects of the fabric also varied, the fabric faults are classified into different 70 categories in the textile industry that are occurred due to different factors such as machine failure, oil spot, and needle problems [13, 15]. Thirdly, to conduct the experiment, there are rarely fabric faulty samples available. There is a wide variety of fabrics, and their faults also vary, and it is a very difficult task for a single system to point out all types of defects, such as end-out, soiled filling, sloughed-filling, misspick, soiled-end, wrap-slub, knot, oil Spot, missing-yarn, slub, and hole as shown in Figure 1. To conduct experiment, we use MATLAB 2018a for this purpose and point out these defects on the surface of the fabric.Figure 3
Defective fabric samples with complex patterned textures.
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)Based on the abovementioned discussion, the main contributions of the proposed research work are as follows:(i)
Accurate classification of fabric faults using GoogleNet.(ii)
Efficient classification of fabric faults using the correlation factor to deal with the overfitted training data.(iii)
To the best of our knowledge, it is the first time in textile analysis that GoogleNet has been employed for defective and nondefective fabric classification. Reported results exhibit the efficacy of GoogleNet to classify the fabric faults and computing of a deep and discriminative set of features with improved performance.(iv)
But with various numbers of patterns, it is hard for people who are unfamiliar with the local fabric faults to remember their details. However, we can define this issue as a computer image recognition problem and use machine learning techniques to help us solve the problem.(v)
It consists of 22 layers neural network with the combination of layers of convolution, max pooling, softmax, and a new idea of inception module. The proposed inception layer is to find the optimal local construction in each layer and repeat it spatially. Each “inception” module is the construction of the different sizes for each convolution node (1 × 1, 3 × 3, and 5 × 5) and 3 × 3 max pooling node (see Figure4).Figure 4
Structure of the inception module from the GoogleNet network.


## 2. Literature Review

Deep learning- and computer vision-based techniques are used in various applications such as medical image analysis, objection detection, and action recognition [16–20]. Recent research is focused on the use of midlevel features and deep learning models to build robust decision support systems and IoT applications [21–24]. Moreover, the researchers are applying these methods for the classification and detection of fabric faults.Tong et al. [25] demonstrated that the Gabor filter can be used for fabric inspection. In the proposed scheme, Gabor filters are used for linear filtering to analyze whether the fabric region is affected or not. For segmentation purposes, the author used a threshold value, and the experiment was conducted on TILDA dataset which includes 50 nondefective samples and 300 defective samples. In the experiments, 90.0% sensitivity and 87.1% accuracy are achieved. The authors pointed out the three main defects of the fabric. The first two are structural defects that are related to weaving texture, and the third one is the tonal defect. The tonal defect changes the local intensity value. Kaur et al. [26] projected the Gabor technique to address the faulted texture by using digital image processing techniques. Colin Sc Tsang and his team represent a novel Elo rating method for fabric inspection from the uniform background of the fabric. Colin Sc Tsang et al. used a novel Elo rating (ER) method to identify the faulted fabric from the uniform background. The purpose of this inspection is to detect, identify, and locate any defect in the fabric to maintain its quality in the manufacturing industry. Anandan et al. [8] used different techniques for detecting fabric inspection combining aspects such as GLCM (Gray-level co-occurrence matrix) and CT (curvelet transform). In this work, three main flaws of fabric are pointed out, such as holes, spots, and lines on the fabric surface. For the feature extraction (spots) from the fabric surface, the author used the blob algorithm, and to point out the holes on the fabric surface, Peng et al. [27] used the Canny feature extraction algorithm, and the Gary feature extraction method was used to point out the lines on the fabric surface. Selvi et al. [28] demonstrated that fabric fault detection using image processing techniques and ANN is unique and prominent compared to the other ones.Zhang et al. demonstrate the Euclidean distance for color dissimilarity with KNN (K-nearest neighbor) techniques used to separate the defective region from the nondefective region by using digital image processing techniques. Hanmandlu et al. [29] demonstrate the FDT fuzzy decision tree used to address the fabric inspection; in this scheme, four algorithms are used to extract features such as LBP (local binary patterns), SIFT (scale-invariant feature transform), LDP (local directional patterns), and SURF (speeded up robust fractures). For the classification purpose, the authors used both fuzzy Shannon entropy and fuzzy Gini index. For classification purposes, Hanmandlu et al. [29] used a decision tree classifier and fuzzy decision tree. By using these classifiers, they got a 91.5% result. The dataset contains defective and nondefective silk samples, which contains a total of 250 silk samples that were divided into 50 classes, and each class contains five silk samples where 40 classes contain defective, and ten classes contain nondefective silk samples. Based on SIFT and SURF, they got a maximum of 100% results. The results of LBP features using linear kernel, and a maximum of 96% accuracy is achieved. Aldemir et al. [30] demonstrated the linear and nonlinear techniques for fabric inspection using Gabor filtering. Wang et al. [31] used to address whether the fabric is faulty or not, namely, gray-level statistical and morphological methods. Dhawas et al. [32] demonstrate fabric inspection can be categorized into three techniques such as statistical, spectral, and model based. Prajakta et al. [33] combined computer vision methodology with neural networks to identify the classification of textile defects. Karunamoorthy et al. applied artificial neural network to classifiers to separate the fabric faults from the uniform background Classification of the fabric inspection using the structural approach are classified into three categories, namely, statically, spectral and model approach. The structural approaches point out the individual pixel from the uniform background of the fabric surface. According to Nasira [28], the structural approaches were not successful for the fabric inspection due to the stochastic variations in the fabric layout. The first statistical approaches are used for the distribution of pixel value. The main objective of this approach is to classify the defective region from the defect-free region with distinct statistical behavior. The second spectral approach is applied only to uniform textured materials like fabric due to the high degree of periodicity [7]. Therefore, the spectral approach is used to extract the feature, which is less sensitive to noise. The third approach which is model-based is used to extract the features from the faint aligned region. There are several techniques used for automated fabric defect detection. Among them, namely, clustering, SVM (support vector machine), neural network, and statistical are more useful among others [34].


## 3. Proposed Methodology

It is desirable to have such a system and classification for fabric inspection that should be able to cope with the other various types of fabric defect detection methods that are highlighted in the literature. The fabric inspection means extracting the texture to demonstrate whether the fabric is defective or defect-free. The fabric defects are detected on the basis of calculated fabric features.Due to defects, the fabric structure differs from the uniform background. Therefore, the fabric inspection is performed by monitoring the fabric structure. The surface of the fabric may contain different types of flaws that occur during the manufacturing process; therefore, it is very important to measure the fabric quality. Typically, it is a critical need within the textile industry to point out the fabric defects and classify them before delivering them to the end user. First, there is the training phase in which the defective and defect-free formations are used as reference for the base features, and then the convolution neural network is applied to save the network parameters with the feature vector. Second, there is the defect testing phase, in which the fabric is labeled and classified into categories on the basis of certain features. There are two most important concepts, that is, correlation and convolution, used to extract the information from the image. In correlation, the matching of the neighboring patterns or masks is performed; it checks the similarity between two signals or sequences. Besides, the convolution method is used to measure the effect of one signal on other. The block diagram of the proposed scheme is presented in Figure5.Figure 5
A systematic view of the proposed deep convolution neural network framework.


### 3.1. Image Filtering and Enhancement

In preprocessing after image acquisition, we applied the image enhancement techniques. Sometimes, we needed to remove the noise or filter the image before processing it. The other terms, such as filtering, conditioning, or enhancement, were used for the same purpose. The image contains the structure or signal extracts to differentiate the interesting and uninteresting region by monitoring the pixel or its local neighborhood. Image processing contains several methods and theories to enhance the image and present the significant notation of the image.


#### 3.1.1. Histogram Visualization

The histogram equalization approach is used to improve the demarcation in image. The histogram visualization formula calculates and displays the frequencies of values in the image dataset as shown in Figure6. The target output image uses all gray values such as z = z1, z = z2, …, z = zn. Each gray level uses approximately q=(Ro∗Co)/n time, where Ro and Co are used for rows and columns of the image. Hin[i] is used for stretching function; Hin[k] is used for the pixel, which has gray level zi. T1 is used for the first gray level threshold, and q1 is used for all pixels of the input image. The Hin is used for stretching function f.(1)∑i=1t1−1Hini≤q1<∑i=0t1Hini,(2)∑i=1tk−1Hink≤q1+q2+q3+⋯+qk,<∑i=0t1Hini.Figure 6
Result of histogram visualization: (a) native image, (b) enhanced image, and (c) curve for histogram equalization.
(a)(b)(c)According to equation (1), t1 is the smallest gray level. The original histogram contains only less than or equal to the gray level value. In equation (2), tk contains the kth threshold.


#### 3.1.2. Gaussian Filtration

The filtration process is used for the sake of blurring the image and removing the noise. Mathematically, Gaussian filtering modifies the input signal by convolution with Gaussian function. During the experiment, we applied the Gaussian low-pass filter and Gaussian high-pass results to produce a significant result, as shown in Figure7 and its graph in Figure 8. Equation (3) works for one-dimensional Gaussian function, and equation (4) works for two dimensions. The standard deviation of the distribution is assumed to be zero.(3)Gx=12πσ2ε−x22σ2,(4)Gx,y=12πσ2ε−x2+y22σ2.Figure 7
Defective fabric result of the Gaussian filter: (a) low-pass filter and (b) high-pass filter.
(a)(b)Figure 8
(a) Gaussian low-pass filter and (b) Gaussian high-pass filter.
(a)(b)


#### 3.1.3. Fourier Transform Method

The Fourier transform method describes that any signal can be represented by the sum of sine and cosine waves with various frequencies and amplitudes. The two-dimensional Fourier transforms can show the relationship between the uniform fabric structure, regular structure, and repetition in the image space and its spectrum. The Fourier transform function (FTF) is used to monitor and describe the relationship between the regular structure of the fabric and its Fourier spectrum; the faults on the fabric surface can be pointed out if the periodic structure has changed on the Fourier spectrum. Notably, the aforementioned methods are used to analyze the fabric structure in the spectrum domain. The cross-sectional and FFT are utilized to analyze the fabric structure: the wrapped yarn of the fabric appears in the vertical direction and stores the information about its feature as fy1, and the horizontal direction or weft, as fx1. Therefore,(5)K1=F0,0,K2=Ffx1,0,K3=fx1,K4=∑fxi=0fx1Ffxi,0,K5=F0,fy1,K3=fy1,K4=∑fyi=0fy1F0,fyi.Where the feature k1 represents the characteristics of the fabric structure irregularity. Features K2, K3, and K4 are used to detect the change in the wrap or vertical direction, whereas K5, K6, and K7 detect the change in the weft or horizontal direction.The computational time for the FT is generally long: the discrete Fourier transform (DFT) for the two-dimensional is proportional to the second-order of the image. Generally, the fast Fourier transform (FFT) is used to reduce the size of the Fourier transform. If the FFT is one-dimensional, then its computation time is N log2 N. For the two-dimensional FFT, the computation time is 2N2 log2N. In the 2-dimensional image, FFT performs 1D for rows, which converts each row of the image and 1D for columns that convert each column. In Figure9, the results of FFT in different phases are displayed, and its phase spectrum results are presented in Figure 10.Figure 9
Standard fabric defects and their FFT and Fourier spectrum results.Figure 10
Fabric spectrum results after applying fast Fourier transform.
(a)(b)(c)(d)


### 3.2. Edge Detection Techniques

In image edge detection, the defect boundaries or discontinuities within the image are detected by computing the difference in the local image region. First, we implement the detection on one-dimensional: the one-dimensional signal only contains the rows or columns, and in 2D, the rows and columns are computed one by one by first calculating the rows and second the columns of the two-dimensional images. In image processing, edge detection techniques are used to address the target line and ignore the irrelevant information from the image.For this purpose, the image segmentation techniques are used to partition the image into multiple segments. Actually, the object is highlighted in the image when it has a texture or color different from that of the uniform background. The image consists of the number of pixels that have multiple colors in RGB, and the adjacent pixel is different from the other. The edge is detected in those pixels that are significantly different from the others. In image processing, the prominent task to detect the specific region that is different from the background is called image segmentation. There are multiple edge detection techniques in image processing, such as Prewitt edge detector, Sobel edge detector, Canny edge detector, Kirch’s, and log edge detector. The edge detection techniques are used to highlight the defective region. During the experiment, we applied Sobel, Canny, and Prewitt edge detector to point out the fabric defects, and the results are shown in Figure11.Figure 11
Edge detection by different techniques: (a) RGB real image, (b) Gray level image, (c) Rober results, (d) log results, (e) Prewitt results, (f) Sobel results, (g) zero cross results, and (h) Canny results.
(a)(b)(c)(d)(e)(f)(g)(h)The process for classifying the woven fabric fault using digital images through the proposed framework is depicted in Algorithm1.Algorithm 1: Process for woven fabric fault classification.
Input: Fabric images (FI) M [r, c]: set of features.Output: Classification of woven fabric images N [r, c] as defective and nondefective.(1)
Deep learning-based features are extracted.(2)
The classifier is trained with deep learning-based features.Begin(3)
Computer histogram equalization.(4)
Computer Gaussian filtering.(5)
Computer Fourier transform.(6)
Computer edges of the fabric faults after applying the inverse Fourier transform.(7)
Computer deep learning features(8)
for training samples (TestSi, TrainSi) doTrain the classifier(9)
end for(10)
The classification resultsEnd


## 3.1. Image Filtering and Enhancement

In preprocessing after image acquisition, we applied the image enhancement techniques. Sometimes, we needed to remove the noise or filter the image before processing it. The other terms, such as filtering, conditioning, or enhancement, were used for the same purpose. The image contains the structure or signal extracts to differentiate the interesting and uninteresting region by monitoring the pixel or its local neighborhood. Image processing contains several methods and theories to enhance the image and present the significant notation of the image.


### 3.1.1. Histogram Visualization

The histogram equalization approach is used to improve the demarcation in image. The histogram visualization formula calculates and displays the frequencies of values in the image dataset as shown in Figure6. The target output image uses all gray values such as z = z1, z = z2, …, z = zn. Each gray level uses approximately q=(Ro∗Co)/n time, where Ro and Co are used for rows and columns of the image. Hin[i] is used for stretching function; Hin[k] is used for the pixel, which has gray level zi. T1 is used for the first gray level threshold, and q1 is used for all pixels of the input image. The Hin is used for stretching function f.(1)∑i=1t1−1Hini≤q1<∑i=0t1Hini,(2)∑i=1tk−1Hink≤q1+q2+q3+⋯+qk,<∑i=0t1Hini.Figure 6
Result of histogram visualization: (a) native image, (b) enhanced image, and (c) curve for histogram equalization.
(a)(b)(c)According to equation (1), t1 is the smallest gray level. The original histogram contains only less than or equal to the gray level value. In equation (2), tk contains the kth threshold.


### 3.1.2. Gaussian Filtration

The filtration process is used for the sake of blurring the image and removing the noise. Mathematically, Gaussian filtering modifies the input signal by convolution with Gaussian function. During the experiment, we applied the Gaussian low-pass filter and Gaussian high-pass results to produce a significant result, as shown in Figure7 and its graph in Figure 8. Equation (3) works for one-dimensional Gaussian function, and equation (4) works for two dimensions. The standard deviation of the distribution is assumed to be zero.(3)Gx=12πσ2ε−x22σ2,(4)Gx,y=12πσ2ε−x2+y22σ2.Figure 7
Defective fabric result of the Gaussian filter: (a) low-pass filter and (b) high-pass filter.
(a)(b)Figure 8
(a) Gaussian low-pass filter and (b) Gaussian high-pass filter.
(a)(b)


### 3.1.3. Fourier Transform Method

The Fourier transform method describes that any signal can be represented by the sum of sine and cosine waves with various frequencies and amplitudes. The two-dimensional Fourier transforms can show the relationship between the uniform fabric structure, regular structure, and repetition in the image space and its spectrum. The Fourier transform function (FTF) is used to monitor and describe the relationship between the regular structure of the fabric and its Fourier spectrum; the faults on the fabric surface can be pointed out if the periodic structure has changed on the Fourier spectrum. Notably, the aforementioned methods are used to analyze the fabric structure in the spectrum domain. The cross-sectional and FFT are utilized to analyze the fabric structure: the wrapped yarn of the fabric appears in the vertical direction and stores the information about its feature as fy1, and the horizontal direction or weft, as fx1. Therefore,(5)K1=F0,0,K2=Ffx1,0,K3=fx1,K4=∑fxi=0fx1Ffxi,0,K5=F0,fy1,K3=fy1,K4=∑fyi=0fy1F0,fyi.Where the feature k1 represents the characteristics of the fabric structure irregularity. Features K2, K3, and K4 are used to detect the change in the wrap or vertical direction, whereas K5, K6, and K7 detect the change in the weft or horizontal direction.The computational time for the FT is generally long: the discrete Fourier transform (DFT) for the two-dimensional is proportional to the second-order of the image. Generally, the fast Fourier transform (FFT) is used to reduce the size of the Fourier transform. If the FFT is one-dimensional, then its computation time is N log2 N. For the two-dimensional FFT, the computation time is 2N2 log2N. In the 2-dimensional image, FFT performs 1D for rows, which converts each row of the image and 1D for columns that convert each column. In Figure9, the results of FFT in different phases are displayed, and its phase spectrum results are presented in Figure 10.Figure 9
Standard fabric defects and their FFT and Fourier spectrum results.Figure 10
Fabric spectrum results after applying fast Fourier transform.
(a)(b)(c)(d)


## 3.1.1. Histogram Visualization

The histogram equalization approach is used to improve the demarcation in image. The histogram visualization formula calculates and displays the frequencies of values in the image dataset as shown in Figure6. The target output image uses all gray values such as z = z1, z = z2, …, z = zn. Each gray level uses approximately q=(Ro∗Co)/n time, where Ro and Co are used for rows and columns of the image. Hin[i] is used for stretching function; Hin[k] is used for the pixel, which has gray level zi. T1 is used for the first gray level threshold, and q1 is used for all pixels of the input image. The Hin is used for stretching function f.(1)∑i=1t1−1Hini≤q1<∑i=0t1Hini,(2)∑i=1tk−1Hink≤q1+q2+q3+⋯+qk,<∑i=0t1Hini.Figure 6
Result of histogram visualization: (a) native image, (b) enhanced image, and (c) curve for histogram equalization.
(a)(b)(c)According to equation (1), t1 is the smallest gray level. The original histogram contains only less than or equal to the gray level value. In equation (2), tk contains the kth threshold.


## 3.1.2. Gaussian Filtration

The filtration process is used for the sake of blurring the image and removing the noise. Mathematically, Gaussian filtering modifies the input signal by convolution with Gaussian function. During the experiment, we applied the Gaussian low-pass filter and Gaussian high-pass results to produce a significant result, as shown in Figure7 and its graph in Figure 8. Equation (3) works for one-dimensional Gaussian function, and equation (4) works for two dimensions. The standard deviation of the distribution is assumed to be zero.(3)Gx=12πσ2ε−x22σ2,(4)Gx,y=12πσ2ε−x2+y22σ2.Figure 7
Defective fabric result of the Gaussian filter: (a) low-pass filter and (b) high-pass filter.
(a)(b)Figure 8
(a) Gaussian low-pass filter and (b) Gaussian high-pass filter.
(a)(b)


## 3.1.3. Fourier Transform Method

The Fourier transform method describes that any signal can be represented by the sum of sine and cosine waves with various frequencies and amplitudes. The two-dimensional Fourier transforms can show the relationship between the uniform fabric structure, regular structure, and repetition in the image space and its spectrum. The Fourier transform function (FTF) is used to monitor and describe the relationship between the regular structure of the fabric and its Fourier spectrum; the faults on the fabric surface can be pointed out if the periodic structure has changed on the Fourier spectrum. Notably, the aforementioned methods are used to analyze the fabric structure in the spectrum domain. The cross-sectional and FFT are utilized to analyze the fabric structure: the wrapped yarn of the fabric appears in the vertical direction and stores the information about its feature as fy1, and the horizontal direction or weft, as fx1. Therefore,(5)K1=F0,0,K2=Ffx1,0,K3=fx1,K4=∑fxi=0fx1Ffxi,0,K5=F0,fy1,K3=fy1,K4=∑fyi=0fy1F0,fyi.Where the feature k1 represents the characteristics of the fabric structure irregularity. Features K2, K3, and K4 are used to detect the change in the wrap or vertical direction, whereas K5, K6, and K7 detect the change in the weft or horizontal direction.The computational time for the FT is generally long: the discrete Fourier transform (DFT) for the two-dimensional is proportional to the second-order of the image. Generally, the fast Fourier transform (FFT) is used to reduce the size of the Fourier transform. If the FFT is one-dimensional, then its computation time is N log2 N. For the two-dimensional FFT, the computation time is 2N2 log2N. In the 2-dimensional image, FFT performs 1D for rows, which converts each row of the image and 1D for columns that convert each column. In Figure9, the results of FFT in different phases are displayed, and its phase spectrum results are presented in Figure 10.Figure 9
Standard fabric defects and their FFT and Fourier spectrum results.Figure 10
Fabric spectrum results after applying fast Fourier transform.
(a)(b)(c)(d)


## 3.2. Edge Detection Techniques

In image edge detection, the defect boundaries or discontinuities within the image are detected by computing the difference in the local image region. First, we implement the detection on one-dimensional: the one-dimensional signal only contains the rows or columns, and in 2D, the rows and columns are computed one by one by first calculating the rows and second the columns of the two-dimensional images. In image processing, edge detection techniques are used to address the target line and ignore the irrelevant information from the image.For this purpose, the image segmentation techniques are used to partition the image into multiple segments. Actually, the object is highlighted in the image when it has a texture or color different from that of the uniform background. The image consists of the number of pixels that have multiple colors in RGB, and the adjacent pixel is different from the other. The edge is detected in those pixels that are significantly different from the others. In image processing, the prominent task to detect the specific region that is different from the background is called image segmentation. There are multiple edge detection techniques in image processing, such as Prewitt edge detector, Sobel edge detector, Canny edge detector, Kirch’s, and log edge detector. The edge detection techniques are used to highlight the defective region. During the experiment, we applied Sobel, Canny, and Prewitt edge detector to point out the fabric defects, and the results are shown in Figure11.Figure 11
Edge detection by different techniques: (a) RGB real image, (b) Gray level image, (c) Rober results, (d) log results, (e) Prewitt results, (f) Sobel results, (g) zero cross results, and (h) Canny results.
(a)(b)(c)(d)(e)(f)(g)(h)The process for classifying the woven fabric fault using digital images through the proposed framework is depicted in Algorithm1.Algorithm 1: Process for woven fabric fault classification.
Input: Fabric images (FI) M [r, c]: set of features.Output: Classification of woven fabric images N [r, c] as defective and nondefective.(1)
Deep learning-based features are extracted.(2)
The classifier is trained with deep learning-based features.Begin(3)
Computer histogram equalization.(4)
Computer Gaussian filtering.(5)
Computer Fourier transform.(6)
Computer edges of the fabric faults after applying the inverse Fourier transform.(7)
Computer deep learning features(8)
for training samples (TestSi, TrainSi) doTrain the classifier(9)
end for(10)
The classification resultsEnd


## 4. Experimental Results

### 4.1. Dataset

For the evaluation of the results, we utilized the TILDA dataset. The entire dataset consists of 3200 images. The dataset is composed of different types of fabric and their defects. The fabric patterned texture is different in this dataset; we evaluated our results using TILDA. The dataset contained several types of flaws, but we considered only some of them as shown in Figure12. The standard TILDA dataset is composed of 24 defects according to the Ministry of Textiles. There was a total of 1550 images of the fabric that were considered. In addition, during the experiment, we split the dataset into 80% and 20% ratios for training and testing. The major ratio was used to train the model, and the remaining dataset was used for testing. However, during the experiment, we change the ratio for training and testing, but using this ratio, we obtained significant results.Figure 12
Six standard defective fabric samples that are considered: (a) hole, (b) spots/dirt, (c) thread defects, (d) darks threads, (e) fload, and (f) switch off.
(a)(b)(c)(d)


### 4.2. Experimental Framework

There are several techniques that were used to check similarities and for classification purposes in the past decades; there are two major techniques used for classification purposes in image processing: the first is to calculate the features and then apply the machine learning techniques that is the domain-based approach that degrades the results when the number of classes increase or the domain changes. The second one is the convolution neural networks (CNNs) that show remarkable performance in the field of image processing [35]. A typical CNN has several building blocks, namely, convolutional, pooling, and fully connected layers. CNN extracts the features automatically instead of relying on the handcrafted features, which used the weights of the network learned from ImageNet. The architecture of the CNN is shown in Figure 13.Figure 13
1D NN architecture: (a) auto encode, (b) Boltzmann machine, (c) recurrent NN, (d) CNN, (e) multistream CNN, and (f) DCNN.
(a)(b)(c)(d)(e)(f)


#### 4.2.1. GoogleNet

GoogleNet is architecture of a convolution neural network; GoogleNet is a pretrained deep neural network that has 22 layers, and the inception network is pretrained which can classify the fabric samples into their categories such as defective or defect-free, as well as also label the fabric defect type. In MATLAB, we trained the inception network with several types of defective and defect-free fabric samples. The inspection network for CNN is also called Google brain. GoogleNet is a deep convolution neural network; codename is the inspection network that is state-of-the-art for classification in ImageNet large scale visual recognition challenges 2014 (ILSVRC14). During the training phase, GoogleNet learns rich features and then takes an input image and addresses it to cross-pounding categories. GoogleNet is the deeper network with computational efficiency, which is the ILSVRC 14 classification winner; GoogleNet works with 22 layers that are not fully connected.The proposed model requires less space and provides significant results for classification compared to other state-of-the-art schemes such as VGG and Alexnet. The architecture of GoogleNet is shown in Figure14; GoogleNet requires 5 million parameters, while Alexnet requires 16 million parameters. In this network, three types of filter work such as 1 × 1, 3 × 3 and 5 × 5, and 1 × 1 are used to reduce the size. The inspection network incorporates the same concept in layers as Alexnet and VGG since every layer has all possible filter sets such as 1 × 1, 3 × 3, 5 × 5, and a full convolution network as shown in Figure 4. Therefore, the system has multiple filter sets; the learning of each layer by the back prop is updated on the basis of objective functions; layers of GoogleNet after transfer learning are shown in Figure 15.Figure 14
GoogleNet neural network architecture.Figure 15
Layers of the GoogleNet method after transfer learning.Nowadays, the research trends for classification have shifted toward CNN. In the deep learning framework, the activation function determines the output of a deep learning method that can be expressed as:(6)Fb|a;θ=softmaxa;θ=eZilTx+yil∑m=1meZkFTx+yiF.Here,ZF shows the weights of the output layer. To calculate the value of θ, stochastic gradient is applied. The clustering value of biases and weight with Fx in the i × j dimension. One-dimension CNN with all layers of the network by using different kernels are shown in Figure 13. The weight and biases of CNN are mathematically expressed as:(7)W=w1,w1,w1…wk,B=b1,b1,b1…bk,W′=argMaxMx+B′Ex,B′=argMaxMx+B′W′Kx.M(x) is used to normalize the preprocessing and formation of the feature vector with the equations (2) and (3). The needed features are extracted by using the proposed deep CNN feature extractor for training and testing purposes.We trained the network with the input images having dimensions 512 × 512. The inception network extracts the features and performs other filters to conclude the result of whether the fabric has defects or not. To check the similarities and measure the distance, we used the Euclidean and Manhattan distance formulas. The classification network is modeled with GoogleNet-based convolution neural network architecture to learn the structural fabric features; the systematic view of the proposed deep convolution neural network framework is shown in Figure6. The results are verified by another prominent classifier such as a support vector machine (SVM) or back propagation neural network (BPNN); the results of BPNN and SVM on the same defects are given in Table 2.Table 2
Comparison performance index of the proposed technique with another classifier.
ClassifierHole (%)Spot (%)Thread defect (%)Dark thread (%)Fload (%)Switch off (%)Average (%)SVM92.392.893.291.0693.0693.0592.5BPNN90.0888.0593.0591.0687.0886.989.4Proposed deep CNN93.3693.0294.3593.6996.3596.0194.46


### 4.3. Evaluation Metrics

There are different metrics that are used for defect inspection, detection rate (DR), detection accuracy (Dacc), false alarm rate (FR), recall (R), and precision (P). For the evaluation of the classification, problems normally used accuracy. It is the ratio of the accurate prediction and total prediction by the system. The obtained quantitative result is given in Table 3 and their graphical representation is presented in Figure 16, to compute the Dr, Fr, and Dacc, we follow the equations (8)–(10).(8)DR=TPNdef∗100%,(9)FR=FPNfree∗100%,(10)Dacc=TP+TNTP+TN+FP+FN∗100%.Table 3
Classification performance of the comparative methods.
SchemesPrecisionRecallF1 measureAccuracyHog-based KNN [36]74.6174.1074.1274.10Walwet-based BPNN [37]86.7286.0085.9881.97Kumar et al. [2]79.379.180.279.7Hu et al. [38]87.487.983.585.7Mak et al. [39]82.678.083.580.8Hu et al. [40]75.571.487.979.7Purposed CNN83.6683.583.5694.46Figure 16
Classwise comparison with respect to precision, recall, and F score.In equation (10), Ndef refers to the number of defective samples and Nfree refers to the nondefective samples, and the TP and FP are the ratios of defective samples that are detected as defective or defect-free. The TN and FN are the ratios of nondefective samples that are labeled as defect-free after the evaluation. Pixel-level metric evaluates the inspection accuracy to predict the accuracy by measuring the predicted pixel. TP true positive refers to the foreground defective segmented area, and FP false positive background area refers to areas that were defective but not detected as shown in Figure 17. To calculate the precision, recall, and metrics measure, we used the equations (11)–(13) [41, 42], and their obtained results are given in Table 4, and graphical representation is given in Figure 16. The result compared with other techniques is given in Table 3, and graphical representation is given in Figure 18.(11)R=TPpTPp+FNp∗100%,(12)P=TPpTPp+FPp∗100%,(13)Metrics Measure=2P.RP+R∗100%.Here, R is recall, P is precision, and the metrics measure indicates F1 measure.Figure 17
TNp, FNp, TPp, and FPp indicators.Table 4
Performance evaluation of our proposed model.
ClassesDefectsAccuracy (%)PrecisionRecallF1 score1Hole93.360.800.800.802Spot93.020.820.770.803Thread defects94.350.800.880.844Dark thread93.690.780.860.825Fload96.350.910.860.886Switch off96.010.910.840.87Figure 18
Overall comparison with respect to precision, recall, F measure, and accuracy with other methods.In this work, we also compared the results with the SVM and BPNN models and its results in Table2, and the graph is presented in Figure 18. A significant difference is observed by using the proposed model. As given in Tables 3 and 2, we can conclude that the proposed method only obtained a classification accuracy of 94.46%, while the other relevant schemes obtain less than that of the proposed scheme. Therefore, on the basis of obtained results, we can say that the proposed model based on GoogleNet architecture is a robust woven fabric classification CNN that is able to extract texture features for recognition and classification.


## 4.1. Dataset

For the evaluation of the results, we utilized the TILDA dataset. The entire dataset consists of 3200 images. The dataset is composed of different types of fabric and their defects. The fabric patterned texture is different in this dataset; we evaluated our results using TILDA. The dataset contained several types of flaws, but we considered only some of them as shown in Figure12. The standard TILDA dataset is composed of 24 defects according to the Ministry of Textiles. There was a total of 1550 images of the fabric that were considered. In addition, during the experiment, we split the dataset into 80% and 20% ratios for training and testing. The major ratio was used to train the model, and the remaining dataset was used for testing. However, during the experiment, we change the ratio for training and testing, but using this ratio, we obtained significant results.Figure 12
Six standard defective fabric samples that are considered: (a) hole, (b) spots/dirt, (c) thread defects, (d) darks threads, (e) fload, and (f) switch off.
(a)(b)(c)(d)


## 4.2. Experimental Framework

There are several techniques that were used to check similarities and for classification purposes in the past decades; there are two major techniques used for classification purposes in image processing: the first is to calculate the features and then apply the machine learning techniques that is the domain-based approach that degrades the results when the number of classes increase or the domain changes. The second one is the convolution neural networks (CNNs) that show remarkable performance in the field of image processing [35]. A typical CNN has several building blocks, namely, convolutional, pooling, and fully connected layers. CNN extracts the features automatically instead of relying on the handcrafted features, which used the weights of the network learned from ImageNet. The architecture of the CNN is shown in Figure 13.Figure 13
1D NN architecture: (a) auto encode, (b) Boltzmann machine, (c) recurrent NN, (d) CNN, (e) multistream CNN, and (f) DCNN.
(a)(b)(c)(d)(e)(f)


### 4.2.1. GoogleNet

GoogleNet is architecture of a convolution neural network; GoogleNet is a pretrained deep neural network that has 22 layers, and the inception network is pretrained which can classify the fabric samples into their categories such as defective or defect-free, as well as also label the fabric defect type. In MATLAB, we trained the inception network with several types of defective and defect-free fabric samples. The inspection network for CNN is also called Google brain. GoogleNet is a deep convolution neural network; codename is the inspection network that is state-of-the-art for classification in ImageNet large scale visual recognition challenges 2014 (ILSVRC14). During the training phase, GoogleNet learns rich features and then takes an input image and addresses it to cross-pounding categories. GoogleNet is the deeper network with computational efficiency, which is the ILSVRC 14 classification winner; GoogleNet works with 22 layers that are not fully connected.The proposed model requires less space and provides significant results for classification compared to other state-of-the-art schemes such as VGG and Alexnet. The architecture of GoogleNet is shown in Figure14; GoogleNet requires 5 million parameters, while Alexnet requires 16 million parameters. In this network, three types of filter work such as 1 × 1, 3 × 3 and 5 × 5, and 1 × 1 are used to reduce the size. The inspection network incorporates the same concept in layers as Alexnet and VGG since every layer has all possible filter sets such as 1 × 1, 3 × 3, 5 × 5, and a full convolution network as shown in Figure 4. Therefore, the system has multiple filter sets; the learning of each layer by the back prop is updated on the basis of objective functions; layers of GoogleNet after transfer learning are shown in Figure 15.Figure 14
GoogleNet neural network architecture.Figure 15
Layers of the GoogleNet method after transfer learning.Nowadays, the research trends for classification have shifted toward CNN. In the deep learning framework, the activation function determines the output of a deep learning method that can be expressed as:(6)Fb|a;θ=softmaxa;θ=eZilTx+yil∑m=1meZkFTx+yiF.Here,ZF shows the weights of the output layer. To calculate the value of θ, stochastic gradient is applied. The clustering value of biases and weight with Fx in the i × j dimension. One-dimension CNN with all layers of the network by using different kernels are shown in Figure 13. The weight and biases of CNN are mathematically expressed as:(7)W=w1,w1,w1…wk,B=b1,b1,b1…bk,W′=argMaxMx+B′Ex,B′=argMaxMx+B′W′Kx.M(x) is used to normalize the preprocessing and formation of the feature vector with the equations (2) and (3). The needed features are extracted by using the proposed deep CNN feature extractor for training and testing purposes.We trained the network with the input images having dimensions 512 × 512. The inception network extracts the features and performs other filters to conclude the result of whether the fabric has defects or not. To check the similarities and measure the distance, we used the Euclidean and Manhattan distance formulas. The classification network is modeled with GoogleNet-based convolution neural network architecture to learn the structural fabric features; the systematic view of the proposed deep convolution neural network framework is shown in Figure6. The results are verified by another prominent classifier such as a support vector machine (SVM) or back propagation neural network (BPNN); the results of BPNN and SVM on the same defects are given in Table 2.Table 2
Comparison performance index of the proposed technique with another classifier.
ClassifierHole (%)Spot (%)Thread defect (%)Dark thread (%)Fload (%)Switch off (%)Average (%)SVM92.392.893.291.0693.0693.0592.5BPNN90.0888.0593.0591.0687.0886.989.4Proposed deep CNN93.3693.0294.3593.6996.3596.0194.46


## 4.2.1. GoogleNet

GoogleNet is architecture of a convolution neural network; GoogleNet is a pretrained deep neural network that has 22 layers, and the inception network is pretrained which can classify the fabric samples into their categories such as defective or defect-free, as well as also label the fabric defect type. In MATLAB, we trained the inception network with several types of defective and defect-free fabric samples. The inspection network for CNN is also called Google brain. GoogleNet is a deep convolution neural network; codename is the inspection network that is state-of-the-art for classification in ImageNet large scale visual recognition challenges 2014 (ILSVRC14). During the training phase, GoogleNet learns rich features and then takes an input image and addresses it to cross-pounding categories. GoogleNet is the deeper network with computational efficiency, which is the ILSVRC 14 classification winner; GoogleNet works with 22 layers that are not fully connected.The proposed model requires less space and provides significant results for classification compared to other state-of-the-art schemes such as VGG and Alexnet. The architecture of GoogleNet is shown in Figure14; GoogleNet requires 5 million parameters, while Alexnet requires 16 million parameters. In this network, three types of filter work such as 1 × 1, 3 × 3 and 5 × 5, and 1 × 1 are used to reduce the size. The inspection network incorporates the same concept in layers as Alexnet and VGG since every layer has all possible filter sets such as 1 × 1, 3 × 3, 5 × 5, and a full convolution network as shown in Figure 4. Therefore, the system has multiple filter sets; the learning of each layer by the back prop is updated on the basis of objective functions; layers of GoogleNet after transfer learning are shown in Figure 15.Figure 14
GoogleNet neural network architecture.Figure 15
Layers of the GoogleNet method after transfer learning.Nowadays, the research trends for classification have shifted toward CNN. In the deep learning framework, the activation function determines the output of a deep learning method that can be expressed as:(6)Fb|a;θ=softmaxa;θ=eZilTx+yil∑m=1meZkFTx+yiF.Here,ZF shows the weights of the output layer. To calculate the value of θ, stochastic gradient is applied. The clustering value of biases and weight with Fx in the i × j dimension. One-dimension CNN with all layers of the network by using different kernels are shown in Figure 13. The weight and biases of CNN are mathematically expressed as:(7)W=w1,w1,w1…wk,B=b1,b1,b1…bk,W′=argMaxMx+B′Ex,B′=argMaxMx+B′W′Kx.M(x) is used to normalize the preprocessing and formation of the feature vector with the equations (2) and (3). The needed features are extracted by using the proposed deep CNN feature extractor for training and testing purposes.We trained the network with the input images having dimensions 512 × 512. The inception network extracts the features and performs other filters to conclude the result of whether the fabric has defects or not. To check the similarities and measure the distance, we used the Euclidean and Manhattan distance formulas. The classification network is modeled with GoogleNet-based convolution neural network architecture to learn the structural fabric features; the systematic view of the proposed deep convolution neural network framework is shown in Figure6. The results are verified by another prominent classifier such as a support vector machine (SVM) or back propagation neural network (BPNN); the results of BPNN and SVM on the same defects are given in Table 2.Table 2
Comparison performance index of the proposed technique with another classifier.
ClassifierHole (%)Spot (%)Thread defect (%)Dark thread (%)Fload (%)Switch off (%)Average (%)SVM92.392.893.291.0693.0693.0592.5BPNN90.0888.0593.0591.0687.0886.989.4Proposed deep CNN93.3693.0294.3593.6996.3596.0194.46


## 4.3. Evaluation Metrics

There are different metrics that are used for defect inspection, detection rate (DR), detection accuracy (Dacc), false alarm rate (FR), recall (R), and precision (P). For the evaluation of the classification, problems normally used accuracy. It is the ratio of the accurate prediction and total prediction by the system. The obtained quantitative result is given in Table 3 and their graphical representation is presented in Figure 16, to compute the Dr, Fr, and Dacc, we follow the equations (8)–(10).(8)DR=TPNdef∗100%,(9)FR=FPNfree∗100%,(10)Dacc=TP+TNTP+TN+FP+FN∗100%.Table 3
Classification performance of the comparative methods.
SchemesPrecisionRecallF1 measureAccuracyHog-based KNN [36]74.6174.1074.1274.10Walwet-based BPNN [37]86.7286.0085.9881.97Kumar et al. [2]79.379.180.279.7Hu et al. [38]87.487.983.585.7Mak et al. [39]82.678.083.580.8Hu et al. [40]75.571.487.979.7Purposed CNN83.6683.583.5694.46Figure 16
Classwise comparison with respect to precision, recall, and F score.In equation (10), Ndef refers to the number of defective samples and Nfree refers to the nondefective samples, and the TP and FP are the ratios of defective samples that are detected as defective or defect-free. The TN and FN are the ratios of nondefective samples that are labeled as defect-free after the evaluation. Pixel-level metric evaluates the inspection accuracy to predict the accuracy by measuring the predicted pixel. TP true positive refers to the foreground defective segmented area, and FP false positive background area refers to areas that were defective but not detected as shown in Figure 17. To calculate the precision, recall, and metrics measure, we used the equations (11)–(13) [41, 42], and their obtained results are given in Table 4, and graphical representation is given in Figure 16. The result compared with other techniques is given in Table 3, and graphical representation is given in Figure 18.(11)R=TPpTPp+FNp∗100%,(12)P=TPpTPp+FPp∗100%,(13)Metrics Measure=2P.RP+R∗100%.Here, R is recall, P is precision, and the metrics measure indicates F1 measure.Figure 17
TNp, FNp, TPp, and FPp indicators.Table 4
Performance evaluation of our proposed model.
ClassesDefectsAccuracy (%)PrecisionRecallF1 score1Hole93.360.800.800.802Spot93.020.820.770.803Thread defects94.350.800.880.844Dark thread93.690.780.860.825Fload96.350.910.860.886Switch off96.010.910.840.87Figure 18
Overall comparison with respect to precision, recall, F measure, and accuracy with other methods.In this work, we also compared the results with the SVM and BPNN models and its results in Table2, and the graph is presented in Figure 18. A significant difference is observed by using the proposed model. As given in Tables 3 and 2, we can conclude that the proposed method only obtained a classification accuracy of 94.46%, while the other relevant schemes obtain less than that of the proposed scheme. Therefore, on the basis of obtained results, we can say that the proposed model based on GoogleNet architecture is a robust woven fabric classification CNN that is able to extract texture features for recognition and classification.


## 5. Discussion

The GoogleNet pretrained CNN architecture is used for the classification of the defective woven fabric images, divided into six classes such as hole, spot, dark thread, thread defect, fload, and switch off. In this work, we used 80% data for the training of the model and 20% for the validation of the model. Among the several types of defects, six major defects in fabrics are considered, as shown in Figure12. The experiments exhibit that the classifier performed well for distinguishing the defective and nondefective fabric; the obtained accuracy is given in Table 4 and the graphical representation is given in Figure 16. The presented technique is also compared with other techniques in the literature for fabric defect classification. The obtained results of the mentioned defects and their accuracy, precision, recall, and F1 measure are given in Table 3, and the graphical representation is given in Figure 18. After comparing the overall results, it is concluded that the purposed technique utilizing a deep neural network provides accurate results as compared to other schemes, with an overall average accuracy of 94.46%.


## 6. Conclusion

In this article, we have presented computer-based fabric classification to address whether the fabric is defective or nondefective on the basis of fabric features of various shapes, sizes, and locations. Major woven fabric has been used for fabric material. The proposed deep neural network architecture utilized supervised learning to address the defective and defect-free fabrics. It is a deep neural architecture-based system that is trained by getting the fabric features to classify a large amount of fabric, such as woven fabric, single warp, double wrap, and double knit fabrics. Our proposed network does the following: (1) provides a more accurate result and has a low false alarm than other state-of-the-art schemes. (2) According to the experiment result for the complex patterned fabric we achieved an average accuracy of 94.46%. (3) The proposed scheme shows more robustness for different types of patterned fabrics. (4) The convolution neural network significantly differentiates between the defective or nondefective fabric. In future work, we intend to analyze fabric defects using fuzzy-based algorithms in combination with deep neural networks. The fuzzy analysis represents methods for solving problems related to uncertainty and vagueness. To improve the results, it has been employed in multiple applications of science and engineering [43–51].



---

*Source: 2573805-2022-08-27.xml*