Abstract
Due to the complexity of fabric texture and the diversity of defect types, fabric defect detection is quite challenging. At present, fabric defect detection algorithms based on deep learning have achieved good detection results, but there are still some key issues to be solved. First, the existing network models remain unchanged once they have been built. When they are used to detect defects of different kinds of fabrics, the network model cannot be adjusted flexibly according to the characteristics of the fabrics, which reduces the efficiency of algorithm detection. Second, the imbalanced category of fabric defect samples makes model training more challenging. Moreover, the number of defective pixels is very small compared with the number of pixels in the whole image, which further increases the difficulty of fabric defect detection methods. To solve these problems, we propose a pixel-level pruning end-to-end deep supervision DSUNet++ architecture for fabric defect detection. The DSUNet++ architecture consists of an encoder, a decoder, and a series of cascade operations for fusing the detailed features of the shallow layer and the abstract features of the deep layer. The deep supervision is embedded into the outputs of different depths in the DSUNet++, which can prune the network reasonably according to the characteristics of different kinds of fabrics, so as to balance the depth, speed and precision of the network. Furthermore, the cross-entropy loss function weighted by the median frequency CEloss_MFB is introduced to overcome the problem of imbalanced fabric defect sample categories and detection rate decrease of small pixel defects. The experimental results show that the average detection rate of the method is 97.68% and 99.01% in the defect detection of raw fabric and patterned fabric, respectively.
The textile industry is a pillar industry of the national economy and social development in China. Effective detection and guarantee of textile surface quality is one of the key links for modern textile enterprises to control cost and improve product competitiveness. 1 How to make textile enterprises more competitive, among which ensuring the quality of fabrics, is very important.2–4 At present, most of textile enterprises still use the traditional manual detection method for fabric defect detection. Due to the limitation of human physiological characteristics, the speed, accuracy and consistency of test results provided by traditional manual detection methods cannot meet the demand of modern mass production. With the rapid development of artificial intelligence and computer science, computer vision and pattern recognition technology have been widely used in the field of industrial surface defect detection.5,6 These technologies not only provide a good guarantee for the objective, stable and efficient fabric defect detection, but also conform to the development trend of automation and intelligence in the textile industry.
In the early stages, the traditional machine vision detection method has been widely used in the field of fabric defect detection. It extracts the fabric texture feature of the defect-free fabric sample as the template, and then carries out defect detection according to the similarity between the image to be detected and the template generated in the detection stage. Li et al. 7 proposed a novel and robust fabric defect detection method based on the low-rank representation technique. The time complexity of this method was very high because the eigenvalue decomposition on the blocked matrix was used for dimension reduction. Kang and Zhang 8 proposed a fabric defect detection method based on sparse dictionary learning. This method can excellently detect defects of fabric with small period textures, but it is not accurate enough to detect the defects of fabric with large period textures. Zhang et al. 9 proposed a fabric defect detection method based on the salience metric for color dissimilarity and positional aggregation. The algorithm can excellently detect the patterned fabric, but the time complexity needs to be further improved because of the large number of similarity calculations involved. For these traditional approaches, their features must be manually designed to fit a particular task. In the industrial environment, due to the variety of fabric defects and the uncertainties of the shape, size and type of defects, it is difficult for the traditional machine vision algorithm to complete the modeling and migration of defect features, and the reusability is not great, which will waste a lot of labor and material costs. Compared with traditional methods, deep learning methods do not require manual feature design, they can automatically extract features in an end-to-end manner and are more robust to changes. 10 Therefore, the defect detection method based on deep learning has higher accuracy and faster detection speed, and has been widely used in the defect detection of industrial fabrics.
The convolutional neural network (CNN) is the most representative model of deep learning, which has been widely applied in many fields, such as image classification, object detection and image segmentation.11,12 In recent years, many defect detection methods based on CNN have been widely used in the textile industry. This kind of method mainly learns the labeled defect samples, constructs the detection model, applies the detection model to the tested samples for detection, and finally gets the detection result.
Wang et al. 13 proposed a deep CNN model for defect detection, so as to control product quality. This model can automatically extract powerful features for defect detection with less prior knowledge of images. The proposed method has better detection accuracy and speed when tested on the baseline datasets. Hu et al. 14 proposed a new unsupervised fabric defect detection method based on a deep convolutional generative adversarial network (DCGAN). The method extends the standard DCGAN by introducing a new encoder component. With the assistance of the encoder, a given query image can be reconstructed, and only the normal texture can be preserved in the reconstruction. Therefore, when subtracting the reconstructed image from the original image, a residual map can be created to highlight the potential regions. Li et al. 15 proposed a compact CNN structure for detecting some common fabric defects. Because the proposed architecture uses several micro-architectures with multi-layer perceptron to optimize the network, compared with mainstream CNNs, it achieves excellent detection accuracy. Considering the CNN cannot handle small sample problems well in classification tasks, Wei et al. 16 combined compressive sensing and the convolutional neural network (CS-CNN) to compress and augment small sample data by using the compressive sampling theorem. The data features are classified directly by a CNN through compressed sampling. Experiments show that this method can effectively improve the classification accuracy of defect samples even when the number of defect samples is small. Zhang et al. 17 proposed an attention-gate-based U-shaped reconstruction network (AGUR-Net) and a dual-threshold segmentation post-processing method. AGUR-Net consists of an encoder, an atrous spatial pyramid pooling module and an attention gate weighted fusion residual decoder. The experimental results show that the proposed method can better detect and locate the defects of color-patterned fabrics compared with several other state-of-the-art unsupervised fabric defect detection methods. Dlamini et al. 18 proposed introducing a real-time machine vision system with the aim of detecting defects in functional textile fabrics with good precision at relatively fast detection speeds to assist in textile industry quality control. Filtering is employed to denoise and enhance some features. YOLOv4 is used for localization where the system is trained with weights of a pretrained model. Zhang et al. 19 proposed a U-shaped Swin transformer network based on the quadtree attention framework for unsupervised yarn-dyed fabric defect detection. The method was by a U-shaped network based on a Swin transformer, the Swin transformer adopts local attention effectively to learn features, and the U-shaped network realizes pixel-level reconstruction of images. The proposed method effectively avoids the difficulty of collecting a large number of defective samples and manual labeling. Experimental results show that the proposed method can achieve higher accuracy of fabric defect detection and location compared with other methods. Zheng et al. 20 found an objective evaluation method for sizing effects on strand integrity and performance of belt-forming of E-glass filament yarn. The image of the cross-section of yarn is captured by Keyence VK-X110 and analyzed by Image-Pro Plus to obtain the central position and diameter of each filament. By using the least squares method, the minimum rectangle containing all groups of filaments is obtained to describe the basic contour of the yarn cross-section. The outer envelope polygon is divided into several equal parts to calculate the coefficient variation of thickness distribution and yarn distribution. These objective values well reflect the strand integrity and feature of the belt-forming of yarn, and are consistent with the subjective evaluation. Bao et al. 21 proposed a comprehensive defect detection system of tube yarn by combining machine vision and deep learning methods. In the whole system, we inspect the weight through a weight sensor first. Then, we propose a multi-scale cross-fusion attention module to improve the MobileNetV2, and combine with a machine vision image feature extraction method for hairiness detection. Finally, the modified MobileNetV2 network is used as the backbone of the YOLOX network, making the YOLOX is lighter and achieves more efficient stain detection of tube yarn. The experimental results show that the system is efficient, precise, and can be applied to actual production.
The above deep learning methods have achieved better defection results to some extent. However, there are still some challenging issues to be solved. First, there are various kinds of fabric products in the actual production, their backgrounds are complex and changeable, and their defect patterns are different. This requires the structure of the designed network model to be adjusted according to the characteristics of different fabric products. Yet the existing network models remain unchanged once they are built. Second, there are many defective samples in which the proportion of defective pixels in the image is very low. 22 Figure 1 shows some samples with a small number of defective pixels. Figure 2 gives the ratio of samples with a small number of defective pixels to the whole samples in the raw fabric dataset and patterned fabric dataset, in which the proportion of defective pixels in the image is less than or equal to 5%. The defect detection performance of existing methods is greatly affected by these samples with a small number of defective pixels. Third, the number of samples for different types of defects is different. The number of common fabric defect samples is relatively large, while the defect samples of some fabrics are not easy to obtain. In particular, for some new types of fabrics, the number of defect samples in the sample set is almost zero. The imbalanced distribution of defect samples will bring great resistance to the learning of the network.

