Sunteți pe pagina 1din 9

Cloth Defect Classification Method Based on SVM

Tao Dongli, Xiao Zhitao, Zhang Fang, Geng Lei, Wu Jun

Cloth Defect Classification Method Based on SVM


 

Tao Dongli, *Xiao Zhitao, Zhang Fang, Geng Lei, Wu Jun


School of Electronics and Information Engineering, Tianjin Polytechnic University, Tianjin
300160, China
(tianjin_tdl@163.com, * Corresponding Author zhitaoxiao@yahoo.com, hhzhangfang@126.com,
barongeng@163.com, zhenkongwujun@163.com)
 
Abstract
To solve the problem of low classification accuracy in cloth defect detection, an approach
combining Gabor filter and SVM (Support Vector Machine) is proposed. Firstly, the optimal Gabor
filter bank based on Half-peak tangent method is adopted to filter the original cloth image, and the
defect is segmented out. Then, the SVM classifier is trained using the extracted defect features. In the
stage of training, the best penalty factor and the Kernel parameter in SVM are searched by the Genetic
Algorithm. At last, the performance of the classifier is tested. Experiment results show the proposed
approach has strong detection and classification capacities to the monochrome texture defect.

Key words: Support Vector Machine, Defect Classification, Gabor filter, Genetic Algorithm
 
1. Introduction

The detection of the cloth quality is an important procedure in the process of the cloth production.
Presently, the detection and classification of the cloth defect in factory is done artificially. The effect of
artificial detection is low and unstable because manual work is easily influenced by physiology and
mentality. In order to solve these problems, the automatic detection and classification technology of the
cloth defect has been the indispensable approach in the process of cloth industry development. In
reality, due to the category of cloth defect is huge and the difference of the same type cloth defect in
shape and texture is enormous, most methods always have the problems like the high lose detection
rate and low classification accuracy rate.
The simplest cloth defect detection approach is gray comparison, which computes the difference of
gray value between the detected cloth image and the normal cloth image, and compares this gray
difference with a setting threshold to judge whether there is defect in the detected cloth. In addition,
there are two kinds of statistics detection approaches. One is the First order statistics method [1] based
on the gray histogram, the other is the Second order statistics method [2] based on the gray level
co-occurrence matrix. Moreover, a kind of defect detection approach which is based on some model,
such as the ARMA model [3] and the Markov model [4] has been presented. All of the defect detect
approaches mentioned above are to process the image in spatial domain and extract defect features.
Although the spatial domain approaches are logical and easy understanding, they have the low
robustness and are easy to be influenced by the environment. In order to improve the robustness of the
algorithm, some approaches which are based on the transformation domain have been researched and
applied, such as the Fourier analysis method [5] and the Gabor analysis method [6]. Comparing with
the spatial approach, the transformation domain approaches are uneasy to be influenced by the
environment and are suitable to be used with the complex scene. Fourier transform is a kind of global
transformation which needs all the spatial information of the signal. Therefore it cannot achieve the
precise position to the cloth defect. But Gabor transformation has excellent partial feature in spatial
domain and frequency domain. Besides, because the two-dimensional Gabor filter can depict precisely
the vision perception characteristics of the visual neurons, Gabor analysis method is better than Fourier
analysis method to the cloth defect detection.
So far, the approaches of pattern classification include Bayes classification method [7], Neural
Network classification method [8], K-Nearest Neighbor (KNN) [9] classification method and SVM
classification method [10] etc. Bayes classification method has solidly mathematical basement because
of the famous Bayes theorem. By training the vast samples, the posterior probability is evaluated out.
This method has ever been used largely in the image classification. Nevertheless, on account of the
Bayes classification method is established on the assumption that the distribution of feature vector is a

International Journal of Digital Content Technology and its Applications(JDCTA) 614


Volume7,Number3,February 2013
doi:10.4156/jdcta.vol7.issue3.76
Cloth Defect Classification Method Based on SVM
Tao Dongli, Xiao Zhitao, Zhang Fang, Geng Lei, Wu Jun

