Abstract
Patterned fabrics may be regarded as periodic textures, which are defined as the regular tessellation of a primitive unit. A patterned fabric is considered as defective when a primitive unit is different from the others. In this paper, we propose a one-class classifier that uses Reduced Coordinated Cluster Representation (RCCR) as features. In the training step, the size of the primitive unit of defect-free fabrics is automatically estimated using a texture periodicity algorithm. After that, the fabrics are split into samples of one unit and their local structure is learnt with the RCCR features in a one-class classifier. During the test step, defective and non-defective fabrics are also split into samples and are analyzed unit by unit. If the features of a given unit do not satisfy the classification criterion, it is considered to be a defect. Among the advantages of the RCCR is that it represents structural information of textures in a low-dimensional feature space with high discrimination performance. Results from experiments on an extensive database of real fabric images show that our method yields accurate detections, outperforming other state-of-the-art algorithms.
Keywords
In recent years, computer vision has played a significant role in the manufacturing industry, especially in systems for automatic quality inspection. The growing interest has emerged because, usually, quality control is carried out by human visual inspection. However, it is well-known that human-based inspection is imprecise and has disadvantages. Computer vision applications based on visual texture features are among the most popular, because texture is an important attribute for the characterization of surfaces. In the texture analysis field, researchers are actively pursuing new inspection methods for a variety of surfaces,1–3 such as steel, stone, fabrics, wood, paper, and ceramic tiles.
In particular, the analysis of patterned fabrics is commonly considered due to its presence in an assortment of essential products and accessories such as clothes, fabrics, shoes, handbags, and bed sheets, among others.4–7 Patterned fabrics are characterized by a design primitive unit, which is repeated periodically over the whole fabric. Although there is an innumerable number of different designs, it has been proven that all patterned fabrics can be classified into only 17 groups. 8 Each group is defined by the shape of its design unit and its inner symmetry.
A considerable number of methods has been proposed in order to detect defects on patterned fabrics. The majority of these methods are focused on the analysis of only one out of the 17 groups. Among these methods, we can find schemes based on autocorrelation,
9
co-occurrence matrices,
10
wavelet transform,11,12 fractals,
13
Gabor filters,14,15 Fourier analysis,
16
and morphological operations.
17
An important point regarding these systems is that they can only detect specific types of defects and they have limitations in the analysis of the other 16 groups of patterned fabrics. In pursuance of a more generalized method, approaches that are able to cope with the other 16 groups have also been introduced. The works by Sanby et al.
18
and Farooq et al.
19
are examples of the idea of image subtraction (IS), where a sample is taken as a perfect prototype and, then, it is directly compared with the test images. A weakness of the IS-based methods is that they are susceptible to alignment problems between the reference and the test images. The approach proposed by Ngan and Pang
20
was one of the first methods that addressed the use of periodicity in patterned fabrics. They claimed that a break of the periodicity of a patterned texture is a defective region. The main disadvantage of such a method is that it cannot detect defects smaller than one design unit. The analysis of fabrics using regular bands was proposed by Ngan and Pang.
21
This method, also based on periodicity analysis, is focused on defects that have a high contrast in comparison with the fabric design, and thus, it is not sensitive to defects with low contrast. Tajeripour et al.
22
proposed a classification method in which the widely known Local Binary Pattern (LBP) operator
23
is modified in order to extract texture features from windows of a predefined size and, then, a suitable threshold is determined in order to estimate the defective samples. One of the drawbacks of this approach is that the size of the analysis window is not adaptable, since it is always
In this paper, the analysis of patterned fabrics using texture periodicity (TP) and a Reduced Coordinated Clusters Representation (RCCR) as the feature vector in a one-class classifier is proposed. From now on, we call our method TP-RCCR. In our proposal, TP is used to automatically obtain the size of the primitive unit and to properly cut a given fabric in basic samples. Then, the local texture of the units, through the RCCR features, is learnt with a one-class classifier. An advantage of the features used in our method is that the discrimination performance is increased in comparison with using only the pixel intensities. Furthermore, the feature vector dimension of RCCR is low in comparison with other texture descriptors. Another advantage of our proposal is that with the use of a one-class classifier, the number and types of defects that can be detected are not restricted. The TP-RCCR is evaluated and compared on an extensive database of real defective and non-defective fabric images with different types and sizes of defects. Experiments using a standard database of patterned fabrics show that our method leads to better results in comparison to other texture descriptors and other state-of-the-art methods.
This paper is structured as follows: in the second section the proposed approach is described. In addition, the methods to estimate the unit size and the RCCR features are defined. In the third section, we include the experiments and results performed to validate our method on a database of real fabric images. Finally, the fourth section presents a summary of this work and our concluding remarks.
Materials and methods
In this section, the theoretical background and the proposed classification framework are introduced. The proposed method is illustrated in Figure 1, where it can be seen that it is performed in two stages: training and testing. During the training stage, defect-free images are submitted to a pre-processing treatment (presented in Figure 2 and detailed in the next section) in order to make them suitable for the feature extraction procedure. Subsequently, a classification criterion is learnt based on the training samples. For the testing stage we use both defect-free and defective fabrics. In the same manner as in the training step, test images are submitted to the pre-processing and the feature extraction steps. Finally, each sample in the fabric test images is classified using the criterion previously learnt. Each block in both Figures 1 and 2 is detailed in the following sections.
Overall block diagram of the proposed algorithm with its two main stages: (a) training and (b) testing. An illustration of the pre-processing steps performed to the input images before the feature extraction.

