1 Introduction

In the manufacturing process, defect prediction is highly important to quality control [14]. In the fabric field, defect detection becomes an important task due to the widely used material in daily life. In the garment industry nearly 85% of the defects are found [2, 21, 32, 33]. On the fabric surface location, type and size of the defects are found for fabric defect perception. Customarily, defects are detected by human eyes. The productivity of this manual strategy is low and the missed rate is high because of eye exhaustion [1, 3]. Also, determination of defects in words of efficiency, accuracy, and consistency the human inspection fails since workers are subject to languor and thus inaccurate, uncertain inspection results are often existed [19, 27, 34]. The production and quality of the fabric was raised by an efficient automated system [15]. So to detect the defect during the production process an automated inspection was carried out.

The fabric cost reduction is a few advantages and makes it fit in global competition the automatic inspection is used. The foreign swap was saved by fabric inspection systems that utilize manufacturing of indigenous image processing hardware [31]. The circumstance of accidents in hostile mill environment was diminished by automatic inspection systems primarily in weaving mall, since it has very large humidity and temperature [11, 18]. One of the representation forms of fabric surfaces is two-dimensional (2D) textures that was analyzed and find defects through Computer vision based methods [26]. The regular band based methodology [28], Gabor wavelet filter methodology [12], methodology of wavelet-texture analysis and LVQ neural network [29], artificial neural network [20], Sparse representation [17] are some approaches of texture investigation.

A recent pattern-texture driven analysis process is regular band. From the intuition of periodic synchronization this process were established. The modifications of fragmented end or dense bar that are simply known as pixel intensities, with the aid of these intensities this process detect the defects [28]. In Gabor wavelet filter system, basins on domes are the shape of deficiency. Alternatively determining the threshold, the domes or basins are easily detected on the surface for the measurement of defects [12]. In silk fabric, this method was assisted to finding the 7 diverse classifications of defects. For other textured material like as steel, wood etc. this detection process is also aid [29]. Directly using wavelet coefficients in Wavelet-Texture Analysis and learning vector quantization (LVQ) Neural Network, two drive cantered attributes are detached. Using generalized Gaussian density (GGD) model with maximum likelihood (ML) predictor the identical features such as size and shape variables are projected [20, 29]. Artificial neural network (ANN) system basically takes 6 types of defects as sample and takes the fabric without defect so as to found the defects placing rate [20]. In gray-level uniform textures this method acquired best results. But this process not good at textures pattern and many defects are not analysed by this approach [6, 33].

In this paper, we propose the fabric defect detection technique with a combination of feature extraction and classification techniques. The task of an automated detection method can be split into a sequence of processing stages such as image acquisition and preprocessing, feature extraction, and classification. Initially, the preprocessing is done before extracting features, to make texture invariant to translation, rotation and scaling. There are numerous methodologies for feature extraction, however they are computational costly. So in this work we combined gray-level co-occurrence matrix (GLCM) and the Gabor wavelet for the texture feature extraction. By GLCM model the spatial space extracted the global region of the image and in the frequency domain by the Gabor wavelet model the multi-scale and multi-directional local information are extracted. Finally, the feature vector comprises of features, which is fed to RDF classifier for fabric defect detection. The remaining section of the paper is organized as follows; Introduction part includes in the Sect. 1 and brief review of the recent research works is depicted in Sect. 2. The proposed method is introduced in Sect. 3. The performance evaluations are in Sect. 4 and finally, the paper concludes in Sect. 5.

2 Related Works

Hanbay et al. [6] have presented a fabric defect detection methods based on exhaustive literature review. In short, initially it explains the basic image acquisition system for such components like as camera and lens. Hybrid, spectral, structural, learning, statistical, model-based, and comparison studies are the seven classes of defect detection method classification. According to norms such as, reliability, accuracy, the computational cost, rotating/scaling invariant, online/offline ability to operate and noise sensitivity their methods are evaluated. Their review comparatively emphasized the strengths and weaknesses of each approach. In addition, the research is done in weaving and knitting in machines for the availability of utilizing methods. In textile and computer vision, the obtainable review studies do not provide adequate information about fabric defect detection systems for readers engaged in research. A set of examination for efficient construction of image acquisition system are added. In mathematical analysis, selection of lens and light source are expressed.

