Inspection of Cotton Woven Fabrics Produced by Ethiopian Textile Factories Through a Real-Time Vision-Based System

ABSTRACT Fabric is produced by the weaving process through the interlacement of warp and weft yarn or knitting process through the loop formation of yarn. During these processes, there is a possibility of fabric defect formation which hinders the acceptability by the fabric consumers. Ethiopian textile factories practiced a human inspection system, a traditional means of detecting fabric quality, for monitoring textile fabric defects. Manual fabric defect detection helps to instantly correct small defects, but it is time-consuming and results in human error due to fatigue and lack of concentration. Moreover, the accuracy of recognizing the defect highly depends on the mental status of the person that checks the defects. This initiated the development of a better fabric defect identification system that helps textile experts to detect fabric defects with better precision and speed. This study proposes a vision-based fabric inspection system for plain woven gray fabrics with a uniform texture. Accordingly, a comprehensive Fabric Defect Detection Database (FDDD) is constructed. The fabric significant features were calculated using a convolutional neural network (CNN) which is a state-of-the-art technology in image processing and task analysis. The experimental result of this study shows an average accuracy of about 89% in fabric defect recognition.


Introduction
The textile manufacturing process consists of a series of complex and orderly processes such as spinning, weaving or knitting, dyeing, printing and finishing, and garment manufacturing.The stability and quality of the textile fabric produced by the whole production line are crucial to the enterprise (Kumar 2011).There are many factors that affect the final product on the production line of textile manufacturing.These include raw materials quality, mechanical factors, dye type, yarn size, and human factors (Xu et al. 2020).In general, textile fabric defects refer to defects on the surface of the fabric.There are many types of fabric defects, most of which are caused by process problems and machine malfunctions.Defects will affect the quality of the final product, resulting in a great waste of all kinds of resources (Bullón et al. 2017;Sadik and Islam 2014).Among these, fabric with defects results in a loss of 40-70% in price (Shady et al. 2006) where a loss of about 30% also occurs in the transportation system (Yu, Zhaoyang, and Jing 2009).As replacing the defective fabric is a difficult task, defect detection has to be implemented at each stage of the manufacturing process.Because defects in the previous stage will affect the later stage in the process of fabric manufacturing.Therefore, the fabric defects should be identified, classified, and controlled at each processing step to reduce the loss of enterprises earlier and faster (Singh and Jaspreet 2016;Zheng, Yu, and Jin 2013).
Thus, effective fabric defect detection is one of the key measures for modern fabric manufacturers to control costs, enhance product value and core competence (Shahrabadi et al. 2022).In the traditional method, inspection to identify fabric defects is carried out by workers at a quality control table with a high-power consuming light source illuminated on the fabrics, and they will identify the presence of defects.This method has high power consumption and causes stress and fatigue to workers' eyes while undertaking visual inspection to attain high productivity (Fan et al. 2021).Moreover, the visual inspection method is an inadequate and expensive process due to its high timeconsumption with very low accuracy of fabric defect detection.As the manual inspection method is a tedious process, automatic fabric defect detection is necessary for the textile industry to reduce costs and increase productivity (Li et al. 2021).
The core of a complete online textile fabric defect detection system is the detection algorithms.Many researchers and engineers in this field have devoted themselves to the design of robust and efficient algorithms within the past few decades (Mahajan, Kolhe, and Patil 2009;Yaşar Çıklaçandır, Utku, and Özdemir 2019).Compared to manual fabric defect detection, automatic detection systems are more effective with higher efficiency (Li et al. 2021).This study is proposed to improve defect detection accuracy and efficiency through an advanced vision-based fabric inspection system for the textile industries.
Generally, fabric defect detection algorithms can be categorized as traditional algorithms and learning-based algorithms (Li et al. 2021).The traditional algorithms are based on feature engineering with prior knowledge of statistical, structural, spectral, and model-based methods (Alper, Vural, and Hakan 2014;Zhao et al. 2020;Çıklaçandır, Utku, and Özdemir 2022).The learning-based algorithms can be further divided into classical machine learning algorithms and deep learning algorithms.Machine learning uses mathematical algorithms to learn and analyze data to make predictions and take decisions in the future, which has been widely employed in recent years and achieved stratifying results in various disciplines and industries (Yaşar Çıklaçandır, Utku, and Özdemir 2021).Deep Learning Algorithms have been applied to fabric defect detection problems and have achieved satisfying results for the improvement of textile product quality and production efficiency (Barua et al. 2020;Subrata et al. 2020).A prototype for a fabric defect recognition system has been formulated based on the identification of the fabric using its texture and surface morphological structure features.Different varieties of the deep learning approach such as the AlexNet (Krizhevsky, Ilya, and Geoffrey 2017) and VGGNet-16 (Tammina 2019) used CNN model as a potential candidate for extracting features from the fabric images.
The deep learning-based object detector can be classified as a one-stage detector and two-stage detectors (Wu, Doyen, and Steven 2020).One-stage detector has fast detection speed but fails to meet detection accuracy requirements, whereas two-stage algorithms have vice versa effect.Both types of detection algorithms have almost similar advantages and disadvantages in fabric defect detection.Higher detection accuracy and faster detection speed are required in the textile industry.Therefore, the algorithm should be selected according to the actual application scenarios and requirements to find the balance between efficiency and accuracy (Li et al. 2021).Recently, singleshot multibox detector (SSD) based on convolutional neural network (CNN) has obtained good performance in object detection.Some improvements have been made to the fabric defect scenario, and the experimental results show rationality and effectiveness (Dlamini et al. 2022;Liu et al. 2018).
Even though deep learning methods bring huge impact in the segmentation and classification of defects, there is still inability to meet multiscale defect detection in the practical applications (Zhou, Li, and Liang 2021).Many studies reveal that even the best model is still troubled by the large size of the problem (Rasheed et al. 2020).In most cases, the datasets used for verifying the proposed models were widely based on online data, such as from TILDA, not on the real data obtained directly from the industries.Furthermore, challenges to the training process of deep learning emerge from obtaining defective image data compared to normal defect-free samples (Li, Weigang, and Jiahao 2017).This resulted in a reduction in the accuracy of existing detection models.The actual textile production line requires high real-time performance of the algorithm which demanded high execution efficiency.
In this study, a huge number of plain-woven fabric images with major defects and defect free were collected, and a prototype CNN model was developed to examine the defect types offline and/or in real-time.The accuracy and convergence time of the newly proposed CNN model is compared to the VGGnet model.The study provided an improved way to inspect and detect plain woven fabric defects either online and/or offline.