Gaussian distribution, so that some misjudgments will occur to the small probability event. So the
Bayes classification method has some limitations for some classification issue. The neural network
classification is based on the Empirical Risk Minimization principle [11] and the true risk is predicted
depending on the empirical risk. The neural network method has been used widely in many fields in
practice since the end of 19th century. However, the drawbacks of local minimum and over-learning in
neural network put off its development. KNN classification method is a kind of traditional statistic
pattern recognition method, which is based on assessing the similarity among the unclassified sample
with the K-Neighbor categories to decide the unclassified sample’s category. Because of the simple
principle of the KNN classification method, it has been the important method in the pattern
classification field. However, due to each judgment need to calculate the distance between unclassified
samples with all train samples, it needs the big storage space and calculation. SVM is based on the
Structural Risk Minimization principle [11]. To improve the generalization capability, the empirical risk
and the confidence interval need to be controlled well. SVM has shown its excellent performance in
solving small sample, non-linear and high dimensional pattern recognition issue. Firstly, to gain ideal
generalization capability, SVM try to reduce the error of the training set and the complexity of the
machine. Secondly, because the essential of the SVM method is solving convex optimization problems,
the local optimal solution must be the global optimal solution. These advantages decide that SVM
classification method is better than other methods like neural network classification method. In this
paper, firstly, an optimal Gabor filter bank is designed with the half peak tangent method [12].
Secondly, by this Gabor filter bank, the original cloth defect image is filtered. Then, through merging
the sub-image filtered effectively, we can obtain the final segmented defect image. In the process of
classification, the SVM classifier is selected for training and predicting the defect samples. In order to
acquire the best performance of the SVM classifier, the parameters of the SVM model are searched by
the Genetic Algorithm. The experiment results show that the classification method in this paper can
achieve a high classification accuracy rate to the monochrome texture defects.

2. SVM theory

SVM method is established on the VC Dimension theory [11] and the Structure Risk Minimization
principle which is based on the statistical sciences. According to the finite sample information, the best
scheme for good generalization capability is chosen between the complexity of model and the learning
capability of machine, which can guarantee the minimal true risk.
The original SVM classification method is searching for the optimal hyper plane under the linearly
separable issue. The optimal hyper plane not only separates the two categories out correctly, but also
acquires the biggest separates distance between the two categories. As shown in Figure 1, the circles
and the triangles represent the two categories of sample respectively, H is the classification line, H1
and H2 are two lines constituted by the nearest sample to the classification and parallel to the
classification line in each category respectively, the distance of the two lines is called classification gap.
The equation of the classification line is defined as:

xwb  0 (1)

By normalizing, the linear sample set (x, y), i=1,…,n, x  R, y  {+1,-1} satisfy:

yi [( w  xi )  b]  1  0, i  1, , n (2)

The classification gap equals to


2/ w , the hyper plane of satisfying equation (1) is optimal hyper
plane, and these training sample points on H1 and H2 are called support vectors.

615
Cloth Defect Classification Method Based on SVM
Tao Dongli, Xiao Zhitao, Zhang Fang, Geng Lei, Wu Jun

 
 
Figure 1. Optimal hyper plane

SVM can solve not only the linear problem, but also the nonlinear problem. To solve the nonlinear
problem, the idea is mapping a linear inseparable space to a high dimensional linear separable space
which structures the optimal hyper plane with the Structural Risk Minimization principle by a
nonlinear mapping. The key of the transformation is calculating the dot product of the nonlinear
transformation, i.e. the kernel function, instead of calculating the complicated nonlinear transformation
directly. The procedure simplifies the calculation amount immensely. The kernel functions we can
select include linear kernel function, polynomial kernel function, sigmoid kernel function and RBF
(Radial Basis Function) kernel function. As a matter of fact, the RBF kernel function has acquired the
satisfactory result in most of the project.
The original SVM just solves the problem of two categories which include positive category and
negative category. In fact, most of the problem we encounter is multi-class problem. The issue of cloth
defect classification in this paper belongs to a multi-class problem. To the multi-class problem, the
method applied presently includes one-to-one-SVM, one-to-many-SVM, directed-acyclic-graph-SVM,
binary-tree-SVM [10] etc. The main principle of all the methods is to decompose one multi-class
classifier into many two-class classifiers following some schemes. Eventually, the multi-class problem
will be solved by solving many two-class problems. In addition, in order to acquire the best
classification performance of SVM in multi-class problem, selecting the penalty factor and kernel
parameter [13] is an indispensable procedure. By selecting the appropriate penalty factor and kernel
parameter, the learning capability and generalization capability of the SVM can achieve optimum. The
methods of selecting parameters include no-intelligence method such as Experience Selection Method,
Grid Search Method and intelligence method such as Genetic Algorithm, Particle Swarm Optimization
etc. Experiments show that compared with the no-intelligence method, the intelligence method not only
solve the multi-parameter more easily, but also can improve searching precision at the same time of
reducing search time .

3. The procedure of cloth defect classification

