{'fraction_non_alphanumeric': 0.027393634619202013, 'fraction_numerical': 0.008469529544101104, 'mean_word_length': 4.735863377609109, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Hybrid Method of Textile Defect Detection using GLCM, LBP, SVD and Wavelet Transform

A roll of fabric with defects can have a depreciation of 45 to 65% with respect to the original price. While some commercial solutions exist, automatic fabric defect detection remains an active field of development and research. The goal is to extract the characteristics of the texture of the fabric to detect defects contained using image processing techniques. To date, there is no standard method which ensures the detection of texture defects in fabrics with high precision. In the following work, the use of Singular Value Decomposition (SVD), Local Binary Pattern (LBP) and GrayLevel Co-Occurrence Matrix (GLCM) features of images for the identification of defects in textiles is presented, where the application of techniques for pre-processing is presented, and for the analysis of texture LBP and the GLCM in order to extract features and segmentation is done using SVD approach. This model makes it possible to obtain compact and precise detection of the faulty texture structures. Our method is capable of achieving very precise detection and localization of texture defects in the images of the Fabric-Defect-Inspection-GLSR database, while ensuring a reasonable processing time.


I. INTRODUCTION
The textile sector has undergone changes throughout the years, due to factors such as: demand, globalization, the high number of producers and changes in fashion, which makes this industry a receptive sector to change and in which the innovation proposes improvements in the different processes. The textile industry is the sector of the economy dedicated to the production of fiber, yarn, cloth, clothing and related products. One of the fields in which this industry develops is the weaving process, that is, the conversion of yarn to fabric. The quality control of this product (fabric) is of utmost importance and great economic impact: A roll of fabric with defects can have a depreciation of 45 to 65% compared to the original price [1]. There are textile companies that perform visual inspections of the product after a significant amount of fabric is produced and stored, however, this results in only 70% of defects being detected in a post-manufacturing inspection of this type even with trained inspectors. It is also common to find companies that use an online visual inspection (while the fabric is being generated by the loom), however, operators recognize less than 60% of defects in a fabric two meters wide at a speed of 0.5 m / s [1].
In the process that fiber spinning machines carry out, it is possible that different types of defects may occur that generate tissue failures. Generally, for identification, a person (operator) makes a visual inspection for such defects. Sometimes this type of control is insufficient, because the imperfections are too small and not visible to the naked eye, or because the fatigue of the quality inspector prevents identification. For the automatic inspection of defects, in the market we find different solutions for the textile industry, in which different image processing techniques have been implemented to detect defects. Among the most representative we find [2], [3] and [4] which highlight the capacity of their systems in terms of the width of the fabric examined and the speed that it can pass through its sensors. On the other hand, a wide variety of defect detection solutions based on different concepts have been proposed in the literature, e.g.: Fourier transform [5], Wavelets [6], Local Binary Patterns [7] among others. In any algorithm developed, it is necessary to evaluate the method developed objectively. In the IT field in general, any algorithm produced is evaluated by indicators that change from one context to another. Among these criteria, we can cite complexity, precision, optimal use of resources, etc. In the area of automatic textile inspection, there are no standard criteria for evaluating methods for detecting texture defects. In fact, in each work published in the past, the authors use personalized criteria in order to evaluate their methods. Although these criteria seem theoretically viable, their variety and different customizations do not allow these methods to be compared or evaluated objectively.
In addition, most of the work carried out has been tested on different image databases, which eliminates the possibility of visual comparison of the results of different algorithms. The third problem is the limited expression of the results of a method. Indeed, in several works (e.g. [9]), we note that the data set is limited and there is no reference indicating experiments in paper or electronic appendix. In what follows, we will cite some previous work. In [9], the authors achieved a detection rate of 96%, but the accuracy is poor and the false alarms are very high. We therefore note that the criterion which has been taken into account relates only to defective blocks. The correct detection of healthy blocks was not taken into account. Therefore, false alarms have been ignored as they lead to the loss of the plant due to the fact that healthy tissue is detected as defective. This profoundly influences the decision regarding a final product frame. In addition, the data set used in the work is very small (16 images, 8 of which are flawless and 8 with faults), which is insufficient to evaluate this method. In [10], the authors expressed detection rates of 96%, while in subsequent work [11], indicated rates of 92%. In addition, the evaluation criteria of their algorithms were personalized and changed from one article to another. In fact, in the first works [10], the authors defined a certain precision and the evaluation was expressed in terms of percentage of this criterion. In other works [11,12], this criterion no longer stands. On the other hand, in these works the evaluation is based on the number of blocks not correctly detected in a global set of blocks of an image. Several works in the detection of texture defects have been proposed during the last two decades. However, there are not enough articles that deal specifically with the problem of detecting defects in the textile field. In the works that exist, the evaluation of approaches is not obvious. First of all, there are no common evaluation criteria between these works. Some use the precision of detection [9,10], while others [11,12] use the number of faults detected. These assessments tend to be subjective and do not allow new work to be compared to old work. Furthermore, the application of these methods to different sets of images does not allow them to be compared either. Despite this absence of standardized evaluation criteria, we can note that each class of approach has strengths and weaknesses, which gives the intuition that the combination of several types of approaches can give a hybrid method capable of detect texture defects better.

II. PROPOSED METHODOLOGY
The proposed system is developed in three stages: in the first one, different filtering techniques are analyzed to homogenize the surface of the images; in the second, spatial techniques of texture analysis are studied, and in the third, a segmentation system using SVD for the textile defect detection system. Figure 2 shows the flow diagram for proposed approach. In the process of acquiring the images from the database, the lighting system used allowed the influence of light from the environment in order to simulate an industrial environment, because of this the images show differences in contrast and brightness. To attenuate these variations, different alternatives were sought to stabilize the gray levels in the image.

B. Implemented Texture Analysis Techniques
In a general sense, texture refers to the characteristics and appearance of the surface of a certain object, according to the size, shape, density, arrangement and proportion of the structural elements that constitute it. There are different approaches to extract the information from the image texture. In this paper, one of these approaches is explored, based on the spatial properties of the image and the spatial distribution of tone variations within a group of resolution pixels. Four spatial techniques for the extraction of features are explored, starting from the texture. Below is a brief description of each one.

Filter Based on the Wavelet Transform
The use of a filter based on the wavelet transform is proposed, which seeks to improve the distribution of the gray levels of the surface. A filter is initially made to attenuate high lighting levels using a Daubechies wavelet; In the case of low luminosity levels, the Haar wavelet is used, where the low frequency component is discarded to obtain a level enhancement. Figures 3 (b) and 3 (c) show the output image and the surface image of Figure 3 (a) using this technique.

Gray Level Co-occurrence Matrix (GLCM)
The co-occurrence matrix technique analyzes the repetitions of the distribution of gray levels that are presented in an image, based on the pixel of interest and the adjacent pixel called neighbor; the information collected in this matrix describes the ratio of the pixels in a specific texture condition.
To carry out this analysis, the technique can be defined in the following sequence of steps:  The distance from the pixel of interest to the neighbor.  The angle (Θ) to establish the analysis pattern.  The levels or number of depth bits in the image.  Browse the image to collect the information in the matrix.  Use of descriptors. The interpixel spatial distance serves as a reference for the size of the window; the values of this vary in odd numbers starting from 3×3 to 21×21. The angle can take values of 0 o , 45 o , 90 o , and 135 o . By varying these values it is possible to characterize different types of texture or patterns of a particular texture. Figure 4 shows the distribution of the angles in a 3×3 sale [13].

Figure 4: Distribution of GLCM [13]
The levels of the GLCM matrix are defined as , where depends on the depth of the image (number of bits). In general, the texture analysis is carried out on gray-scale images (8 bits), in this case, the number of levels is 256. Table 1 shows an example of the distribution of the possible combinations present in a 5-level texture for GLCM matrix. Therefore for 256 levels we obtain a matrix of size 256×256 that contains the information of the spatial distribution, at a specific distance and angle. Finally, some texture descriptors such as energy, entropy, contrast, correlation, and homogeneity are used.

Local Binary Patterns (LBP)
The LBP texture analysis operator is defined as a gray scale invariant measure, derived from a general definition of the texture in a local neighborhood. The original proposal consists of the comparison of the central pixel with the neighbors, where the central pixel is taken as the threshold with respect to its neighbors. When comparing the central pixel with the neighbor, it is assigned a value of one (1) if the neighbor is greater than or equal; otherwise, it is assigned a value of zero (0). Each threshold result is assigned a weight of 2^n, where n depends on the neighbor's position with respect to the center pixel. Finally, a sum of the different weights is obtained obtaining the pixel LBP representation [14]. The operation of the original operator is presented in Figure  5, where a window of size 3×3 and the relationship of the central pixel in this case with its 8 neighbors are analyzed. The LBP equivalent for the values in Figure 4 (b) are presented in equation (1). (1)

Figure 5: Operation of the LBP operator [15]
Subsequently, a new one is derived from the original LBP operator, which modifies the window sizes and the number of neighborhoods for the pixel of interest. Parameters called R and P are defined for this derivation, where R corresponds to the distance (radius) from the pixel of origin to the neighbor and P the number of neighbors used to calculate LBP. The distance and distribution of the neighbors P are equally spaced and distributed in a symmetrical circumference that is constructed from the value of R, for values of R> 0 and P> 1. By modifying P and R different texture measures of the area of interest can be obtained. Figure 6 shows the distribution of the neighbors for different values of R and P.
(a) R = 1, P = 8 (b) R = 2, P = 8 (c) R = 2, P = 12 Figure 6: Operation of the LBP operator The circular distribution of the neighboring pixels is carried out using equation (2), with which an initial approximation of the location of the neighbors is established, to which it is necessary to complement it with an interpolation process to define the coordinates (x, y) from neighbors: (2) Finally, the derivation of the LBP operator for an image is defined in equation (3). (3)

C. Segmentation using Singular Value Decomposition
We have seen that for certain square matrices, we could make a decomposition into eigenvalues: Where is a diagonal matrix of eigenvalues and is an invertible matrix of eigenvectors. When we make the matrix vector product , we take , we express it in the base given by the eigenvectors ( ), we multiply the elements of this vector by the eigenvalues one by one, and we redo the inverse base change by multiplying by . If we have a linear system , we can make the base changes and we get the system . Limitations: to perform this transformation, the matrix must be square and diagonalizable [16]. The idea of the decomposition into singular values is similar to the decomposition into eigenvalues, but works for any matrix of size : one factorizes into product of three matrices [16]: (4) with a unitary matrix a unitary matrix of size and a diagonal matrix of size with real and positive coefficients.   Table 2 clearly shows that the proposed LBP based method outperforms other approaches on the basis of lower entropy and higher standard deviation.

IV. CONCLUSION
The development of an automated defect detection tool has become a necessity for the textile industry. The proposed approach improve the success rate of the texture analysis techniques. For the local binary patterns and in the cooccurrence matrix, the wavelet filter, increased the percentage of success in identifying the defects in the fabric. For the co-occurrence matrix, different alternatives were explored to improve the percentage of success, among which the one that showed the The original derivation of the LBP operator was not efficient for the identification of defects in textiles because the information collected is a general description of the texture, and the characteristics of the study images present a similarity that cannot be established with this method. On the other hand, the extensions derived from normalized LBP presented better percentages of the fault analysis with the use of morphological operation along with DWT, where it turned out to be the technique with the best results in the identification of defects in textiles, since it seeks to characterize uniform textures present in the image.