Shuangbao Ma* , Wen Liu** , Changli You** , Shulin Jia** and Yurong Wua*An Improved Defect Detection Algorithm of Jean Fabric Based on Optimized Gabor FilterAbstract: Aiming at the defect detection quality of denim fabric, this paper designs an improved algorithm based on the optimized Gabor filter. Firstly, we propose an improved defect detection algorithm of jean fabric based on the maximum two-dimensional image entropy and the loss evaluation function. Secondly, 24 Gabor filter banks with 4 scales and 6 directions are created and the optimal filter is selected from the filter banks by the one-dimensional image entropy algorithm and the two-dimensional image entropy algorithm respectively. Thirdly, these two optimized Gabor filters are compared to realize the common defect detection of denim fabric, such as normal texture, miss of weft, hole and oil stain. The results show that the improved algorithm has better detection effect on common defects of denim fabrics and the average detection rate is more than 91.25%. Keywords: Defect Detection , Denim Fabric , False Defect Removal , Gabor Filter , Iterative Segmentation 1. IntroductionFabric defect detection is the most important key to control the fabric quality [1,2], however, the inspection process of most denim fabric manufacturers in China mainly relies on manual inspection, which requires heavy labor and may cause some physical or mental harm to the workers. More impor¬tantly, the efficiency of manual detection is very low, and the detection accuracy is only 60%–70% [3]. Usually, the jean fabric manufacturers use the white cotton yarn as the weft yarn to interwoven with the pure indigo-dyed cotton yarn as the warp yarn to produce the twill fabric. Therefore, the surface of the denim fabric has the exact same period, significant direction and uniform texture comparing to the traditional fabric [4]. Currently, these detection methods for fabric texture can be divided into four categories [5]. The statistical method mainly extracts the feature images of the fabric texture to detect defects, which includes gray-level co-occurrence matrix (GLCM) morphology. However, these based on structure methods have low detection rate for jean fabric according to the paper [6]. The modeling methods can obtain good effect such as pixel neighboring structure, statistical feature and different pixels linear structure feature, but these algorithms are very complex to realize [7]. The artificial neural networks with the ability of self-learning or self-organization are used to detect the fabric defects, which is not suit to detect the defects of jean fabric [8,9]. The frequency domain analysis such as power spectrum, multiresolution characteristic and spatial-frequency domain characteristic is utilized to extract the features of fabric texture, which commonly includes Fourier transform, wavelet transform and Gabor transform [10,11]. The paper presents an improved defect detection algorithm of jean fabric based on the optimized Gabor filter and selects the optimal Gabor filter from the Gabor filter banks utilizing the maximum two-dimensional image entropy and loss evaluation function. This paper is structured as follows. The Section 2 discusses the optimal Gabor filter. In Section 3, we propose the process of defects detection algorithm. In Section 4, we analyze and compare the optimal Gabor filter based on one-dimensional and two-dimensional gray image entropy in fabric defect detection. Section 5 concludes this paper. 2. Optimal Method of Gabor Filter2.1 Two-Dimensional Gabor FilterThe Gabor filter is widely used in image processing, computer vision and other fields because of its superior performance in extracting image local space and frequency domain information. The two-dimensional Gabor filter in the spatial domain can write as
(1)[TeX:] $$\begin{array}{l} \mathrm{g}(x, y, \lambda, \theta, \psi, \sigma, \gamma)=\exp \left(-\frac{\hat{x}^{2}+\gamma^{2} \hat{y}^{2}}{2 \sigma^{2}}\right) \exp \left[\left(2 \pi \frac{\hat{x}}{\lambda}+\psi\right) i\right] \\ \text { where } \hat{x}=x \cos \theta+y \sin \theta, \hat{y}=-x \sin \theta+y \cos \theta \end{array}$$and is the wavelength of Gabor filter, is the direction of the filter, is the phase offset, is the bandwidth of Gabor filter and is the spatial aspect ratio, which determines the shape of the filter. 2.2 Optimal Gabor FilterIn image processing, the Gabor filter banks are usually designed as 4-scale 6-direction, which gives rise to large amount of data. Following consideration to the real-time problem in practical application and ensuring the accuracy rate of defects detection, an optimal Gabor filter based on the maximum two-dimensional imaging entropy and loss evaluation function is very necessary to discuss. The two-dimensional image entropy can write as
where [TeX:] $$P_{j j}$$ represents the probability of occurrence of a spatial feature. The denim fabric texture image obtained is equally divided into [TeX:] $$N * N$$ blocks, the mean value of gray in each sub block D and the lose evaluation function L are defined as
(3)[TeX:] $$D=\frac{1}{n * n} \sum_{i=1}^{n} \sum_{j=1}^{n} I(i, j), \quad L=\frac{D_{\max }-D_{\min }}{D_{\max }+D_{\min }}=-1+\frac{2}{1+\frac{D_{\min }}{D_{\max }}}$$where [TeX:] $$I(i, j)$$ represents the mean value between the corresponding gray value and the neighboring gray value. It can be seen from formula (3) that the loss evaluation function increases with the increasing [TeX:] $$D_{\min } / D_{\max },$$ which means that the greater the difference between the pixel mean value [TeX:] $$D_{\max } \text { and } D_{\min }$$ of the sub image is, the more obvious the difference between the defect point and the normal texture, so it is easy to segment defects from the normal texture image. 3. Improved Defect Detection AlgorithmThe steps of this improved defect detection algorithm based on optimized Gabor filter utilizing the maximum two-dimensional image entropy and loss evaluation function can be conceived as follows. Step 1 (Preliminary training of jean fabric defects images): The main task of preliminary training defects image is converting color defects image into a grayscale image according to the amount of calculation in the processing. The transfer function is defined as
where G1 indicates the gray value of processed image. Step 2 (Reconstructing Gabor filter): The 24 Gabor filter bank with 4 scales and 6 directions are constructed. Then according to formulas (1) and (2), the two-dimensional image entropy of 24 sub-graphs after filtering are calculated respectively to determine the optimal filtering direction. Step 3 (Selecting the optimized Gabor filter and filtering): The defected images are separated into blocks and the loss evaluation function of each block are calculated, then the maximum loss evaluation function is selected as the optimized Gabor filter. Then the optimized Gabor filter is used to filter these denim defect images. Step 4 (Locating these defects): In order to segment the defects from the defect images, defect texture image segmentation is needed. In this paper the iterative method is chosen to segment the sub-graphs and the flow of the algorithm is as follows. (a) Traversing the defect texture image to obtain the maximum gray value [TeX:] $$G_{\max }$$ and the minimum gray value [TeX:] $$G_{\min },$$ then the initialization threshold is set as [TeX:] $$T=0.5\left(G_{\max }+G_{\min }\right);$$ (b) According to the initialization threshold T, the texture image is divided into two parts. One part is set as the average value [TeX:] $$V_{0}$$ of the gray, the other part is set as the average value [TeX:] $$V_{1}$$ of gray; (c) Calculating the threshold by using [TeX:] $$T=0.5\left(V_{0}+V_{1}\right),$$ if T is not changed, then T is the optimal threshold. Otherwise, return to the step (b) to continue this calculation. This step is used to iterate segment the common denim fabric defect image and the effect of the segmentation binary image of the defect textures image is shown in Fig. 1. The effect of binary segmentation on weft missing, hole-breaking, and oil contamination are presented in sub-graphs (a1), (a2), and (a3), respectively in Fig. 1 and the sub-graphs (b1), (b2), and (b3) are the corresponding false defect removal diagram, respectively. Step 5 (Eliminating false defect dots): As shown in Fig. 1, the iterative segmented binary image contains a large amount of isolated bright noises, which has an impact on the detection of defect dots, so it is necessary to eliminate these false defect dots. It is found that these false defect dot noises are not isolated pixels, but a small collection of pixels. There are many ways to obtain the largest connected region in the binary image. This paper proposes a false defect dots algorithm based on the edge of the defects. Firstly, the edge detection operator is selected to perform edge detection on the binary image after the segmentation, so the edge image of the defect regions is obtained. Secondly, the image of the defects for detection and the segmented image are scanned and compared. When non-zero pixels are found in the segmented image, discriminate the same position of the image to be detected. If the corresponding position of the image to be detected is a non-zero pixel, it is a false defect and the pixel corresponding to the position in the binary image is set to zero. The false defects elimination effect diagram is illustrated in Fig. 1(b1–b3). Step 6 (Algorithm end). 4. Results and AnalysisIn order to test the practicability of this proved algorithm, this paper selects a common denim fabric defect sample image, which including normal image, weft missing, hole-breaking and oil pollution respectively as shown in Fig. 2(a1–a4). The segmentation sub-images of these four test images are shown in Fig. 2(b1–b4) and it is very easy to find that these defects are very remarkably. The optimized Gabor filter is selected by one-dimensional entropy of image, which is named as algorithm 1, and the optimized Gabor filter is selected by two-dimensional image entropy and loss evaluation function, which is named as algorithm 2 in this paper. These two filters are utilized to process four denim fabric defect images, and the results of algorithm 1 and algorithm 2 are shown in Fig. 2(c1–c4) and Fig. 2(d1–d4), respectively. As shown in Fig. 2, by comparing the sub-graphs (c2)–(c4) and the sub-graphs (d2)–(d4), especially for the oil pollution images, Algorithm 2 can achieve higher accuracy than Algorithm 1. In order to test the detection effect of this improved algorithm on the defect of denim fabric. This paper selects the normal texture of denim fabric production line and the four texture types of latitude, hole and oil stain, and the type of each defect is 100 sheets. There are 400 defect samples in the database. Using the algorithm proposed in this paper to detect the image of four types of denim fabric samples. The defect detection effect diagrams of the improved algorithm for different sizes are shown in Fig. 3. It is notable to find that the algorithm is suit to different size denim fabric defect images. Table 1.
Table 2.
The detection results using Algorithms 1 and 2 are shown in Tables 1 and 2, respectively. It can be seen from Table 1 that algorithm 1 can detect four defects of denim fabric defect, with an average detection rate of 86.75%, and the highest detection rate is 95% for normal texture. While the improved algorithm has better detection effects for defects of denim fabrics, with an average detection rate of 91.25%, and the highest detection rate is 99% for normal texture as shown in Table 2. 5. ConclusionThis paper proposes an improved algorithm for defect detection of jean fabric by using the optimized Gabor filter with the two-dimensional image entropy and the loss evaluation function. This improved algorithm can locate the defect and eliminate false defect dots. In order to verify the effectiveness of the improved algorithm, two algorithms are compared to process 400 defect images with four types of defects such as normal texture, weft missing, hole and oil stain in denim fabric in the experiment. The results show that the improved algorithm we proposed can achieve good detection results, and the average detection rate of common defects of denim is more than 91.25%. With the development of the deep learning, the emergence of deep learning detection models such as AlexNet, VGG, and RESNET, which will bring some new breakthroughs to the research of fabric defect detection and become a hot research spot for denim defect detection. BiographyBiographyBiographyBiographyYurong Wuhttps://orcid.org/0000-0002-4510-0385She received a M.A. degree in measurement technology and instruments from Wuhan University in 2003. Since March 2019, she is an associate professor at Wuhan Textile University in Wuhan, China. Her current research interests include modeling and analysis of power, image processing, and deep learning. References
|