Pre-processing
In our method, the pre-processing is performed in four stages. Firstly, in order to improve the contrast in the images of the database used for our experiments, an adjustment has been performed. Concerning this task, we have tested methods such as linear adjustment, gamma correction, and histogram equalization. We have found that the simple histogram equalization offers better results in terms of detection accuracy in comparison to other methods without any adjustment. Statistical results and details about such comparison of algorithms are presented in the Comparison with other approaches section. The second step is the estimation of the unit size, so that the different design units can be properly separated. Size can be easily measured with different methods, such as that proposed by Asha et al. 25 or by Lizarraga-Morales et al. 26 Concretely, in our approach, the unit size is estimated using the algorithm presented by Lizarraga-Morales et al. Such a method is completely automatic, robust, accurate, and computationally efficient. After that, a thresholding process using the Otsu method 27 is accomplished. As it is detailed in the Reduced coordinated clusters representation section, the RCCR features are extracted from a binary image; therefore, a thresholding process is mandatory. In our approach, the Otsu method has been selected for its simplicity, and because it has proven to be suitable for different applications where computational speed is required.28–30
Primitive unit size estimation
The estimation of the unit size of patterned textures is a problem that researchers have been addressing for years. Recently, Lizarraga-Morales et al. 26 presented a fast and robust approach based on the use of homogeneity cues computed using the difference histogram proposed by Unser. 31 One of the main attributes of this method is that, as is shown in the original paper, it is capable of performing without failure under conditions of blur, noise, and geometrical deformations. Moreover, it is fast enough to be considered for practical applications because it only takes a few milliseconds to estimate the unit size.
According to the description of the method, let us consider a
It may be observed that the homogeneity value reaches its maximum value of 1 when all the differences between the indexed pixels in the image are 0. Taking this into account, the problem of measuring the primitive size of a given periodic texture is reduced to the search of A patterned fabric (a) with its estimated unit size 
Reduced coordinated clusters representation
The Coordinated Clusters Representation (CCR) is a model for binary image characterization that was proposed by Kurmyshev and Cervantes.
32
In this model, a binary image is identified by a histogram of occurrences of patterns and it can be used as a texture descriptor. The CCR has been successfully employed in a variety of tasks33,34 while demonstrating a high discrimination performance. Following the description by Sanchez-Yanez et al.,
33
in order to compute the CCR of a binary image, we must establish a rectangular analysis window of
According to Kurmyshev and Guillen-Bonilla,
35
a way to reduce the complexity of a binary string is to partition it into blocks of a given number of bits, so that the whole string is represented by an ordered set of natural numbers. For example, binary patterns extracted by the aforementioned
One-class classification
Classification 36 is used to learn a model (classifier) from a set of labeled data instances (training) and, then, classify a test sample into one of the classes using the learnt model (testing). Based on the number of labels in the training data samples, the classification can be considered as multi-class or one-class classification. In particular, one-class classification methods learn a discriminative criterion around the normal samples and any test instance that does not fall within the learnt criterion is regarded as out of the scope of interest. In this paper, we propose the use of a one-class classification system in order to detect defects on patterned textures.
In the learning phase, a set of non-defective images is pre-processed, the corresponding
In order to establish the limits of the discriminative boundary, we compute the other two characteristics of the model: D and σ. Considering
After all the characteristics of the defect-free model are learnt, a selection criterion is formulated. The idea is simple: a given sample is considered defective if its feature vector position, with respect to the learnt prototype, is out of the limit. Following this idea, it is stated that a given unit
Experiments and results
In this section, we introduce the experiments that have been conducted in order to evaluate the performance of our approach. The evaluation is carried out by a thorough quantitative analysis on a standard database. Our method is compared to other state-of-the-art approaches and to other texture descriptors. Firstly, in the Dataset and quantitative measures section, the dataset used for experiments is presented and the different quantitative measures are defined. Subsequently, in the Parameter estimation section, the methodology to estimate the best parameters for our method is described. Afterwards, our method is compared to the most recently proposed approaches and to other texture descriptors in the Comparison with other approaches section. Finally, in the Performance evaluation with deformed fabrics section, considering that in the industrial environment there are common mechanical tension changes by rolling the fabric under test, we have tested our method with patterned textures submitted to different degrees of geometrical deformation.
Dataset and quantitative measures
Concerning the performance of the proposed algorithm for different types of designs, images of real fabrics with different defects are analyzed. For the experiments, we have used the database provided by Henry YT Ngan from the Industrial Automation Research Laboratory of the Department of Electrical and Electronic Engineering at the University of Hong Kong. Such a database is a standard basis for defect detection algorithms on patterned fabrics. It consists of three different fabrics belonging to the three major design groups: (a) p4m (box-patterned); (b) p2 (star-patterned); and (c) pmm (dot-patterned). The pmm, p2, and p4m groups are called major, due to the fact that all the other groups can be transformed to these three via geometric transformation. 21 Therefore, defect detection experiments on these three patterns can be extrapolated to the 17 groups. The advantage of this dataset is that, for each pattern, sets of defective samples previously labeled with five of the most common defects occurring in the textile industry are provided: Broken End, Thick Bar, Thin Bar, Hole, and Multiple Netting. Furthermore, for each defective image, a ground-truth is available and can be used to quantify the reliability of a given method. The full database consists of 30 defect-free and 25 defective images (five images for each defect) of each pattern.
From the dataset, we have built three different sets of primitive units for our experiments: training, validation, and testing. In order to generate the training and validation sets, we have randomly extracted 700 overlapping units from the 30 defect-free images available. We have taken 400 samples for the training set and 300 for the validation one. In addition, the validation set was enriched with 500 defective samples, the outliers. The outliers were selected randomly among the defective images in the dataset. For the testing set of each pattern, the corresponding 25 defective images are uniformly divided into non-overlapped samples of the size of the primitive unit. For the p4m pattern, the division results in 2250 samples, 135 defective and 2115 defect-free sample units. The images in the p2 group are separated into 4125 non-overlapped sample units, 270 defective and 3855 defect-free ones. The division of the pmm patterned images results in 1575 non-overlapped samples of both defective (105) and non-defective (1470) units. It is important to highlight that special care was taken to ensure that the validation and testing sets are completely different.
Examples of the three different patterned fabrics are shown in Figure 4. For each one, the estimated unit size with the method described in the Primitive unit size estimation section is highlighted with a frame. The units sizes of the p4m, p2, and pmm groups shown in this figure are Samples of patterned fabrics used in the experiments with their primitive unit highlighted: (a) p4m, box-patterned; (b) p2, star-patterned; (c) pmm, dot-patterned.
Taking into account that we have access to real defective images with their corresponding ground-truth, quantitative evaluation may be performed. Regarding this task, we have adopted the evaluation method described by Ngan et al.
37
in order to measure the defect detection accuracy. Specifically, we use the detection success rate (DSR), which is defined in equation (7)
Parameter estimation
The TP-RCCR method has two parameters to be estimated: the size of the scanning window
Optimal values of the parameter C for each analysis window size and the corresponding classification error