Hanmandlu et al. [7] have explored the approaches such as Gabor filter, Gabor wavelet and Gauss Markov random field (MRF) that are used for characterization of the fabric textures. They also presented a well-known method for surface roughness determination in the mechanical engineering called topology. The fractal parameters such as topology and fractal dimension are not only denoting the roughness but in fabric textures it also affine self-similarity. For testing process of fabric texture features torn fabric, oil stain, miss pick and interlacing of two webs, collected from the cloth mills of Berhampur are the four types of defective fabric database samples. In performance analysis, the comparison result of fabric defect detection indicates that the topology fractal dimension features perform better than those of Gabor wavelets, Gabor filter and Gauss MRF.

An automated defect inspection method was introduced by Jia and Liang [9]. This method rectifies the fabric image and makes none-overlapped sub-images with aid of segmentation which are called lattices. Instead of millions of unrelated pixels, the image was represented by hundreds of lattices partitioning some common features. Comparing the lattice similarity based on the common features and identifying the defective lattices as the outliers in the feature space transformed in the defect inspection problem. In performance analysis, the databases of images containing fabric patterns arranged orthogonally and arbitrarily are evaluated by isotropic lattice segmentation (ILS).

In Jia et al. [8] presented method compares the equivalence of semantic sub-images conformed to crystallographic groups called lattice. Based on the morphological component analysis (MCA) the lattices are automatically segmented. By the help of novel-voting procedure the defect inspection was formulated and it is depending on an ideal lattice artificially generated by investigating the distributions of responses given by convolving lattices with Gabor filters. Using the databases of star- and box-pattern images the performance of their approach LSG (lattice segmentation assisted by Gabor filters) was evaluated.

Kwon et al. [13] have demonstrated usage of pixel intensities which contains simple variance profile values and implementing it to the random-forest-based machine learning algorithm. To amplify the irregularity of intensity variations and describe the texture of an object surface, variance of variance (VOV) profiles are used. In several types of surface and defect the feature amplification property of that method can be executed. A defect-size insensitive approach and a hard sample retraining method are illustrated for effective learning and degradation of false detection. In experimental results, we can know that for various surface types in reliable defect detection utilizing same parameters.

Susan and Sharma [23] have introduced a new unsupervised, automated texture defect detection method. Their approach does not require any user-inputs and yields high accuracy at the same time. Through a sliding window approach, to achieve this end they have used the non-extensive entropy with Gaussian gain as the regularity index computed locally from texture patches. By the process of modeling the entropy values by a two-mode Gaussian mixture model and checking for the minimum entropy of the model probabilities the optimum window size was calculated. The outlier entropy values corresponding to defective areas are defined as those that exceed thrice the standard deviation as was the form in statistics.

A new texture description algorithm was designed by Tao et al. [25]. Their approach uses local multi-channels Gabor comprehensive patterns (LMGCP) and its motivation was to find richer and discriminant texture measurement and treat in local Gabor feature vector for the high dimension problem. Initially, multi-orientation Gabor filters are used to sample image filtering. To extracting corresponding local Gabor magnitude map (LGMM) they filtered with multi-scale. To assess the link between the referenced pixel and its neighbours by encoding gray-level difference based on 0°, 45°, 90°, 135°, 180°, 225°, 270°, 315° high orders direction derivatives patterns (DDP) and direction magnitude patterns (DMP), the local comprehensive patterns (LCP) were used. Finally, the local Gabor feature vector dimensions was larger, so the LGMM were changed by LCP named by LMGCP, which were concatenated into and feature vector. Simulated experiments and comparisons on subsets of Yale B and CMUPIE face databases under ideal condition, different illumination condition, different facial expression and partial occlusion show that the proposed algorithm is an outstanding method better than the existing methods.

3 Description of Proposed Method

This paper proposes the fabric defect detection technique with a combination of feature extraction and classification techniques. The proposed approach incorporates the following methods such as data acquisition, pre-processing, feature extraction and classification. Here, the input fabric images is classified as defect-free or defective by utilizing the combined feature with efficient machine learning approach named as RDF classifier. Initially, the image acquisition process is done with the help of line scan cameras. Here, the texture is the most important feature in the fabric defect detection and these features are extracted by with the two fusion methods namely, GLCM and the Gabor wavelet filter after pre-processing. After extracting the valuable features the classification is performed by the RDF classifier. The following Fig. 1 shows the overall system description of the proposed method.