Partial samples with small proportion of defect pixels.

The proportion of small pixel defects in raw fabric and patterned fabric sample sets.
In this paper, we propose a pixel-level pruning end-to-end deep supervision UNet++ architecture (DSUNet++) for fabric defect detection, which can be adjusted according to different types of fabrics, and the defect detection performance can be improved under imbalanced samples and samples with a few defective pixels. The contributions of the adapted method are as follows:
The adapted DSUNet++ architecture can reasonably prune the network according to the characteristics of different fabric products, such as the background texture, the similarity of defects and backgrounds, so as better to design the depth of the network, and balance the depth, speed and precision of the network. The median frequency weighted loss function, CEloss_MFB, is introduced to deal with the imbalance of fabric defect sample categories, and the problem of reduced detection rate with fewer defective pixels.
The structure of this paper is organized as follows. In the Related works section, the related works are introduced. In the Adapted algorithm section, the algorithm principle of the UNet++ network and the principle of DSUNet++ architecture are described. In the Detection results and analysis section, the detection results and the analysis of experiments are provided to validate the adapted method on databases of real fabric images, and the influence of DSUNet++ network depth on detection results is analyzed. In the Comparisons with other methods section, the detection results of the adapted method are compared with the U-Net and other algorithms. Finally, the final section is the conclusion.
Related works
With the further development of deep learning algorithms, many deep learning models are emerging. For example, DenseNet,23,24 SegNet,25,26 FCN,27,28 and so on. These models have been widely used in image segmentation and object detection. Among these models, U-Net29–31 has been widely considered for its unique structure and segmentation performance. The original intention of the U-Net network is to solve the problems in biomedical image segmentation. Because of its good effect, it has been widely used in various aspects of semantic segmentation. The U-Net network is a variant of fully convolutional networks (FCNs), 32 which is a completely symmetric encoder-decoder structure. The encoder part is down-sampling, responsible for feature extraction. The decoder part generally adopts up-sampling, uses the abstract features of the encoder part to restore the original image size, and finally gets the segmentation result. In the U-Net structure, the feature graph before the first down-sampling is directly connected with the convolution layer rather far back through a skip connection. The corresponding two convolution layers before and after are connected to play the role of the information supplement. The model can rely on more information to deal with the problem of insufficient information during up-sampling, so as to improve the segmentation accuracy. However, it will also cause the input of the two convolution layers to have a big difference in features, increasing the difficulty of network learning.
The feature map before the first down-sampling in the U-Net structure is sent to the convolution layer quite far back for direct feature connection. However, in a deep convolutional network, with the deepening of the network layer, the features outputted by the convolutional layer will become more and more abstract. The receptive fields of the first several layers are relatively small, so the extracted features must only be locally related, such as lines and edges. However, the receptive fields of the last several layers are relatively large, and the extracted features are likely to be more abstract features. Therefore, it is inevitable that the extracted features are very different from those of the first several layers. In the U-Net network, the corresponding two convolution layers in the encoder and decoder parts are directly combined through a skip connection. However, the features extracted by these two convolution layers have a large characteristic difference. If the shallow features with great differences are directly connected with the deep features, it will inevitably increase the difficulty of network learning when the shallow features with such great differences are used to supplement the deep features. Although the U-Net network has achieved ideal results in biomedical and industrial defect detection, due to the skip-connection mode in U-Net, it is easy to cause the input of the two convolution layers connected to have a large semantic difference, resulting in increased difficulty in network learning. 33
Li et al. 34 proposed the attention UNet++ network, which introduced the attention mechanism between the nested convolution blocks of UNet++, so that the features extracted at different levels could be combined into task-related choices. Furthermore, due to the introduction of deep supervision, the prediction speed of the pruned network is accelerated at the cost of modest performance degradation. Hoorali et al. 35 proposed an improved UNet++ architecture to segment microscopic images of patient tissue samples. The proposed model combines multi-scale features by adding skip connections in two paths. Several convolutional networks are used as the backbone to extract powerful representations in the encoder section. To overcome the problem of data imbalance of different classes, a weighted hybrid loss function is proposed. Experimental results show that despite many challenges of microscopic image analysis, the proposed model is a reliable system for the automatic diagnosis of anthrax and other tissue diseases. Li et al. 36 proposed a residual-attention UNet++, which is an extension of the UNet++ model with a residual unit and attention mechanism. The residual unit improves the degradation problem and the attention mechanism can increase the weight of the target area and suppress the background area irrelevant to the segmentation task. Three medical image datasets such as skin cancer, cell nuclei, and coronary artery in angiography were used to validate the proposed model. The results showed that the residual-attention UNet++ achieved superior evaluation scores.
From the above analysis, it can be seen that the UNet++ architecture has a good capability in feature extraction and has achieved good application results in medical detection. Many medical image features have high similarity with the features of fabric texture and defect. Therefore, the UNet++ architecture with strong feature extraction ability suitable for medical detection is very suitable for surface defect detection of fabric with complex background and diverse defect types.
Adapted algorithm
UNet++
The UNet++ structure is formed by integrating U-net structures of different depths into one network. Its advantage is that it can capture different levels of features and integrate them using feature superposition. The UNet++ network has receptive fields of different sizes, which can complement each other's shortcomings caused by receptive fields of different sizes, and can well meet the needs of defect detection.
The decoder with the UNet++ structure is densely connected with the same resolution through the redesigned skip connection, changing the connectivity of the encoder and decoder network. In the UNet++ structure, the encoder feature map goes through a dense convolution block, and it is easier for the optimizer to optimize when the received encoder feature map is similar to the corresponding decoder feature map. The jump path in the UNet++ structure is expressed as follows:

