[203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

17
JOURNAL OF INDUSTRIAL AND doi:10.3934/jimo.2012.8.325 MANAGEMENT OPTIMIZATION Volume 8, Number 2, May 2012 pp. 325–341 FABRIC DEFECT DETECTION USING MULTI-LEVEL TUNED-MATCHED GABOR FILTERS Kai-Ling Mak and Pai Peng Department of Industrial and Manufacturing Systems Engineering The University of Hong Kong, Pokfulam Road, Hong Kong, China Ka-Fai Cedric Yiu Department of Applied Mathematics The Hong Kong Polytechnic University, Kowloon, Hong Kong, China (Communicated by Kok Lay Teo) Abstract. This paper proposes a new defect detection scheme for woven fab- rics. The proposed scheme is divided into two parts, namely the training part and the defect detection part. In the training part, a non-defective fabric image is used as a template image, and a finite set of multi-level Gabor wavelets are tuned to match the texture information of the image. In the defect detection part, filtered images from different levels are fused together and the constructed detection scheme is used to detect defects in fabric sample images with the same texture background as that of the template image. A filter selection method is also developed to select optimal filters to facilitate defect detection. The nov- elty of the method comes from the observation that a Gabor filter with finer resolutions than the fabric defects yarn can contribute very little for defect segmentation but need additional computational time. The proposed scheme is tested by using 78 homogeneous textile fabric images. The results exhibit ac- curate defect detections with lower false alarms than using the standard Gabor wavelets. Analysis of the computational complexity of the proposed detection scheme is derived, which shows that the scheme can be implemented in real time easily. 1. Introduction. Although techniques of machine vision have been used to solve automated visual inspection problems for over 30 years, the application of such techniques to inspect textured materials, such as textile, paper and wood remains a very challenging problem. Major drawbacks of existing inspection systems are high set-up costs due to extensive pre-inspection set-up by experienced operators, high hardware and software development costs, and high labor and maintenance costs [20]. Further research and development efforts are therefore needed to develop cost- effective solutions to such problems. In textile industries, inspection is conducted to assure fabric quality before any shipments are sent to customers, because defects in fabrics can reduce the price of a 2000 Mathematics Subject Classification. 68U10, 65D18, 68T05. Key words and phrases. Multi-level Gabor wavelet, defect detection, woven fabrics, industrial inspection. 325

Transcript of [203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

Page 1: [203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

JOURNAL OF INDUSTRIAL AND doi:10.3934/jimo.2012.8.325MANAGEMENT OPTIMIZATIONVolume 8, Number 2, May 2012 pp. 325–341

FABRIC DEFECT DETECTION USING MULTI-LEVEL

TUNED-MATCHED GABOR FILTERS

Kai-Ling Mak and Pai Peng

Department of Industrial and Manufacturing Systems Engineering

The University of Hong Kong, Pokfulam Road, Hong Kong, China

Ka-Fai Cedric Yiu

Department of Applied MathematicsThe Hong Kong Polytechnic University, Kowloon, Hong Kong, China

(Communicated by Kok Lay Teo)

Abstract. This paper proposes a new defect detection scheme for woven fab-

rics. The proposed scheme is divided into two parts, namely the training part

and the defect detection part. In the training part, a non-defective fabric imageis used as a template image, and a finite set of multi-level Gabor wavelets are

tuned to match the texture information of the image. In the defect detection

part, filtered images from different levels are fused together and the constructeddetection scheme is used to detect defects in fabric sample images with the same

texture background as that of the template image. A filter selection method is

also developed to select optimal filters to facilitate defect detection. The nov-elty of the method comes from the observation that a Gabor filter with finer

resolutions than the fabric defects yarn can contribute very little for defect

segmentation but need additional computational time. The proposed schemeis tested by using 78 homogeneous textile fabric images. The results exhibit ac-

curate defect detections with lower false alarms than using the standard Gaborwavelets. Analysis of the computational complexity of the proposed detection

scheme is derived, which shows that the scheme can be implemented in real

time easily.

1. Introduction. Although techniques of machine vision have been used to solveautomated visual inspection problems for over 30 years, the application of suchtechniques to inspect textured materials, such as textile, paper and wood remains avery challenging problem. Major drawbacks of existing inspection systems are highset-up costs due to extensive pre-inspection set-up by experienced operators, highhardware and software development costs, and high labor and maintenance costs[20]. Further research and development efforts are therefore needed to develop cost-effective solutions to such problems.

In textile industries, inspection is conducted to assure fabric quality before anyshipments are sent to customers, because defects in fabrics can reduce the price of a

2000 Mathematics Subject Classification. 68U10, 65D18, 68T05.Key words and phrases. Multi-level Gabor wavelet, defect detection, woven fabrics, industrial

inspection.

325

Page 2: [203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

326 KAI-LING MAK, PAI PENG AND KA-FAI CEDRIC YIU

product by 45% to 65% [22]. Although significant resources have been invested intoautomating their manufacturing processes, quality control of the fabrics, at present,is done mainly by human inspection. However, the reliability of manual inspectionis limited by ensuing fatigue and inattentiveness. Indeed, it has been reported thatonly about 70% of defects can be detected by the most highly trained inspectors [21].In general, woven fabrics are typical textured materials which can be characterizedby the dominant spatial frequency and the orientation signature of the underlyingtexture pattern. Hence, automated detection of defects for textile fabrics, whichresults in high quality products and a high-speed production, is definitely needed.

Automated inspection of plain fabrics has attracted a lot of attention in recentyears. [25] reported that 90% of the defects in a plain fabric could be detectedsimply by thresholding. Attempts have also been made to study automated inspec-tion of more complicated fabrics, including twill and denim fabrics. Therefore, theobjective of this paper is to propose an effective defect detection scheme to facilitateautomated detection of defects which often occur in commonly used textile fabrics,including plain, twill, denim weaving fabrics.

Numerous approaches have been reported in the literature to address the problemof detecting defects in woven fabrics, including statistical approaches [4, 29], modelbased approaches [2, 5, 16], and spectral approaches [24]. Among these methods,spectral approaches based on Fourier transform appear to be most suitable for wovenfabrics. However, these approaches are not suitable for detecting small-sized defects(local fabric defects), because the Fourier basis is of infinite length and quantifyingthe contributions of each component is difficult. To overcome the disadvantagesof Fourier transform, multi-scale and multi-orientation analysis techniques, such asGabor analysis and wavelet transform, can be used instead. In particular, Gaboranalysis is a very promising technique for detecting fabric defects, because of therelationship to the current models of early vision of mammals as well as the optimallocalization in the spatial domain and the spatial-frequency domain with respectto the uncertainty principle. Indeed, Escofet et al. [7] have applied a set of multi-scale and multi-orientation Gabor filters to inspect textile defects. Although Gaboranalysis is a very promising approach to characterize the textures of textile fabrics,there is no such guarantee that a detection approach based on Gabor filters canbe successfully applied to detect defects in real time. The reason is that the multi-scale and multi-orientation analysis based on Gabor filters usually uses a large bankof filters [11]. The disadvantages of using a large number of filters are as follows:(1) although it is useful to aid the segmentation process (the detection of defects),a large number of filters will dramatically affect the quality of the classificationprocess; (2) a large number of filters usually lead to a huge computational burdenwhich can prevent effective real-time implementation of the approaches. Therefore,Bodnarova et al. [1] have used the concept of Fisher cost function to design a setof optimal 2-D Gabor filters to discriminate successfully defective texture pixelsfrom non-defective texture pixels. In addition, if complex-valued Gabor functionsare used to segment fabric defects, the contributions from the imaginary parts arerelatively insignificant even though they use up almost 50% of the total amount ofcomputational time required [11]. Hence, they have only used the real parts of theGabor functions in their research work. These studies clearly show that approachesusing a set of Gabor filters are effective methods to detect defects in woven fabrics.However, the properties of a Gabor filter are governed by the filter parameters.

Page 3: [203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

FABRIC DEFECT DETECTION 327

Thus, these parameters have to be determined before a Gabor filter can be used todetect defects.

The selection of parameters for Gabor filters in most of the reported approaches isbased on the concept of dyadic decomposition which inevitably will cause excessivedata storage. Pichler et al. [17] have proposed a method for selecting Gabor filterparameters, which is derived from the adaptive Gabor transform of a studied image.The method can significantly decrease the number of Gabor filters needed in solvingtexture segmentation problems. However, a disadvantage of the method is that onlyGabor filters with their parameters positioned on the rectangular sampling grids canbe chosen. The method does not consider Gabor filters with parameters not positionon the grids but perfectly match the image features. Therefore, the problem ofdefect detection for textile fabrics has not yet been completely solved and extensiveresearch work is required to investigate the problem further. In particular, thechallenging problem of developing effective real-time defect detection approachesbased on Gabor analysis definitely needs further research efforts.

This paper proposes a new defect detection scheme for woven fabrics, based ona new filter design method using the real parts of Gabor functions with differentresolutions for designing optimal Gabor filters to segment defects from the texturebackground of the fabric image being studied. The proposed scheme has severaladvantages. Firstly, multi-level filters are constructed off-line by using the techniqueof genetic algorithms to avoid local minima and a design method is introduced tokeep the number of required filters small. Secondly, complexity analysis shows thatthe proposed detection scheme can be implemented real-time. Finally, results ofnumerical experiments by using a variety of sample fabric images selected froman industrial manual show that the proposed scheme achieves very good detectionaccuracy with a very low false alarm rate compared with those implemented usingstandard Gabor wavelets [11].

The remaining sections of the paper are organized as follows: Section 2 givesa brief description of Gabor wavelets and their applications. Section 3 presents afilter design method and a fabric defect detection scheme. Section 4 describes theperformance evaluation of the proposed scheme by using a variety of fabric sampleimages. Finally, conclusions are summarized in section 5.

2. Gabor filters. A Gabor wavelet function is a complex exponential modulatedby a Gaussian function in the spatial domain, and a set of Gabor wavelet functionscan form a complete but non-orthogonal basis set, i.e., a frame, if appropriate valuesare assigned to their parameters. The general impulse response of a Gabor waveletfunction in the 2D space can be defined as follows:

g(x, y) =1

2πσxσyexp

−1

2

[(x′

σx

)2

+

(y′

σy

)2]

exp (j2πu0x′) , (1)

and [x′

y′

]=

[cos θ − sin θsin θ cos θ

] [xy

](2)

where u0 is the frequency of a sinusoidal plane wave along the x -axis, (σx, σy) referto the variances of the Gaussian function along the x and y axes respectively, and θdenotes the orientation of the function. Fig. 1 shows the real part and the imaginarypart of a typical Gabor wavelet. Since Gabor wavelets possess small bandwidthsin the spatial domain and spatial-frequency domain, they have been widely used

Page 4: [203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

328 KAI-LING MAK, PAI PENG AND KA-FAI CEDRIC YIU

in texture analysis. The real parts of Gabor wavelets can act as blob detectors[3], which are even symmetric, and the imaginary parts of Gabor wavelets can actas edge detectors, which are odd symmetric [12]. In texture analysis, since theimaginary parts of Gabor wavelets contribute insignificantly but they use up nearly50% of the total computational time [11], some researchers only use the real partsof Gabor wavelets in their studies. The real part of a Gabor function is governedby the equation:

ge(x, y) = exp

−1

2

[(x′

σx

)2

+

(y′

σy

)2]

cos (2πu0x′) . (3)

To simplify subsequent discussions, the term “a real Gabor filter” is used to repre-sent the real part of a Gabor function. In fact, Gabor function behaves like otherfilters with a bandpass property, having both frequency bandwidth and orientationbandwidth. The bandwidths depend on the parameters defined in equation (3) andwill be defined in the following section.

(a) (b)

Fig. 1. Perspective view of the real part (a) and the imaginary part (b) of a typicalGabor function.

2.1. Dyadic band decomposition of Gabor filters. Equation (3) shows thatthe parameters, σx, σy, u0, θ, of a real Gabor filter govern its properties. Theseparameters have to be determined before the Gabor filter can be used to filter animage. In general, the dyadic band decomposition method can be used to generatea set of Gabor filters with different parameters, which cover the spatial-frequencydomain uniformly, when studying a problem in the field of texture segmentation ordefect detection. For a real Gabor filter as defined in equation (3), two parametersin the spatial-frequency domain, the half-peak-magnitude frequency bandwidth Brand the orientation bandwidth Bθ, are defined by the equations

Br = log2

[2πu0σx + (2 ln 2)

12

2πu0σx − (2 ln 2)12

](4)

and

Bθ = 2 tan−1

[(2 ln 2)

12

2πu0σy

](5)

respectively [10], where Br is in octaves and Bθ is in degrees. In the dyadic banddecomposition, the frequency bandwidth Br is set to one octave, which is consistentwith the experimental findings about the frequency bandwidth of cells in the visual

Page 5: [203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

FABRIC DEFECT DETECTION 329

cortex [18]. Thus, when the frequency bandwidth Br is equal to one octave, thevariance of the Gaussian function in the x-axis in equation (3) can be obtained bythe equation

σx =3 (2 ln 2)

12

2πu0. (6)

Usually, in the dyadic decomposition, the Gabor filter can be set to be symmetric,i.e., σy = σx. In this way, a set of Gabor filters can be generated by quantizing theorientation θ and the radial frequency u0. The orientation is usually separated intofour or six values. For example, 0, 45, 90 and 135. The radial frequency u0 canbe set to the following values:1√

2, 2√

2, 4√

2, ... , Nc

4

√2 cycles / the image width,

where Nc is the image width in pixels, which should be a power of 2. Hence, assum-ing that the image has a size of 256× 256 pixels and the decomposition considers 4orientations, the quantization method described above can produce a set of 28 (i.e.,4 log2

(Nc

2

)) Gabor filters. Figure 2 displays these 28 real Gabor filters in the spatial

domain. Since the overlaps between the generated filters in the spatial-frequencydomain are small, the set of filters are nearly orthogonal and uniformly cover thespatial-frequency domain. The dyadic band decomposition is therefore one of thecommon methods used in the field of texture analysis. However, such a methodof fixing the Gabor filter parameters may not be effective for texture segmentationbecause of the possibility of imprecise discrimination of different textural regions.For instance, degradation can occur if the spectral component of the objects in animage is located between the centre frequencies of the filters in the multi-channelfilter bank used for the segmentation [14]. In addition, the multi-channel methodso constructed usually requires a large number of filters, which results in massivecomputational efforts and data storages.

2.2. Feature extraction. Gabor expansion is used to expand a signal into a seriesof elementary functions, which are constructed from a single building block bytranslation and modulation (i.e., translation in the spatial-frequency domain). Fora 2D signalf , the Gabor expansion in the discrete case can be expressed by theequations

f(k, l) =∑

m,n,r,s

cmnrsgmnrs(k, l) (m,n, r, s ∈ Z) , (7)

and

gmnrs(k, l) = exp

−1

2

[(k −mTk

σx

)2

+

(l − nTlσy

)2]

exp [j (rkΩk + slΩl)] ,

(8)where k, l ∈ Z and Tk, Tl, Ωk, Ωl are constants. If the set of Gabor waveletsconstitute a frame, such a signal representation is complete. In fact, the 2D Gaborfunction is a product of an elliptical Gaussian and a complex plane wave. Comparingwith equation (1), it can be seen that equation (8) contains also a translation part,although both equations do not have a rotation part. Thus, the orientation, whichmeasures the degree of rotation, is zero, and equation (8) describes the case in whichthe plane wave propagates in the direction of the x- and y-axis, and the 2D Gaborwavelets have the same orientation as the Gaussian envelope.

Page 6: [203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

330 KAI-LING MAK, PAI PENG AND KA-FAI CEDRIC YIU

Fig. 2. Twenty eight real Gabor filters in the spatial domain generated by thedyadic decomposition.

The Gabor wavelet functions and their corresponding Gabor coefficients in equation(7) can be used as features to identify the signal studied. The Gabor coefficients canbe obtained by using several methods, such as calculating a bi-orthogonal auxiliary

Page 7: [203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

FABRIC DEFECT DETECTION 331

function or using the error least squares method. Teuner et al. [23] have used abi-orthogonal auxiliary function to calculate the coefficients of the Gabor waveletfunctions in equation (7). Based on the Gabor coefficients, a new feature parametercalled feature contrast is defined and calculated for every Gabor wavelet function.Only the Gabor wavelet functions with the feature contrasts larger than a thresholdfunction can be kept for use in texture segmentation. However, the design of theGabor wavelets is limited simply to those Gabor wavelets positioned on rectangularsampling grids and constant spacing of the spatial and spatial-frequency resolutioncells. The Gabor wavelets with parameters not exactly positioned on the grid points(e.g., a point between two grid points) will not be considered. The characteristic ofthe design method may result in the failure of finding true image features, especiallywhen the image features do not exactly position on the grid points both in the spacedomain and in the spatial-frequency domain.

3. Filter design and defect detection. This section presents a new filter designmethod for designing real Gabor filters to detect defects in textile fabrics. Themethod can automatically tune the parameters of the Gabor wavelets to match thetexture background under consideration, and does not require the Gabor waveletsto have their parameters positioned on sampling grids.

3.1. Filter design method. Although sometimes the features of a studied imagecan be obtained by detecting the spectral peaks obtained from Fourier transform,this method inevitably results in finding those image components appeared mostfrequently in the image (i.e., the components with highest redundancy). The un-derlying principle of the method proposed in this paper is to identify the mostsignificant spectral components in every level of the pyramidal Gabor decomposi-tion. A set of multi-scale filters can then be constructed to detect fabric defects bycombining the features used to identify the important spectral components in eachlevel.

In order to find a local spectral component of a texture in the i -th level of theGabor decomposition, the real part of a Gabor wavelet function in the i -th levelcan be formulated as

gie(x, y) = exp

−1

2

( x′

σix

)2

+

(y

λiσix

)2 cos

(2πui0x

′), (9)

and [x

y′

]=

[cos θi − sin θi

sin θi cos θi

] ([xy

]−[T ixT iy

]),

where T ix, T iy are the translation parameters along the x- and y-axis respectively,

θi denotes the orientation parameter, σix is the variance in the x-axis, and λi isthe ratio between the variances in the y and x directions. In order to determinethe parameters

σix, λ

i, ui0, θi, T ix, T

iy

of the Gabor wavelet in the i -th level, the

following objective function should be optimized:

E = minwi,T i

x,Tiy,λ

i,θi,ui0

[∑x,y

(IM (x, y)− wigie (x, y)

)2]. (10)

Page 8: [203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

332 KAI-LING MAK, PAI PENG AND KA-FAI CEDRIC YIU

where wi is the Gabor coefficient of the Gabor wavelet in the i -th level, and IMis a defect-free fabric image. In the optimization process for determining the Ga-bor wavelet in the i -th level, the radial frequency ui0 is limited to

[2ui/3, 4ui/3

](ui = 2i−1

√2,i∣∣ 1 ≤ 2i−1 ≤ Nc/4

), and σix can be calculated from equation

(6). According to the physiological findings, the aspect ratio of the Gaussian en-velopes usually lies between 1.5-2.0 [6, 26]. Hence, the variance ratio λi is boundto [1.0, 2.0] in the optimization process. After optimization, a Gabor filter in thei -th level can be determined. The process is repeated until 2i−1 > Nc/4. In thisway, a set of optimal Gabor filters of different levels are designed, which are tunedto match the image features in the different resolution levels.

For an image with the size of 256×256 pixels, the filter design method produces 7real Gabor filters. However, not all the filters obtained are useful to segment defects.Since the size of a fabric defect is usually larger than the width of a fabric yarn, thefiltering results from the Gabor filters with finer resolutions than a fabric yarn cancontribute very little for defect segmentation but need additional computationaltime. Hence, a feature parameter αi can be conveniently defined by the equation

αi =∣∣wi∣∣σix i | i = 1, ..., n; n = log2 (Nc/4) (11)

for measuring the importance of the i -th Gabor filter in fabric defect segmentation.The feature parameter αi should be calculated for every designed filter after theoptimization process. After all Gabor filters are designed by using the method,these Gabor filters are sorted in descending order of σx, i.e.,

gje | j = 1, ..., n

.

Only the Gabor filters which satisfy the following condition are kept for defectsegmentation:

gie | i = 1, ..., J ; α1 ≤ α2 ≤ · · · ≤ αJ > αJ+1; J + 1 ≤ n

(12)

If the condition cannot be satisfied, all the optimal Gabor filters obtained from thefilter design method will be kept. It is reasonable to believe that only the real Gaborfilters which have possible contributions in detecting fabric defects are left.

In general, the objective of defect segmentation is to attenuate the non-defectivebackground areas or accentuate the defect areas, i.e., increasing the contrast be-tween the defect areas and the background. Since this paper only considers detect-ing defects in commonly used fabrics, i.e., plain, denim and twill fabrics, a simpleway to obtain the final Gabor filters for detecting fabric defects is to rotate thefilters by 90 degrees, i.e., the orientation parameters for new filters θinew = θi+ 90.In this way, the optimal Gabor filters are generated, which can be used to detectdefects in textile fabrics.

3.2. Filter optimization. Since industrial optimization problems are often highlynonlinear, global optimization techniques [15, 27] are often required to tackle suchproblems, including the evolutionary algorithms [19], hybrid techniques [28]. Inthis paper, the technique of genetic algorithms [8] is used to minimize the objectivefunction value E defined in equation (10) for each level in order to obtain theparameters of the optimal Gabor filters. Fig. 3 shows the structure of an individualused in the genetic algorithm. The fitness value equals to –E. The basic geneticoperations are selection, reproduction, crossover and random mutation. Individualswith a higher fitness value will have a higher probability of being selected for furtherreproduction.

The roulette wheel selection is used to select two individuals from the entire pop-ulation as the parents for the crossover operation. The crossover operator chooses

Page 9: [203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

FABRIC DEFECT DETECTION 333

a crossover point randomly to divide the two parents into four segments. The firstoffspring can be formed by combining the left segment of the first parent with theright segment of the second parent; and similarly the second offspring can be formedby combining the left segment of the second parent with the right segment of thefirst parent.

Once the crossover operation is completed, the mutation operator will scan eachposition of each individual from left to right and perturb the contents randomlyaccording to a pre-specified mutation rate. In such an operation, a random numberranging from 0.00 to 1.00 is generated for each position of an individual. If thenumber generated is less than the mutation rate, the corresponding position is amutation position, and its content needs to be changed randomly. For the newpopulation, the fitness value will be evaluated again for every individual and thewhole process is repeated.

wi ui0 λi θi T ix T iy

Fig. 3. The individual structure used in the genetic algorithm.

3.3. Defect segmentation. After the optimal Gabor filters have been determinedfrom a non-defective fabric image, a defect segmentation scheme can be constructedto detect defects in fabric sample images which have the same texture backgroundas the non-defective image. Fig. 4 depicts the proposed defect detection scheme.Since the filter design method usually produces more than one optimal filter, theoutput images from these optimal filters need to be fused to further attenuate thebackground noise and accentuate the pixels from the defective area. In the proposedscheme, the image fusion step can be carried out according to the equation

Of =

J∑i=1

(aif i

) (f i = IM ∗ gie; ai = αi/

J∑k=1

αk

), (13)

where ∗ denotes the convolution operation and IM is a fabric sample image. Asimple 7 × 7 median filter is then applied to smooth the filtered fabric image inorder to reduce the amount of noise in the resulting image from the fusion step.Finally, a thresholding step is conducted to produce the binary detection results.The thresholding limits λmax and λmin in this step satisfy the equations λmax = max

x,y∈W|B(x, y)|

λmin = minx,y∈W

|B(x, y)| (14)

where B is the resulting image obtained by applying the optimal real Gabor filtersand the median filter to a defect-free fabric image, W is a sub-window centeredwithin the image B, the size of the sub-window should be suitably chosen to avoidthe edge distortion part of the image, B(x, y) is the grey level of the image pixel inthe position (x, y) of the image B, and λmax and λmin are the maximum value andminimum value of the grey levels of the image pixels in the sub-window, respectively.Hence, the output of the binarization step is a binary image D governed by theequation

D(x, y) =

1, B(x, y) > λmax or B(x, y) < λmin

0, λmin ≤ B(x, y) ≤ λmax, (15)

where D(x, y) is the value of the image pixel in the position (x, y) of the image D.The determination of the thresholding limits λmax and λmin is an important part

Page 10: [203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

334 KAI-LING MAK, PAI PENG AND KA-FAI CEDRIC YIU

of the calibration process before the actual inspection is conducted.

Fig. 4. The proposed defect Segmentation scheme.

4. Experiments and results. The performance of the proposed defect detectionscheme is evaluated by using a database consisting of 78 fabric images selected fromthe Manual of Standard Fabric Defects in the Textile Industry [9]. These images arecaptured by using a digital flat-bed scanner. There are 39 defect-free images in thedatabase. The other images contain different types of fabric defects including 32defects commonly appeared in the textile industry. The fabrics in the database aremainly plain, twill, denim fabrics, although other types of fabrics are also included.In the paper, the images have a size of 256× 256 pixels and an 8 bit grey level.

The performance of the scheme is determined by visually assessing the quality ofthe binary output images. True detections (TD) are recorded when (1) the whiteareas of the binary output image only overlap the areas of the corresponding defects

Page 11: [203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

FABRIC DEFECT DETECTION 335

in the fabric image, and (2) no white area appears in the binary output image ifthe fabric image contains no defect. False alarms (FA) are recorded when the whiteareas appeared in the binary output image do not only overlap the areas of thecorresponding defects in the fabric image, but also appear in some other areassignificantly distant from the defective areas, or when white areas appear in thebinary output image when the fabric image contains no defect. Overall detection(OD) is the sum of TD and FA. Misdetection (MD) means that no white areaappears in the binary output image even if the fabric image contains a defect.

Results of a number of experimental trials have indicated that good optimiza-tion performance can be achieved by using the following settings in the geneticalgorithm: population size = 100, crossover rate = 0.7 and mutation rate = 0.05.Table 1 summarizes all the evaluation results. It can be seen that all 32 fabricdefects have been detected successfully and three false alarms have been recorded.Fig. 5 shows some of the typical detection results. The images in the first columnare the fabric sample images with different types of defects; the images in the sec-ond column are the resulting images from the optimal Gabor filters and the medianfilter, and the images in the third column show the final binary detection resultsafter thresholding the images in the second column. It can be seen that the pro-posed scheme can successfully segment the defects with different shapes, differentpositions and different texture backgrounds.

The proposed scheme Performance (Hit rate)Overall Detection (OD) 78 (100%)True Detection (TD) 75 (96.2%)Misdetection (MD) 0False Alarm (FA) 3 (3.85%)

Table 1: Performance of the defect segmentation algorithm proposed.

Fig. 5(a) shows an image captured from a twill fabric with a defect called harnessbreakdown. The defect only alters the spatial arrangement of neighboring imagepixels and not the mean grey level. It can be clearly seen that the alteration hasbeen increased by the proposed scheme and a good segmentation result is obtained.The parameters of the tuned-matched Gabor filters obtained by the filter designmethod for this fabric image are listed in Table 2.

ui0 ( cycl./image-width) θi λi

u10 = 1.9 θ1 = 15.3 λ1 = 1.49u2

0 = 6.6 θ2 = 179 λ2 = 1.98u3

0 = 9.0 θ3 = 92 λ3 = 1.42u4

0 = 28.7 θ4 = 130 λ4 = 1.49

Table 2: Parameters of the obtained optimal real Gabor filters.

Fig. 5(c) shows an image captured from a plain fabric with a small defect calledmispick which is difficult to identify visually. The defect has been successfullysegmented by using the proposed defect detection scheme. In addition, small-sizedefects, such as burl (Fig.5(b)), warp float (Fig. 5(d)), color fly (Fig. 5(g)), knot(Fig. 5(j)), and big-size defects, such as oil spot (Fig. 5(h)), water damage (Fig.5(i)) have also been successfully discriminated from the backgrounds by the pro-posed defect detection scheme.

Page 12: [203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

336 KAI-LING MAK, PAI PENG AND KA-FAI CEDRIC YIU

The computational complexity of the proposed defect detection scheme is ana-lyzed in order to further evaluate its performance. Assuming that the number ofoptimal Gabor filters obtained by the filter design method is J , the size of the stud-ied image is n×n pixels, and the mask size of the filter generated from each selectedoptimal Gabor filter is m ×m. For each pixel of the image, the convolution stepinvolved in filtering the image by using each optimal filter requires m×m multiplica-tions and (m×m− 1) additions. Hence, for filtering the complete image with each

optimal filter, m2 (n−m+ 1)2

multiplications and(m2 − 1

)(n−m+ 1)

2additions

are required without considering the image edges. If all the optimal filters are con-sidered, J×m2 (n−m+ 1)

2multiplications and J

(m2 − 1

)(n−m+ 1)

2additions

are required to filter the complete image being studied. In the image fusion step,equation (13) requires J × (n−m+ 1)

2multiplications and (J − 1)× (n−m+ 1)

2

additions to fuse all the resulting images from the optimal Gabor filters. If thecomparison operations needed by the median-filter step and the binarization stepare ignored, the scheme entirely requires Jm2 (n−m+ 1)

2+J (n−m+ 1)

2multi-

plications and J(m2 − 1

)(n−m+ 1)

2+ (J − 1) (n−m+ 1)

2additions to process

one detected image. Assuming that the mask size of the optimal filters is 7× 7 andthe size of a fabric image under consideration is 256× 256 pixels. The filter designmethod employs 7 optimal real Gabor filters. Therefore, the proposed detectionscheme involves at most 21.875 million multiplications and 21.375 million additionsfor each image being studied, without considering the median filter step and thebinarization step. If the camera employed can capture 4 frames of fabric images persecond, the scheme requires the processing of approximately 173 million instruc-tions per second. For the fabric image shown in Fig. 5(a), the proposed schemerequires 12.5 million multiplications and 12.1875 additions to process the imagebecause only four optimal Gabor filters are generated. In the real time situation, ifthe camera used can capture 4 frames per second, the scheme requires about 98.75million instructions per second to inspect the fabric images with the same texturebackground as displayed in Fig. 5(a). Therefore, it is possible to implement theproposed defect detection scheme in real time.

Comparing to the general multi-channel Gabor filtering approaches using thedyadic decomposition, the proposed scheme uses much fewer Gabor filters. Theobvious advantage is the reduction of computational efforts which can result in afaster defect detection speed. Although the proposed defect detection scheme usessmaller number of Gabor filters, the experimental results obtained are excellent.We compare our method with the results given in [1] and the standard Gabor filtersgiven in [11]. The results are summarized in Table 3. We also calculate the numberof floating point operations in terms of Gflops (Giga FLoating point OPerationsper Second) for an image with size 150x150. We assume conservatively 7 Gaborwavelets are needed. Two different mask sizes are shown at the same time. Theresults are summarized in Table 4. From the comparison results, it shows that theproposed defect detection scheme is not only efficient, but also effective and robustin detecting fabric defects.

Page 13: [203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

FABRIC DEFECT DETECTION 337

Percentages SGLC[1]

Correlationmethod[1]

Textureblob de-tection[1]

STFT(Thresh-old =180) [1]

STFT(Thresh-old = 80)[1]

StandardGaborfilter [11]

Multi-levelGaborfilter(m=7)

Overall De-tection

88 100 76 60 96 98.7 100

Misdetection 12 0 24 40 4 1.28 0

False alarm 32 0 68 0 76 7.69 3.85

Table 3: Comparison with other methods.

SGLC[1]

Correlationmethod[1]

Textureblob de-tection[1]

STFT [1] StandardGaborfilter [11]

Multi-levelGaborfilter(m=7)

Multi-levelGaborfilter(m=9)

Gflops 2.8 30.2 3.5 53.2 14.4 7.1 11.4

Table 4: Computational complexity compared with other methods.

5. Conclusions. When a piece of textile fabric with defects leaves the productionline, the locations, the shapes and the sizes of the defects normally cannot bepredetermined. A conventional supervised defect detection approach developedon the basis of some typical defect types therefore may not be very suitable inpractice and an unsupervised approach is usually preferred. However, the design ofan unsupervised approach is rather complicated and the approach usually requiresexcessive computational efforts because of the large number of filters used. In thispaper, a novel semi-supervised defect detection scheme which consists of severaloptimal real Gabor filters has been proposed to facilitate automated inspection oftextile fabrics. In the development of the detection scheme, a new filter designmethod has also been constructed to design the optimal real Gabor filters whichare tuned to match the texture background of a non-defective fabric image underconsideration.

The performance of the defect segmentation scheme has been extensively evalu-ated by using 78 sample images taken from the Manual of Standard Fabric Defectsin the Textile Industry, which include (1) different types, different sizes and dif-ferent shapes of defects, and (2) different texture backgrounds. The experimentalresults obtained have shown that the proposed scheme is an efficient, effective androbust defect detection method for woven fabrics. In addition, the computationalanalysis conducted has also shown that the proposed defect detection scheme is notcomputational demanding and is suitable for the real time inspection.

Acknowledgments. The authors gratefully acknowledge the financial support fromthe Research Grants Council of the Hong Kong Special Administrative Region, PRCunder the grant HKU 714807E for this project.

Page 14: [203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

338 KAI-LING MAK, PAI PENG AND KA-FAI CEDRIC YIU

(a) harness breakdown

(b) warp burl

(c) mispick

(d) warp float

(e) mispickFig. 5. Fabric samples with harness breakdown (a), warp burl (b), mispick (c),

warp float (d), and mispick (e) respectively and the corresponding defectsegmentation results.

Page 15: [203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

FABRIC DEFECT DETECTION 339

(f) foreign fiber

(g) color fly

(h) oil spot

(i) water damage

(j) knotFig. 5 (continued). Fabric samples with foreign fiber (f), color fly (g), oil spot (h),

water damage (i) and knot (j), respectively and the corresponding defectsegmentation results.

Page 16: [203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

340 KAI-LING MAK, PAI PENG AND KA-FAI CEDRIC YIU

REFERENCES

[1] A. Bodnarova, M. Bennamoun and S. Latham, Optimal Gabor filters for textile flaw detection,

Pattern Recognition, 35 (2002), 2973–2991.[2] J. G. Campell, C. Fraley, F. Murtagh and A. E. Raftery, Linear flaw detection in woven

textiles using model-based clustering, Pattern Recognition Letters, 18 (1997), 1539–1548.[3] D. Casasent and J. S. Smokelin, Neural net design of macro Gabor wavelet filters for

distortion-invariant object detection in clutter , Opt. Eng., 33 (1994), 2264–2271.

[4] D. Chetverikov and A. Hanbury, Finding defects in texture using regularity and local orien-tation, Pattern Recognition, 35 (2002), 2165–2180.

[5] F. S. Cohen, Z. Fan and S. Attali, Automated inspection of textile fabrics using textural

models, IEEE Trans. Pattern Anal. Machine Intell., 13 (1991), 803–808.[6] J. G. Daugman, Uncertainty relation for resolution in space, spatial frequency, and orien-

tation optimized by two-dimensional visual cortical filters, J. Optical Soc. Amer., 2 (1985),

1160–1169.[7] J. Escofet, R. Navarro, M. S. Millan and J. Pladelloreans, Detection of local defects in textiles

webs using Gabor filters, Opt. Eng., 37 (1998), 2297–2307.

[8] D. E. Goldberg, “Genetic Algorithm in Search, Optimization and Machine Learning,”Addison-Wesley, New York, 1989.

[9] Graniteville Company, “Manual of Standard Fabric Defects in the Textile Industry,” SouthCarolina, 1975.

[10] A. K. Jain and F. Farrokhnia, Unsupervised texture segmentation using Gabor filters, Pattern

Recognition, 24 (1991), 1167–1186.[11] K. L. Mak and P. Peng, Detecting defects in textile fabrics with optimal Gabor filters, Inter-

national Journal of Computer Science, 1 (2006), 1306–4428.

[12] R. Malhotra, K. R. Namuduru and N. Ranganathan, Gabor filter-based edge detection, PatternRecognition, 25 (1992), 1479–1494.

[13] J. Malik and P. Perona, Prettentive texture discrimination with early vision mechanisms, J.

Opt. Soc. Am., A7 (1994), 923–932.[14] S. G. Mallat, Multifrequency channel decomposition of images and wavelet models, IEEE

Trans. Acoust. Speech, Signal Processing, 37 (1989), 2091–2110.

[15] T. L. Mason, C. Emelle, J. van Berkel, A. M. Bagirov, F. Kampas and J. D. Pinter, Integratedproduction system optimization using global optimization techniques, Journal of Industrial

and Management Optimization, 3 (2007), 257–277.[16] S. Ozdemir and A. Ercil, Markov random fields and Karhumen-loeve transforms for defect

inspection of textile products, Proc. IEEE Conf. Emerging Technologies and Factory Automa-

tion, 2 (1996), 697–703.[17] O. Pichler, A. Teuner and B. J. Hosticka, An unsupervised texture segmentation algorithm

with feature space reduction and knowledge feedback , IEEE Trans. Image Processing, 7 (1998),53–61.

[18] D. A. Pollen and S. F. Ronner, Visual cortical neurons as localized spatial frequency filters,

IEEE Transactions on Systems, Man and Cybernetics, 13 (1983), 907–916.

[19] T. Ray and R. Sarker, EA for solving combined machine layout and job assignment problems,Journal of Industrial and Management Optimization, 4 (2008), 631–646.

[20] R. Sablatnig, Increasing flexibility for automatic visual inspection: The general analysisgraph, Machine Vision and Applications, 12 (2000), 158–169.

[21] H. Sari-Sarraf and J. S. Goddard, Vision system for on-loom fabric inspection, IEEE Trans.

Ind. Appl., 35 (1999), 1252–1259.

[22] K. Srinivasan, P. H. Dastoor, P. Radhakrishnaiah and S. Jayaraman, FDAS: A knowledge-based framework for analysis of defects in woven textile structures, J. Textile Inst., 83 (1992),

431–448.[23] A. Teuner, O. Pichler and B. J. Hosticka, Unsupervised texture segmentation of images using

tuned matched Gabor filters, IEEE Trans. Image Processing, 4 (1995), 863–870.

[24] D. M. Tsai and C.-Y. Heish, Automated surface inspection for directional textures, ImageVis. Comput., 18 (1999), 49–62.

[25] J. Wang, R. A. Campbell and R. J. Harwood, Automated inspection of carpets, Proc. SPIE,

2345 (1995), 180–191.[26] M. A. Webster and R. L. De Valois, Relationship between spatial frequency and orientation

tuning of striate cortex cells, J. Optical Soc. Amer., A2 (1985), 1124–1132.

Page 17: [203] Fabric Defect Detection Using Multi-level Tuned-matched Gabor Filters

FABRIC DEFECT DETECTION 341

[27] C. Z. Wu and K. L. Teo, Global impulsive optimal control computation, Journal of Industrialand Management Optimization, 2 (2006), 435–450.

[28] K. F. C Yiu, Y. Liu and K. L. Teo, A hybrid descent method for global optimization, Journal

of Global Optimization, 28 (2004), 229–238.[29] Y. F. Zhang and R. R. Bresee, Fabric defect detection and classification using image analysis,

Text. Res. J., 65 (1995), 1–9.

Received November 2010; 1st revision May 2011; final revision August 2011.

E-mail address: [email protected]

E-mail address: [email protected]

E-mail address: [email protected]