Fig. 1
figure 1

Overall system description of the fabric defect detection method

3.1 Image Acquisition Process

The high-quality image selection is a very critical process in the loom fabric image acquisition. In this process, the camera selection is the very important issue. For the fabric defect prediction process, there are two types of cameras named as area scan and the line scan cameras are utilized. The area scan camera is obtaining the static fabric images, however, the image obtained speed is very low and also it captured very blurred fabric images. While the images of the moving fabric surfaces are gathered in the form of lines by the line scan cameras at high speeds and this camera provides the accurate image of the moving fabrics. The blurred image occurred by the area scan camera is eliminated by the line scan cameras. So, the line scan camera plays a major role in the fabric image acquisition process.

3.2 Pre-processing of Fabric Images

In the image processing, the image acquisition, pre-processing, feature extraction before classification is the important phases. The pre-processing is the pivotal and the effective problem in the image enhancement. In this research, initially the obtained RGB color scale fabric image (32 × 32) with defect (size of 8 × 8) is changed to grayscale image of 256 gray levels by grayscale conversion process. The feature values of the input images are enhanced, normalized and denoised by this pre-processing approach. During acquisition process the fabric images might be contaminated with noise. From the fabric image to expel the noise an effective noise expulsion strategy like adaptive median filter (AMF) is connected and it saves the information of source image. Furthermore, to improve the contrast of fabric surface, the histogram equalization is applied. Due to this reason, the quality of the fabric image is improved and also the contrast of the image is enhanced effectively. The uneven backgrounds are also eliminated by utilizing this process. The pre-processed images of the various kinds of defects in fabrics are shown in Fig. 2.

Fig. 2
figure 2

Pre-processed images of the various kinds of defects in the fabrics

3.3 Feature Extraction

The various kinds of defects such as holes and cuts, oil corners and colour errors, thread error, foreign body on the tissue, wrinkles in the tissue, changed lightning conditions, the distortion due to camera tilt and change presented in the fabrics or the information about the intensity of the fabric is detected by the texture analysis. The texture analysis is the quantitative process and the structural abnormalities in the various types of fabrics are detected and quantified by the texture analysis. The fault tissues presented in the fabrics are very difficult to classify using the intensity level of the information. For further enhanced the classification results, the texture feature extraction plays a major role. By measuring some textural features, the original datasets are reduced by the feature extraction process. In the proposed method, the GLCM and the Gabor wavelet transform is conferred to gathered the textures features from the pre-processed fabric images. The construction of GLCM is shown in Fig. 3.

Fig. 3
figure 3

Construction of GLCM a example of gray level image, b co-occurrence matrix generation, c texture of an image with offset varying in distance and orientation

3.3.1 Texture Feature Extraction Using GLCM

In this work, with the gray level co-occurrence matrix in the spatial space that has a better processing outcome on the global region of images. Initially, the pre-processed image is altered into blocks by blocks. Computation of the co-occurrence matrix of GLCM is affected by the two parameters. They are; the pixel distance \( D_{p} \) and position angle \( \theta_{p} \) of the two pixels \( (a,b) \) and \( (x,y) \). There are four directions for the position angle: \( \theta_{p} = 0^\circ \) represents the horizontal position; \( \theta_{p} = 90^\circ \) represents the vertical position; \( \theta_{p} = 45^\circ \) represents the right diagonal position; \( \theta_{p} = 135^\circ \) represents the left diagonal position. Here, the offset parameters are denoted as \( [0\,\,D_{p} ,\,\, - D_{p} \,\,D_{p} ,\,\,\, - D_{p} \,\,0,\,\,\, - D_{p} \,\, - D_{p} ] \). The GLCM feature vector is affected by this offset parameters and another parameter affects the feature vector is the gray level number in the GLCM. The size of GLCM is represented by this parameter and also the classification performance is influenced by this parameter.