The schematic diagram of the UNet++ network.
Deep supervision UNet++ architecture
The adapted deep supervision UNet++(DSUNet++) structure is developed by fusing the deep supervision information into the UNet++ structure. The deep supervision makes statistics on the output of different depth models, and then observes the output of different depths for pruning the network. Therefore, according to the texture, color, defect, and other characteristics of different kinds of fabrics, reasonable pruning is carried out for adapting different kinds of fabrics and different types of defect detection. The specific operation is to add a 1 × 1 convolution kernel after the output of each UNet++ sub-network branch to supervise the output of each sub-network branch in the UNet++ network. The corresponding loss function of each sub-network branch in the verification set determines how many branches should be cut, that is the depth of the DSUNet++ network structure is determined. The network design of the deep supervision UNet++ is shown in Figure 4. Among them, L1, L2, L3 and L4, respectively, represent one-layer, two-layer, three-layer, and four-layer depth DSUNet++ network.

The network design of the deep supervision UNet++.
In the process of deep supervision, the output of each sub-network is the segmentation result of the input image, but the results are different. Therefore, if the output result of the low-level sub-network meets the requirement of defect segmentation, the redundant network can be cut off at will. The deep supervision function can weigh the depth, speed and precision of the network. For example, in Figure 5, if the effect of the three-layer network is good, the four-layer network can be cut directly without any effect on the other layer networks, as shown in the gray part cut out in Figure 5.