This paper mainly includes two part, classifier training and classifier testing. In the phase of
classifier training, the cloth defects of training samples are detected out by the designed Gabor filter
bank. After segmenting and locating the defect area, the defect features are extracted with some
methods. Then, the SVM classifier is trained combining with Genetic Algorithm by the acquired defect
features for obtaining the optimal parameters of SVM. In the phase of classifier testing, the cloth
defects of testing samples are detected out and the defect features are extracted as same as the method
of training phase. Next, the testing samples are classified by the acquired SVM classifier. The
experiment result shows the cloth defect classification method can achieve ideal detection and
classification accuracy rate. The flowchart is shown as Figure 2.

3.1. Cloth defect detection

Two dimension Gabor filter has been applied widely in texture analysis because Gabor filter has the
excellent local time-frequency properties and compatibly simulate the channel of the human vision
very much. In other words, human eye can be identified as a Gabor filter bank. In this paper, Gabor

616
Cloth Defect Classification Method Based on SVM
Tao Dongli, Xiao Zhitao, Zhang Fang, Geng Lei, Wu Jun

filter bank with two radial center frequencies and two orientations is used to segment and locate the
cloth defect.
The expression of two dimension self-similarity Gabor function in space is defined as:

1 1 x y
f (x, y)  exp( [( )2  ( )2 ])exp(2 jFx)                               (3)
2 x y 2 x y
               
Where

x   x cos   y sin  ,  y    x sin   y cos            (4)

 x and  y   are the scale factors which decide the envelope of Gabor function modulated by Gaussian
function. F is radial center frequency of Gabor function. θ is the orientation angle. x and y are
rectangular coordinates. j is plural virtual step unit . When θ= 0°, the Fourier transform of equation (3)
is defined as:

                                            F (u , v )  exp(  1 ( (u  F )  v ))                              
2 2
(5)
2 u v

Where

1 , 1 (6)
  
2  2 
u v
                          x y
                      

 
Figure 2. Flowchart of cloth defect image classification

617
Cloth Defect Classification Method Based on SVM
Tao Dongli, Xiao Zhitao, Zhang Fang, Geng Lei, Wu Jun

The main works of designing the Gabor filter is to confirm the parameters including F,  u and  v .
Due to the infinite extension characteristic of Gaussian function, the Gabor filter is not compact
support. So when design the Gabor filter bank, the general way is promising the filters are tangent with
each other at the half-peak of the frequency domain's amplitude which is called half peak-tangent
method. The significance of applying the half peak-tangent method is guaranteeing the frequency of the
cloth defect is covered as much as possible by the filter bank for decreasing the loss of the defect
information. According to the sample of the monochrome tabby cloth, the radial center frequencies of
Gabor filter are F1=0.14, F2=0.07, and the size of filter template is 11×11, the angles are selected to
horizontal orientation and vertical orientation [6]. The specific detection flow is as follow:
(1) The normal texture image is filtered by the designed Gabor filter bank. Then the mean and
variance of the filtered image are calculated and be regarded as the threshold to segment the
defect image in next step.
(2) The undetected image is filtered by the Gabor filter band as same as (1). The filtered image is
checked by the threshold acquired in (1) for judging whether it contains defect.
(3) The four sub-images which have been checked by the threshold are merged as one image by the
Bernoulli rule [14]. Then, the final segmenting defect image will be acquired by binarization.

3.2. Feature vector extraction

After the defect area and position are ascertained by the Gabor detection algorithm, the defect
geometric feature and gray feature are extracted from the defect binary and gray image respectively.
After acquiring the initial features, the initial feature vectors are dimension-reduced and normalized
in order to reduce the data redundancy and improve the program convergence speed. In the process of
dimension reduction, the principal component analysis [15] is adopted to reserve the feature vectors
that have significant contribution to the whole image information via calculating and analyzing the
difference of relevant variables in classes or individuals. In the process of normalization, the feature
vector is mapped to [0, 1] according to

x  xmin
f :x y                                                 (7)
                   
xmax  xmin

Where

xmin=min(x), xmax=max(x), y  [0,1].

3.3. SVM classifier Training

Training classifier is one of the important procedures in whole classification algorithm. This process
is to search for the optimal classifier by the trained samples. Specifically, the purpose of training SVM
classifier is searching for the penalty factor c and the parameter g in RBF kernel function. We combine
the Cross Validation with Genetic Algorithm for seeking the best parameters of the SVM. The specific
steps are as following:
(1) Every feature vector of the training sample is coded by the standard binary code.
(2) Choose the classification accuracy rate as the fitness function.
(3) Produce the initial population.
(4) Calculate the fitness function.
(5) Judge the end condition. If the Genetic Algorithm reach the end condition, the decode module will
be run. Otherwise, run the module of selection, cross, variation, and ascertain the optimal solution,
return to (4). When the optimal solution of children generation population cannot exceed the
optimal solution of father generation population or the number of population generation has
reached the highest population generations, the Genetic Algorithm will be end.
(6) Output the optimal solution, i.e. the penalty factor c and the parameter g of RBF kernel function.
 
 