After extracting the co-occurrence from the images, the values in the matrices are normalized. After the normalization procedure, the co-occurrence matrix is given as takes after.

$$ C_{ij} = \frac{{\delta_{ij} }}{{\sum\nolimits_{i = 0}^{N} {\sum\nolimits_{j = 0}^{N} {\delta_{ij} } } }} $$
(1)

where i is the gray level along the vertical direction and j is the gray level along the horizontal direction.

In the above-mentioned equation, \( \delta_{ij} \) is the number of occurrences of gray levels within the given window (matrix before the normalization) and \( C_{ij} \) represents the co-occurrence matrix after the normalization. In order to compute the similarity between different GLCM, there are four features are extracted from the normalized co-occurrence matrix \( C_{ij} \) that are an angular second moment, contrast, entropy or correlation, and homogeneity [4, 22].

The angular second-moment (ASM) feature of the image is computed as follows,

$$ ASM = \sum\limits_{i = 0}^{N - 1} {\sum\limits_{j = 0}^{N - 1} {[C_{ij} ]^{2} } } $$
(2)

The contrast (C) feature of the image is computed as follows,

$$ C = \sum\limits_{i = 0}^{j - 1} {N^{2} \left\{ {\sum\limits_{{\left| {i - j} \right| = 0}}^{N - 1} {j = 1\,\sum\limits_{j = 1}^{N - 1} {C_{ij} } } } \right\}} $$
(3)

The entropy (E) or the correlation feature of the image is computed as follows,

$$ E = \frac{{\sum\nolimits_{i = 0}^{N - 1} {\sum\nolimits_{j = 0}^{N - 1} {i,jC_{ij} - \mu_{x} (C_{ij} )\mu_{y} (C_{ij} )} } }}{{\sigma_{x} (C_{ij} )\sigma_{y} (C_{ij} )}} $$
(4)

where the mean of the image is computed as follows,

$$ \mu_{x} = \sum\limits_{i = 0}^{N - 1} {\sum\limits_{j = 0}^{N - 1} {iC_{ij} } } $$
(5)
$$ \mu_{y} = \sum\limits_{i = 0}^{N - 1} {\sum\limits_{j = 0}^{N - 1} {jC_{ij} } } $$
(6)

The computation of standard deviation of image is,

$$ \sigma_{x} = \sum\limits_{i = 0}^{N - 1} {\sum\limits_{j = 0}^{N - 1} {(1 - \mu_{x} )^{2} C_{ij} } } $$
(7)
$$ \sigma_{y} = \sum\limits_{i = 0}^{N - 1} {\sum\limits_{j = 0}^{N - 1} {(1 - \mu_{y} )^{2} C_{ij} } } $$
(8)

The homogeneity (H) feature of the image is computed as follows,

$$ H = \sum\limits_{i = 0}^{N - 1} {\sum\limits_{j = 0}^{N - 1} {\frac{{C_{ij} }}{{1 + \left| {i - j} \right|}}} } $$
(9)

where \( N \)—dimension of the digital image, \( C_{ij} \)—probability distribution matrix of co-occurrence matrix \( \delta (i,j;D_{p} ,\theta_{p} ) \), \( \mu_{x} ,\mu_{y} \) represents the mean of the image and \( \sigma_{x} ,\sigma_{y} \) represents the standard deviation of the image, and \( i,j \)—coordinates of the co-occurrence matrix space. The above mentioned four features such as contrast, homogeneity, Angular Second Moment and correlation are extracted by using this GLCM method, and it will increase the classification performance.

3.3.2 Gabor Wavelet for Texture Feature Extraction

In the frequency domain, Gabor wavelet has outstanding performance in obtaining multi-scale, multi-direction local information. The consolidation of GLCM and Gabor wavelet are utilized to extract texture features of fabric images. Here, to extracts texture features by using the Gabor wavelet, initially, the Gabor function is estimated for the image and it is computed as follows,

$$ G(p,q) = \left( {\frac{1}{{2\pi \sigma_{p} \sigma_{q} }}} \right)\exp \left[ { - \frac{1}{2}\left[ {\frac{{p^{2} }}{{\sigma_{p}^{2} }} + \frac{{q^{2} }}{{\sigma_{q}^{2} }}} \right] + j2\pi \chi p} \right] $$
(10)