The pruning process from L4 layer to L3 layer.
Figure 6 is a structure diagram of the designed DSUNet++ network. Table 1 lists the detailed operations process of each layer, among which ConvTranspose represents the deconvolution layer, k, and s represents convolution kernel and stride, respectively; the input of the model is the defect sample to be tested and the output is the pixel-level segmentation result.

The structure diagram of the DSUNet++ network.
Definition and operation of each layer of DSUNet + +
Loss function
CEloss_MFB
There is great randomness in fabric defect samples. For example, in the existing sample database, the quantity of defect samples of raw fabric and patterned fabric is quite different, which causes the problem of unbalanced classification of fabric defect samples. At the same time, some small pixel defect samples are included in these defect samples, and the defects in such small pixel defect fabric samples are not easy to detect, which directly affects the detection rate of the algorithm.
Cross-entropy loss function is the sum and accumulation of the loss of each pixel. The size of different categories of objects is different; that is, the number of pixels is different. Therefore, different weights should be given to the loss of different types of objects during detection, so that the algorithm can also obtain better detection results for small pixel defects.
In order to solve this problem, the median frequency balance (MFB) method is introduced on the basis of cross-entropy loss function. MFB reweights losses for each class based on the distribution of real labels to reduce the impact of class imbalance on the model. For a multi-category image database, each category will have a category frequency. Divide the number of pixels in the category by the total number of pixels in the database to find the median frequency of all categories, and then divide by the frequency corresponding to the category to get the weight. This can ensure that the category with a small proportion has a weight greater than 1, and the category with a large proportion has a weight less than 1 to achieve a balanced effect. Using MFB can significantly improve network performance. The MFB weighted loss function CEloss_MFB
37
is specifically expressed as follows:
BCEloss
To prune the network more accurately according to the characteristics of different kinds of fabrics, binary cross-entropy loss function (BCEloss) is added to the output end of each network branch of the DSUNet++ architecture. To balance the depth, speed, and precision of the network better. The detailed description of BCEloss is as follows:
Detection results and analysis
In this section, a series of experiments are conducted to evaluate the performance of the adapted DSUNet++. All experiments were conducted on a server using an Intel Core i7-8700K processor with 3.2 GHz dominant frequency, 128 GB of memory, and GeForce1080Ti graphics processor (GPU). The software part uses Windows 10 operating system and Pytorch deep learning framework.
Evaluation index
To evaluate the performance of fabric defect detection results, the indexes of Accuracy, Precision, Recall and F-measure
38
are used in our experiment. Here, Accuracy represents the proportion of all predictions that are correct, Precision indicates how much of the predicted samples are correctly predicted, Recall indicates how many samples have been correctly predicted from the actual samples, F-measure represents the comprehensive evaluation of Precision and Recall index simultaneously. The calculation formulas are as follows:
Experiments
In order to test the feasibility of the algorithm, the experiment was carried out on raw fabric and patterned fabric. The image size used in this paper is 256 pixels × 256 pixels. The epochs of the algorithm in this paper are 200, and the learning rate is 0.01.
The defect detection of raw fabric
The feasibility of the adapted algorithm is verified by the TILDA fabric sample database. The TILDA fabric sample database is a standard defect sample database, and it is also a common verification database for experts and scholars to verify detection algorithms. The database contains two types of raw fabric samples, C1 and C2. Class C1 fabric image has uniform texture, fine yarn, thin texture, high fabric density, and relatively simple background texture, including two types of fabrics: C1R1 and C1R3. Class C2 fabrics contain visual, grid texture fabric images, thicker yarn, grid structure, small fabric density, relatively complex background texture, which also includes two types of fabrics: C2R2 and C2R3. Both C1 and C2 fabric samples contain four defect types: holes, oil spots, thread errors, and objects on the surface. C1R1, C1R3, C2R2 and C2R3 are composed of 200 defective samples and 50 non-defective samples, respectively. Therefore, the raw fabric sample database used in this paper contains 800 defective samples and 200 non-defective samples, totaling 1000 samples.
During the experiment, according to different defect types, 50% of the images were selected as training samples and the other 50% as testing samples. In the experiment, a three-layer depth network is used for detection, and the defect detection results of raw fabric are shown in Figure 7.