618
Cloth Defect Classification Method Based on SVM
Tao Dongli, Xiao Zhitao, Zhang Fang, Geng Lei, Wu Jun

3.4. SVM classifier Testing

The process of testing the SVM classifier is following as the flow of Figure 2, i.e. judge the
category of the tested defect image by the acquired classifier. Finally, the classification accuracy rate is
regard as the standard of evaluating the performance of the classifier.

4. Experiment results

In this paper, there are 6 kinds of defects including oil patch, oil warp, broken woven, oil weft, hair,
and sundries. In the ahead of training the classifier, in order to examining the performance of Gabor
detection algorithm, 500 actual cloth samples are detected by the Gabor detection algorithm, the result
of examining is following as Table 1. In the stage of training classifier, each kind of defect samples
including normal texture image is chosen 30 as the training samples. In the stage of testing classifier,
each kind of defect samples including normal texture image is chosen 20 as the testing samples. So the
whole amount of training sample is 210, the whole amount of testing sample is 140. The original defect
image is as Figure 3. The segmented defect image is shown in Figure 4.

       
      oil patch oil warp broken woven

       
oil weft hair sundries
Figure 3. The original defect image

       
oil patch oil warp broken woven

       
oil weft hair sundries
Figure 4. The segmented defect image

Table 1. Statistical result of sample images detection


Number of Defect Correct Detection False detection Missing
samples samples detection rate rate detection rate
500 300 292 96.0% 2.0% 4.0%

619
Cloth Defect Classification Method Based on SVM
Tao Dongli, Xiao Zhitao, Zhang Fang, Geng Lei, Wu Jun

By the statistics to the tested samples, we can see that the missing detection rate is 4.0% and most of
the missing detection defect is hair. The statistical result is shown in Table 1. By analysis, we can
realize that the main reason is that the hair is too thin and, in most cases, the hair is discontinuous, so
that it always is regarded as the noise and is removed. In addition, when the light is not sufficient to
detect, it is easy to occur lose detection. So, in order to reduce the missing detection rate, the light
should be stabilized.
The geometrical features, including area, perimeter, shape factor, elongation, and length-width ratio
of the enclosing rectangle, are extracted from the segmented binary image. The gray features, including
mean, variance, flat degree, peak value, energy, and entropy, are extracted from gray histogram of the
original defect image. Eventually, each defect image can acquired a feature vector which contains 15
feature values. After the dimension reduction and normalization, the dimensions of each feature vector
are decreased to 7. In the process of searching for the optimal parameters of SVM, the size of
population is 20, the maximums number of evolution generation is 30, and the fitness curve is shown
as Figure 5.

Figure 5. The fitness curve of SVM parameters optimization

By GA searching to the 210 training samples, the optimal fitness value is 99.5%, the best c=12.839,
the best g=8.857. According to the fitness curve, it can be observed that mean fitness of the population
rapidly promoted from 92% to 97.5%, which means that the lower fitness individual is replaced by the
higher fitness individual in the evolutionary process. After 10th generation, the mean fitness of the
population is waving between 97% and 98%, which indicates that the most of the individuals which are
belong to the 10th generation and later have the strong learning capability. The searched c and g must
be approached to the global optimal solution.
After acquiring the optimal classifier, the classification result of the classifier to 140 testing sample
is as figure 6. The label of sample category is normal texture (0), oil patch (1), oil warp (2), broken
woven (3), oil weft (4), hair (5), and sundries (6). The distribution of samples is normal texture (0-19),
oil patch (20-39), oil warp (40-59), broken woven (60-79), oil weft (80-99), hair (100-119), and
sundries (120-139).

620
Cloth Defect Classification Method Based on SVM
Tao Dongli, Xiao Zhitao, Zhang Fang, Geng Lei, Wu Jun

Figure 6. SVM classification results

According to the classification result of the 140 testing samples, it can be discovered that there are 9
uncorrected classified samples and the classification accuracy rate is 94%. The false classified samples
mainly focus on hair and the most of the false classified hair are judged to oil warp and normal texture,
as shown in Table 2. Through the analyses to the classification result, the following reasons are
involved. Firstly, the geometric feature of the hair and oil warp is similar. Secondly, the detection to
hair is not thorough in the process of defection. Thirdly, the amount of the extracted defect feature is
limited after segmenting the defect region so that the feature information is not sufficient to estimate
the category of sample by the classifier.
 