Materials and implementation tools
In this study, pure cotton gray plain-woven fabrics, Cannon 450D camera, lighting system, transport encoder, frame grabbers, and computer are used.The research is undertaken on MATLAB student version R2022a, operated under the Microsoft Windows 10 64-bit operating system of a Hp Pavilion laptop.The laptop embeds Intel(R) Core (TM) i7-4710MQ CPU @ 2.60 GHZ processor, with 8 GB RAM.

Dataset preparation
The study follows an experimental research design to develop a fabric defect recognition system using a deep learning approach.Fabric images containing different orientations, noise levels, camera orientations, and magnification power were collected.Four typical fabrics, namely, defect-free, misspick, double-pick, and hole defects, were selected to be analyzed in this study.About 600 samples of fabric images for each type of fabric defect are directly collected from Bahir Dar textile share company.Samples of the collected images are shown in Figure 1.Among the collected fabric images, 70% were used for training, whereas 30% were used for testing the performance of the proposed models.A total of 20 different experiments are conducted by using the different combinations of the datasets obtained using random splitting techniques.
Digitalized defective and defect-free fabric images were first preprocessed, followed by feature extraction using the optimal feature extraction techniques, and finally, the optimal features are identified with the best pattern extraction techniques as shown in Figure 2. In doing so, the study follows the image processing steps such as image analysis and understanding to automatically classify the fabric into respective classes.