where the Gaussian major and the minor width are represented as \( \sigma_{p} \) and \( \sigma_{q} \), the modulation frequency is represented as \( \chi \). The Fourier transform of the above equation is computed as follows,

$$ G(a,b) = \exp \left[ { - \frac{1}{2}\left[ {\frac{{(a - \chi )^{2} }}{{\sigma_{a}^{2} }} + \frac{{b^{2} }}{{\sigma_{b}^{2} }}} \right]} \right] $$
(11)

In the above equation, \( \sigma_{a} = \frac{1}{2}\pi \sigma_{p} \) and \( \sigma_{b} = \frac{1}{2}\pi \sigma_{q} \).

For the generating Gabor function, the dilation and rotation are applied by using the following functions. In the Gabor wavelet, the mean and standard deviation is the important features.

$$ \begin{aligned} & G_{MN} (a,b) = x^{ - M} G(a,b),\quad x > 1 \\ & a^{'} = x^{ - M} (a\cos \theta + b\sin \theta ) \\ & b^{'} = x^{ - M} ( - a\sin \theta + b\cos \theta ) \\ \end{aligned} $$
(12)

In this section, the mean and the standard deviation is computed for the each and every feature vector of the images. Here, the texture features are based on the scales and the orientation of the images.

3.4 Defective and Defect-Free Classification Based on RDF Classifier

In this section, the candidate set of extracted features from GLCM and Gabor wavelets are provided as input to the RDF [5]. Here, the defective and the defect-free fabrics are recognized by the trained classifier in classification method. For the defect prediction process the proposed method utilized the RDF classifier and which is an ensemble machine learning technique. When compared with other modeling approaches, the RDFs can deal with both variables (continuous and discrete), it is not overfit as a classifier, and run quickly and efficiently when dealing high number of datasets. The RDFs is performed very well in the large and the small dimensional feature vectors. The proposed work considers only less number of feature vectors, with fewer dimensions. In the research, the fabric surfaces have various types of defects, so the binary classifiers are not suitable to determine the several types of fabrics surfaces. So, proposed work utilized the RDF classifier for the fabric defect detection, because it solves the binary classification problems. The training process of the RDF classification technique is shown in Fig. 4. The input features are properly classified at each node in each and every branch of the tth binary tree. To effectively separate the defects and the defects free fabrics, the threshold value of individual node is related with the already extracted characteristic values. Here, based on the threshold value the entropy of the feature vectors is usually minimized.

Fig. 4
figure 4

Process of the random decision forest

The leaf node is presented in the bottommost layer of the tree. In each leaf node, the class probability is computed based on the rising value of the bin counter during the training process. The number of different fabric classes and the number of bins in each leaf node both are equal. After the training process, the bin count values are normalized to obtain the class probability for each leaf node. During the testing process, for each class in the tree the probability is computed as \( P_{k} (c|f) \) and these probability functions are summed to selects the maximum probability (\( P(c|f) \)). In fabric defect observation, the defect in two classes and defect-free are permitted and it is shown in the Eq. (13).