Error plot as a function of parameter C for the three different fabrics: (a) p4m pattern; (b) p2 pattern; (c) pmm pattern.
Comparison with other approaches
In this section, we present series of tests that have been undertaken in order to evaluate the performance of our approach in comparison with the following: (i) other contrast adjustments (pre-processing); (ii) other texture features; and (iii) other state-of-the-art methods.
Average detection success rate comparison with different pre-processing algorithms
In our approach, the same pre-processing is executed for all patterns; therefore, the decision for the more suitable pre-processing algorithm is taken with the average DSR. In this case, the higher DSR on average is obtained using a histogram equalization. Such pre-processing results in an even intensity distribution and an enhancement of the contrast between the fabrics and the defect. Qualitative examples of an original sample image, the resulting images of each pre-processing algorithm, and their corresponding histograms are presented in Figure 6. In this figure, we can see that, usually, the distribution of the intensities is skewed to one side of the histogram. However, a more even distribution is obtained with the histogram equalization.
(a) A non-defective sample and its histogram. Resulting images and their corresponding histograms of the pre-processings: (b) linear adjustment; (c) histogram equalization; (d) gamma adjustment with 
The second experiment was carried out in order to assess the defect discrimination capacity of
Average detection success rate comparison among different texture descriptors
The third comparison was performed with two state-of-the-art methods: (i) the Modified LBP-based method (MLBP), 22 which is based on the widely used LBP texture descriptor; and (ii) the use of Texture Periodicity and the Jensen–Shannon Divergence (TP-JD). 24 As far as we know, these methods are the most recently proposed approaches and have proven to be robust when applied to defect detection. Moreover, these methods were evaluated using the same database, allowing a direct comparison.
Average precision, recall, and detection success rate for 2250 samples of box-patterned fabric, p4m group
One example of each defect and their corresponding detections are depicted in Figure 7. In this figure, the original defective image is presented in the first row, and the corresponding defective units are delineated and shown in the second row. As can be seen in this figure, the TP-RCCR can detect defects with high contrast in comparison with the original texture (Thick Bar) and also with low contrast (Broken End). The TP-RCCR is also able to detect defects that are smaller than the fabric unit, for example, the Thin Bar defect, which has the size of less than a half of the primitive unit.
Samples of each defect occurring on the p4m wallpaper group and the corresponding defects detected with the TP-RCCR.
Average precision, recall, and detection success rate for 4125 samples of star-patterned fabric, p2 group