Data augmentation
The effects of over-fitting and vanishing gradients are the most common challenges of designing the CNN model.These effects on image data are reduced by artificially enlarging the dataset using labelpreserving transformations.Accordingly, the dataset size is enlarged by applying augmented techniques in this study.

Pre-processing
The pre-processing component is responsible for enhancing the fabric image to the main image processing activities.Undesired noises appearing on the fabric images such as rotated, scaled, zoomed, and blurred are removed.Mainly, two tasks are performed in this step: image size normalization and image quality enhancement.

Image size normalization.
As the size of images is not used as a feature for categorization in the proposed design, different fabric images need to be resized to similar values for training and testing the proposed CNN model.Thus, all captured fabric images are normalized to a fixed size as they do not have the same size initially.The skew angle detection and correction were also undertaken in this process.
Image quality enhancement.Due to various reasons, the quality of captured images does not show all the necessary features used for discriminating the different fabric images.The input image quality is improved by using appropriate noise filtering techniques such as PSNR (signal-to-noise ratio) and MSE (mean square error).The MSE and PSNR are calculated according to equations 1 and 2.  PSNR ¼ 10log 10 A higher value of the PSNR indicates better quality of the noise removal techniques and inverse for MSE.In addition, the brightness level of the fabric images is enhanced in this study, and the effect of illumination is normalized through histogram equalization techniques in this study.

Feature extraction
The descriptive features of the fabric sample such as color, size, shape, and texture features are used to design the recognizer system.The hierarchical fabric image feature is extracted directly from the fabric image through the CNN model.CNN is designed to automatically and adaptively learn spatial hierarchies of features through backpropagation by using multiple building blocks, such as convolution layers, pooling layers, and fully connected layers (Yamashita et al. 2018).

Model evaluation
The fabric defect detection network model is evaluated by the precision and the time taken for testing, which includes precision, recall rate, and error rate.The test time refers to the time it takes for the algorithm to test one image.The shortest test time of the algorithm has important practical significance.Accordingly, precision, recall, and error rate are defined as Equations 3, 4, and 5, respectively.
Where, TP is the number of positive samples determined by the model to be positive, TN is the number of negative samples determined by the model to be actually negative, FP is the number of positive samples determined by the model but actually negative samples, and FN is the number of negative samples determined by the model but actually positive samples, as shown in Table 1.