The defect detection results of raw fabric.
As the yarn of C2 fabric is thicker than C1 fabric, its background texture is more complex than C1 fabric, and the similarity and fusion degree between defects and texture are higher than C1 fabric. Thus, the characteristics of C2 fabric itself will have a certain impact on the accuracy of its defect detection, and the detection of the fabric edge is not complete. The specific evaluation indexes of the experimental results are given in Table 2.
Defect detection evaluation indexes (%) of raw fabric
The defect detection of patterned fabric
To test better the performance of the algorithm, the patterned fabric is taken as the second type of detection object. The samples included three types of fabrics: dot-, star- and box-. Among them, star-patterned and box-patterned fabrics contain five kinds of defect types: broken end, hole, netting multiple, thick bar and thin bar. In addition to the five kinds of defect types above, dot-patterned fabric also includes the defect of knots, a total of six kinds of defect types. Each defect type contains five images, so a total of 80 defect images are included. According to different defect types, 50% of the images were selected as training samples and the remaining 50% as testing samples. A four-layer depth network is used for detection in the experiment. The defect detection results of patterned fabrics are shown in Figure 8.

The defect detection results of patterned fabric.
The defect detection of patterned fabric also achieved good results. First, the four-layer DSUNet++ network structure extracts more feature information. Second, the defects of patterned fabrics are relatively small, and can be easily distinguished compared with the fabric texture. The specific evaluation indexes of the experimental results are listed in Table 3.
Defect detection evaluation indexes (%) of patterned fabric
The influence of DSUNet++ network depth on detection results
The UNet++ network integrates the U-net structures of different scales into one network. The deeper the network depth is, the longer the training time will be required, and it is easy to cause overfitting. On the contrary, the shallower the network depth is, the fabric texture information needed for detection cannot be extracted, which reduces the accuracy of detection results. Therefore, the selection of network depth plays a key role in the results of fabric defect detection.
The selection of network depth of raw fabric
For different types of fabrics, the depth selection of the DSUNet++ network depth is different. It depends on the texture of the fabric, the background, the defect and the complexity of the fabric. Because the background texture of raw fabric is relatively simple, the key information of fabric can be extracted without too deep a network depth, and good detection results can be obtained. Figure 9 shows the comparison of detection results of raw fabric with different DSUNet++ network depths. Among them, L2, L3 and L4, respectively, represent two-layer, three-layer, and four-layer depth DSUNet++ networks.