Table 2. The statistics result of defect classification
category quantity correct false classify falsely as
normal texture 20 20 0 no
oil patch 20 18 2 normal texture / hair
oil warp 20 20 0 no
broken woven 20 20 0 no
oil weft 20 20 0 no
hair 20 14 6 oil warp /normal texture
sundries 20 19 1 oil weft

5. Conclusion

In this paper, the main work is to detect and classify 6 kinds of common cloth defects from the
actual acquired cloth image, which include oil patch, oil warp, broken woven, oil weft, hair and
sundries. First of all, the cloth image is filtered by the designed optimal Gabor filter bank for
segmenting the defect region. Afterwards, the SVM classifier is trained by the acquired defect samples.
And, penalty factor and kernel parameter are searched by the Genetic Algorithm for acquired the
optimal SVM classifier in the condition of limited samples information. Finally, the performance of the
classifier is tested through the unknown defect samples. Experiment results demonstrate the proposed
approach has excellent detection and classification capability to the common monochrome cloth and
the classification accuracy rate reaches over 94%. However, because the category of defect in reality is
so many that there is not a general approach appropriate for the entire cloth defects. The next works is
to research the method which can enhance the classified category of cloth defect as many as possible
without lower the classification accuracy rate.

6. Acknowledgement

This work is supported by National Nature Science Foundation of China under grant No. 61102150.

621
Cloth Defect Classification Method Based on SVM
Tao Dongli, Xiao Zhitao, Zhang Fang, Geng Lei, Wu Jun

7. References

[1] Gao Xiaoding, Wang Chenglong, Zuo He, “Fabric defect recognition algorithm based on statistics
histogram”, Journal of Textile Research, vol.26, no.2, pp. 121-123, 2005.
[2] Gao Shizhong,“Fabric texture analysis based on co-occurrence matrix”, Computer Engineering
and Design, vol.29, no.16, pp. 4385-4388, 2008.
[3] Rangasami L. Kashyap, “Characterization and estimation of two dimensional ARMA models”,
IEEE Transactions on Information Theory, vol.30, no.5, pp. 736-745, 1984.
[4] George R. Cross, Anil K. Jain, “Markov random field texture models”, IEEE Transactions on
Pattern Analysis and Machine Intelligence, vol.5, no.1, pp. 25-39,1983.
[5] Chi-ho Chan, Grantham K. H. Pang., “Fabric defect detection by Fourier analysis”, IEEE
Transactions on Industry Applications, vol.36, no.5, pp. 1267-1276, 2000.
[6] LiuYanbei, XiaoZhitao, WuJun, ZhangFang, “Fabric defect detection method based on optimal
Gabor filter bank”, International Journal of Digital Content Technology and its Applications, vol.5,
no.11, pp. 257-264, 2011.
[7] Fu Li, Sun Hongfan, Yang Yong, et al, “The Technology of image classification on Bayesian
classifier”, Journal of Changchun University of Science and Technology, vol.32, no.1, pp. 132-134,
2009.
[8] Wang Rui, Li Jieping, Lu Zhigang, et al, “Research on the application of remote sensing image
classification based on artificial neural networks”, SCI-Tech Information Development &Economy,
vol.21, no.3, pp. 108-110, 2011.
[9] Wen Jyi, Hwang, Kuo Weiwen, “Fast kNN classification algorithm based on partial distance
search”, Electronics Letters, vol.34, no.21, pp.2062-2063, 1998.
[10] Feng Guohe, “Parameter optimizing for support vector machines classification”, Computer
Engineering and Applications, vol.47, no.3, pp. 123-124, 2011.
[11] Zhang Xuegong, “Introduction to statistical learning theory and support vector machines”, Acta
Automatica Sinica, vol.26, no.1, pp. 32-42, 2000.
[12] B.S.Manjunath, W.Y.Ma., “Texture features for browsing and retrieval of image data”, IEEE
Transactions on Pattern Analysis and Machine Intelligence, vol.18, no.8, pp. 837-842, 1996.
[13] Yuping Li, Weidong Li, Guoqiang Wu, “An intrusion detection approach using SVM and multiple
kernel method”, International Journal of Digital Content Technology and its Applications, vol.4,
no.1, pp. 463-469, 2012.
[14] S.L.Feng, R.Manmatha,V.Lavrenko, “Multiple Bernoulli relevance models for image and video
annotation”, In Proceeding of the IEEE Computer Society Conference on Computer Vision and
Recognition, pp.1063-1069, 2004.
[15] Yun Chenglong, “Feature selection algorithm based on PCA”, Computer Technology and
Development, vol.21, no.4, pp. 123-125, 2011.

622

S-ar putea să vă placă și