Samples of each defect occurring on the p2 wallpaper group and the corresponding defects detected with the TP-RCCR.
Average detection success rate for 1575 samples of dot-patterned fabric, pmm group
On average, the TP-FCCR approach obtains a higher DSR on the dot-patterned fabric with 96.88%, in comparison to the 96.28% and 96.2% of the TP-JD and MLBP approaches, respectively. Samples of defective images and their corresponding detection outputs are shown in Figure 9. In this figure, we can see that our method detects the Broken End, Thin Bar, and Multiple Netting defects accurately. However, it presents false positives and false negatives on the Hole defect. Such misdetections are reflected in the Precision and Recall measures.
Samples of each defect occurring on the pmm wallpaper group and the corresponding defects detected with the TP-RCCR.
As a final comment on this subset of experiments, it is pointed out that the average DSR of our method for the three groups, each group with five different defects, is 98.41%. In contrast, the average success rates for the TP-JD and for the MLBP are 96% and 97.16%, respectively.
Performance evaluation with deformed fabrics
A relatively common problem in the industry is that the machinery that rolls the fabrics causes uneven stress on the surface and, therefore, fabrics under test may suffer undesirable deformation. In order to evaluate the performance of our approach in such conditions, we have arbitrarily deformed samples of the three patterned fabrics using the IWarp function of the image manipulation software GIMP. Such a function allows four different deformation modes: move, grow, shrink, and swirl, which emulate the stress caused by the machinery. A healthy sample of each patterned fabric (shown in the first column of Figure 10) is submitted to 10, 20, 30, and 40 randomly selected and positioned deformations (shown in the second, third, fourth, and fifth columns of Figure 10, respectively). The parameters used for the deformations are predefined in the software: Deform Radius = 20, Deform Amount =0.30.
TP-RCCR results of deformed fabrics. The defective samples are highlighted by a frame.
The detection results of the TP-RCCR method are depicted in Figure 10, where the units classified as defect are highlighted with a frame. Taking into account that in this experiment, all samples should be classified as healthy, the TP-RCCR method has obtained an average detection accuracy of 97.77%, 97.40%, and 95.87% for the box, star, and dot-patterned fabrics, respectively. In this regard, it is important to point out that a quality inspection system should be tolerant enough to accept minor differences and deformations among patterns, but not be too inclusive, allowing defective patterns to be classified as normal.
Summary
The main attributes exhibited by the proposed approach are summarized. The defect detection problem is regarded as a one-class classifier problem, where non-defective samples conform with the objective class and any defective sample that does not fit the similarity criterion is viewed as a defect. With this approximation, in our method there is no restriction on the types and number of defects that may be detected. The TP-RCCR analyzes the fabrics split in rectangular units. This assumption makes our method able to cope with any of the 17 pattern groups. With our approach, the detected defect is outlined in the output image, allowing a posterior analysis of the defects and a possible improvement of the production process. From the quantitative evaluation using different defects and patterns, we can see that our method is capable of detecting defects with both low and high contrast, regarding the fundamental pattern. In addition, it has been shown that it can also detect defects smaller than half of the primitive unit and it is robust to deformations. An important feature of any defect detection system should be the computational time that the method requires to analyze one image. Regarding the computation time of the TP-RCCR, the average processing time for analyzing one image requires ∼60 ms using a non-optimized MATLAB implementation in an ordinary Intel Core i3 CPU. Such attributes, which overcome the different drawbacks of previously proposed methods, make the proposed methodology a good option for defect detection on patterned fabrics.
Conclusions
In this paper, we discussed the use of the RCCR in a one-class classifier for defect detection on patterned fabrics. Training is accomplished using non-defective samples and a similarity criterion is built. During the test stage, input images are split into primitive units and any unit that does not fit the criterion learnt is considered defective. One of the main contributions of this paper is the use of an automatic estimation of the primitive unit size. This automatic estimation aims to extract the fundamental features of the repetitive pattern and releases the system from human intervention. In addition, we found that the TP-RCCR is highly discriminative, since it obtains the local structure of the texture instead of using only the pixel intensities. Moreover, the features used in this paper are represented in a space of only 16 dimensions, which reduces the space complexity of other state-of-the-art approaches (28–54 dimensions of MLBP and 256 of TP-JD). The use of a one-class classifier also brings advantages, since there are no restrictions on the type and number of defects to be detected. Evaluation of the proposed method was carried out with experiments on real fabric images. Quantitative results show that our method is robust and flexible in finding defects of different types, sizes, and contrast levels and it has been shown to be more accurate than other state-of-the-art methods. For future studies, having localized the defective region, we intend to explore the estimation of the type of defect, which may help in localizing errors in the manufacturing process.
Footnotes
Acknowledgements
The authors would like to thank Henry YT Ngan from the Industrial Automation Research Laboratory in the Department of Electrical and Electronic Engineering at the University of Hong Kong for providing the database of fabrics. In addition, the authors would like to thank the Directorate for Research Support and Postgraduate Programs at the University of Guanajuato for their support in the editing of the English language version of this paper.
Declaration of conflicting interests
The authors declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The authors disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This work was supported by the Universidad de Guanajuato through the project “Imaging Science and Technology” and the PRODEP through the NPTC project “Inspección visual automática para la detección y clasificación de defectos en textiles utilizando herramientas de vision por computadora” (number DSA/103.5/15/7007).