The defect detection results of raw fabric with different DSUNet++ network depths.
As can be seen from Figure 9, the detection results of the three-layer DSUNet++ network on raw fabric defects are better than those of the two-layer and four-layer. In particular, in terms of detailed information, the edges are clearer, and the detected defect shape is more consistent with the actual defect. Figure 10 draws the line chart of evaluation indexes of four kinds of raw fabrics in the two-layer, three-layer and four-layer DSUNet++ network detection. It can be seen from Figure 10 that the evaluation indexes of three-layer deep network detection are better.

Comparison of raw fabric defect detection evaluation index (%) with L2, L3 and L4.
The selection of network depth of patterned fabric
For patterned fabric, the fabric background texture is more complex and darker. When extracting features, if the network depth is too shallow, fabric texture features cannot be well extracted. Therefore, the network depth of patterned fabric is deeper than that of raw fabric in defect detection. Figure 11 shows the comparison of detection results of patterned fabric with different DSUNet++ network depths.

The defect detection results of patterned fabric with different DSUNet++ network depths.
As can be seen from Figure 11, for the same patterned fabric, the detection results of the four-layer DSUNet++ network have obvious advantages over the results of the two-layer and three-layer network structures. In particular, the details of defects are more prominent, and the outline of the defect edge is more accurate. Figure 12 draws the line chart of evaluation indexes of three kinds of patterned fabrics in the two-layer, three-layer and four-layer DSUNet++ network detection. It can be seen that the evaluation indexes of four-layer depth network detection are better than those of two-layer and three-layer DSUNet++ networks.

Comparison of patterned fabric defect detection evaluation index (%) with L2, L3 and L4.
The influence of CEloss_MFB on detection results
The median frequency balance weighted loss function CEloss_MFB is introduced in this paper to solve the problem of uneven classification of fabric defect samples and low detection rate of small pixel defects. Figure 13 shows the test results before and after the introduction of the loss function.