Result and discussion
In this study, the major factors affecting the performance of the designed model are identified.Image quality, environmental conditions of fabric image digitalization, camera orientation, and magnification power are some of the major factors affecting the performance of the proposed model.The RGB image of the fabric was used to check the model, and experimental studies shows the accuracy improvement from 75.2% to 82.44% by using AlexNet model as shown in Figure 3.
A new fabric defect recognition model was developed in this study.A recognition performance of 88.14%, a training performance of 4 h, and an average elapsed time of 25-s time for the recognition of a new unseen fabric image were achieved.According to the experimental study, a newly proposed model yields a better recognition performance than the existing AlexNet model in the case of fabric identification system.Figure 4(a,b) depicts the recognition performance obtained from the newly proposed model.The performance of fabric defect identification of the newly proposed CNN model is summarized in Table 2.It showed that from the total 312 tested images, 275 (88.1%) were correctly classified and 37 (11.9%) were incorrectly classified.The result of the proposed model shows that the classification accuracy of 1 (defect-free), 2 (hole), 3 (miss pick), and 4 (double pick) fabric images were 89.8%, 98.9%, 95.2%, and 71.9%, respectively, with an overall recognition accuracy of 89%.This indicated that the model achieves better results in the identification of hole defects and less performance in double-pick fabric defects.As per researchers' finding, the latter case may result due to the pattern similarity between double-pick defects and defect-free fabric images in some cases.This was mainly observed when uneven warp or weft yarns are inserted as a double pick, and the system considers them as defect-free images.Figure 5 shows image of double-pick fabric defect (marked in blue) with low pattern intensity, which is ambiguous to differentiate it easily from defect-free images.This is not the only reason for the low performance of identifying the defect and further study needs to be undertaken in the future.
Proper feature extraction of invariance to the image quality variations due to illumination, scaling, and deformations is critical to developing an efficient recognition system.In this study, different experimental schemes were implemented to identify the optimal feature extraction technique.In the first scheme, the grayscale fabric images were used to extract features in less training and testing time.Compared to three channels in RGB, processing one channel in grayscale minimizes the recognition time by three times.However, this results in less performance compared to the RGB fabric images due to certain errors caused when it changed into grayscale, especially in double picks and missed picks.Thus, another localized channel conversion system needs to be imposed to use the grayscale as an efficient scheme of fabric defect recognition system.
Factors affecting the performance of the CNN model such as the number of convolutional layers, pooling layers, fully connected layers, activation, and hypermeter were considered during initial pilot tests.Restructuring, limiting the learnable parameters, and hyper-parameters improved the performance of the CNN model (Khan et al. 2020).Accordingly, a better result was registered when 11 hidden layers were considered to construct the CNN model in this study.A significant performance improvement was observed, while batch normalization layers were used in each convolutional layer immediately next to the nonlinearity layers.Also, the effect of the different hypermeters such as size and number of learnable kernels, number of strides, and training option parameters were considered in this study.
The results obtained in this study are compared to the ones obtained from the literature reviews in order to obtain the optimal CNN model for the fabric recognition system.According to the literature review, VGGnet and AlexNet were identified as potential candidates for designing fabric recognition systems.The VGGnet system enhanced the total error rates registered by AlexNet from 15.3% to 7.3%.Thus, this study was based on the VGGnet and AlexNet architecture for designing the CNN model to extract features from the woven fabrics.The accuracy of the fabric defect recognition systems is shown in Figure 6.
Fewer parameters to be learned during the training improved the capability to converge faster and reduced overfitting problems (Karen and Andrew 2015).The experimental result of this study shows that the VGGnet model takes more than 6 training hours, while the newly proposed model  takes only 4 h.Therefore, the current designed model is converged faster as compared with the VGGnet model as shown in Figure 7.This is mainly due to the number of parameters learned were very less as compared with the VGGnet model.

Conclusion
Consumer needs for quality or defect-free fabrics have increased rapidly in recent years utmost priority than ever.To ensure this consistently, various manufacturers have different methods including performing 100% inspection.However, this is an impossible task due to several drawbacks of visual offline systems.To overcome this, online automated fabric inspection, a continuous computerbased system operated in real time is introduced as an alternative even though the perfect system has not been investigate yet.Thus, this study used a huge number of real fabric images and proposed a new model for fabric defect recognition systems.Various plain fabric images with major defects and free of defects were collected, and a prototype CNN model was developed to examine the defect types off-line or in real-time (during the production of the fabric on the weaving machine).The newly proposed CNN model resulted in an accuracy of more than 89% and a faster convergence time of about 33% compared to the VGGnet model.This study provided an improved way to inspect and detect plain fabric defects either online and/or offline.The author would like to recommend the inspection method be expanded to other fabric structures such as twill, sateen, knitted, and other patterns such as striped and checked fabrics.

Disclosure statement
No potential conflict of interest was reported by the author(s).

Funding
The work was supported by the Ethiopian Institute of Textile and Fashion Technology, Bahir Dar University.

Figure 1 .
Figure 1.The fabric image captured using a digital camera (a) defect-free (b) hole (c) miss pick and (d) double pick.

Figure 2 .
Figure 2. A structure of automated fabric inspection systems flow chart.

Figure 3 .
Figure 3.The accuracy performance of the AlexNet model.

Figure 4 .
Figure 4.The performance of the newly proposed CNN model: (a) model accuracy, (b) loss of a proposed model.

Figure 7 .
Figure 7.The comparison chart of the VGGNet, AlexNet, and newly proposed model using computational time.

Table 2 .
The confusion matrix of the newly proposed CNN model for fabric defect identification system.The accuracy comparison of CNN model: VGGNet, AlexNet, and the newly proposed model.
Figure 5. Double-pick fabric defect with low-intensity of patterned defect.