$$ \begin{aligned} & P(c|f) = \sum\limits_{k = 1}^{n} {P_{k} (c|f),\quad n = \# \,of\;trees} \\ & {\text{If}}\;P(c_{defect} |f) > P(c_{background} |f) \\ \end{aligned} $$
(13)

From Eq. (13), the feature is denoted as f, and c is a predicted class, i.e. it shows a defective fabric otherwise it is a background (defect-free fabric). In the training samples, the common characteristics are differentiated by using the elements of the feature vectors and this is the most crucial tasks in the fabric defect detection. In this work, the texture features vectors are extracted by using the combined feature extraction techniques.

4 Experimental Results

The experiment of this work is implemented using 7 representative errors in the fabric surfaces such as mechanical damage supply, oil corners and colour errors, thread errors, foreign body on the tissue, wrinkles in the tissue, changed lighting conditions, and a distortion due to camera tilt and change. The programs were implemented using MATLAB language.

4.1 Dataset Description

The dataset used in this work is provided by PARTNER textile industry in Tunisia [24]. The dataset comprises of 89 images, of which 13 have no defects and 76 have different texture surrenders. The aggregate databases were bisected into two sets: training dataset (holds samples at 60%) and testing dataset (carrying 40% of the samples).

Table 1 summarizes some fabric defects types used in this study, their definition, and their reasons. The programs were tested by MATLAB language. The dataset contains images of four different classes (C1, C2, C3 and C4); C1 is the very fine or no visible internal structure (Examples are unprinted viscose or silk); C2 is the structure with low variance (Examples are wool or jute); C3 is the clearly visible periodic structure (Examples are printed diamond pattern or curtains); C4 is the printed matter with no discernible periodicity (Examples are Viscose with imprint of flowers of different sizes), which is shown in Fig. 5.

Table 1 The testing accuracy for different blocks conditions using RF
Fig. 5
figure 5

Different classes of datasets a Very fine or no visible internal structure (Class C1), b structure with low variance (Class C2), c clearly visible periodic structure (Class C3), d printed matter with no discernible periodicity (Class C4)

4.2 Performance Detection

By computing the following performance measure for the train set and test set individually the classification algorithm execution is authenticated. The CA (classification accuracy) is as follows: ratio betwixt the whole number of exactly classified test samples and the whole number of trial samples. Generally, detection accuracy, also familiar as detection success rate, is defined as,

$$ CA\,[\% ] = \frac{TP + TN}{TP + TN + FP + FN} \times 100 $$

Here defective and the defect free fabrics are identified by using the following matrix equation,

$$ \begin{aligned} \,\,\,\begin{array}{*{20}c} {\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,Actually\,\,\,defective} & {Actually\,\,\,defect{\text{-}}free} \\ \end{array} \hfill \\ \begin{array}{*{20}c} {Detected\,\,\,as\,\,\,defective} \\ {Detected\,\,\,as\,\,\,defect{\text{-}}free} \\ \end{array} \left[ {\begin{array}{*{20}c} {True\,\,\,positive\,(TP)} & {False\,\,\,positive\,(FP)} \\ {False\,\,\,negative\,(FN)} & {True\,\,\,negative\,(TN)} \\ \end{array} } \right] \hfill \\ \end{aligned} $$

In Table 2, shows that the restriction and classification results of all classifiers in the training and testing processes are presented. The classification accuracy of all features including RDF is shown in Fig. 6. The training and testing phase of RDF including all and selected features is compared with defective blocks, non defective blocks and average. In both phases the non defective blocks have higher classification accuracy than defective. Justifying the effectiveness of deficiency observation, the proposed system is balanced to other respective algorithms like PCA, ICA, VQ, SP, and LBP. With TILDA database [30] of fabric image the data in Table 4 is measured. The comparison result of detection rate for various methods is showed in Table 3.

Table 2 The testing accuracy for different blocks conditions using RF
Fig. 6
figure 6

Classification accuracy of features

Table 3 Comparison of proposed method with previous research

Rates of detection of PCA, ICA and LBP are beneath at 75%, and the presented method is better than other process are shown in Table 4. Since, the existing method shows lower detection rate. The combination of GLCM and Gabor wavelet in images the proposed method exactly describes the texture of fabric and featured the defect position. From the results of comparison we know that the execution of our proposed method overreach other methods and is able to convert each kind of fabric textures sorts.

Table 4 Comparison of detection rate

Table 5 shows the computational complexities of the proposed and existing methods. The following relationships have been identified for the complexity analysis of the algorithms, where the image dimensions are N × M. From the above listed complexities it results that the proposed algorithm has less complexity when compared with PCA and LBP.

Table 5 Comparison of computational complexity

5 Conclusions

In our paper, fabric defect detection algorithm is proposed based on GLCM and Gabor wavelet extraction and RDF classification method. The texture features are extracted to reach the fabric image reconstruction. The input fabric image is classified into defective or non-defective phase using random decision forest classifier. The fabric image and texture was adequately regenerated with the help of algorithm and that region consists of minimal defective. While analysing detection results, the detection of more texture patterns could be applied in our proposed method. The textures of fabric are reconstructed more exactly with falsely detection of minimal defects by the proposed algorithm; it acts much quicker and achieves more reliable result than detection models of dictionary construction.