The influence of CEloss_MFB on detection results.
It can be seen from the test results that after adding CEloss_MFB loss function, the defect detection of small pixels is more accurate, the defect edge is smoother, and the continuity of the defect is better.
Comparisons with other methods
To show better the superiority of the adapted algorithm, the performance of the adapted algorithm is compared with the detection results of other existing algorithms. In order to make a fair comparison, we only use the defect images employed in other algorithms for comparison. The comparison results of the adapted method and other methods are shown in Figure 14.

Comparative analysis of the defect detection results.
LGM-FC 39 is a traditional defect segmentation method, which first removes the texture of the fabric image, and then uses fuzzy C means to segment the defect. LGM-FC has obtained good performance in the detection of fabrics with simple texture or obvious defects. However, when the defect is not obvious and the patterned fabric defect detection, there will be some loss of defect details.
As can be seen from Figure 14, for the raw fabric, the Frangi filter combined with the fuzzy C means algorithm 40 and the maximization of expectation (EM) algorithm 41 can accurately detect defects, but the defects profile detected is incomplete, and there may even be some noise. In contrast, the algorithm adapted in this paper is more prominent in defect detail detection.
The detection results of the ER algorithm 42 and IIER algorithm 43 are similar. The IIER algorithm does a good job in the details of general types of defect detection. However, for fabrics with a larger or smaller defect area, the accuracy of detection results will be different to some extent.
The Mobile-Unet 44 algorithm achieves high segmentation accuracy in raw fabric and patterned fabric defects. However, due to the structure characteristics of the U-net network itself, the input of the two convolution layers connected will have great semantic differences, which will increase the difficulty of network learning and affect the real-time detection.
In brief, the detection results of the DSUNet++ algorithm adapted in this paper are more prominent in the details of defects, and the outline is more distinct. It has a good detection effect for some small pixel defects, and can also completely detect defects when the background texture and the defect are high approximation.
Conclusions
In this paper, we propose an end-to-end deep supervision UNet++(DSUNet++) network architecture for detecting different kinds of fabric defects, which can realize the barrier-free fusion of shallow and deep features. First, the idea of deep supervision is added to the algorithm, which makes the algorithm more flexible for detecting the defects of different kinds of fabrics. It can carry out reasonable pruning based on the background texture of the fabric itself, the obvious degree of defects, and the similarity between the background and the defects. Second, the median frequency weighted loss function CEloss_MFB is introduced to overcome the problem of imbalanced fabric defect sample category and the decrease of detection rate when a small pixel defect is detected. Finally, the selection principle of deep supervised UNet++ network depth is analyzed, which provides algorithm support for better targeted network selection, better detection of fabric defects and the improvement of defect detection efficiency. The datasets of raw fabric and patterned fabric are tested, respectively, with high detection accuracy. In addition to fabric defect detection, the algorithm can also be applied to many aspects of the industry, such as metal surface defect detection, rail surface defect detection, tile surface defect detection, and circuit board surface defect detection, etc. Because the defects of these industrial products have similar characteristics, and the defects appear on the surface of the object, and the state of the defects is similar. Therefore, the same defect detection method can be used for detection. Although this paper has carried out some research and optimization on the fabric defect detection algorithm, machine learning is used to solve some problems. However, there are still many unsolved problems and room for further improvement in the field of fabric defect detection. First of all, as a supervised detection method, its training samples require a large number of manually labeled data. Second, the actual site changes a lot, the emergence of new defect types, the emergence of new fabrics to the off-line training model is not suitable, resulting in a high miss rate. It is difficult to meet the requirements of the textile industry for fabric defect detection. Third, how to design a more efficient network learning method and significantly reduce model complexity and model parameters while keeping the detection accuracy unchanged. Look for cost-effective field edge computing equipment better to realize real-time detection of industrial sites. Therefore, developing weakly supervised or unsupervised defect detection methods, exploring online learning fabric defect detection methods and improving the detection speed of the algorithm on embedded edge devices are our next research direction.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This research was supported by the Key Project of Shaanxi Provincial Department of Science and Technology of China (grant no. 2019GY-014), the Key R&D Program of Shaanxi Province, China (grant no. 2022GY-274), and the Science and Technology Project of Shaanxi Province, China (grant no. 2023-YBSF-505).
