## 2 Related Work  
### Defect Detection  
In traditional defect detection methods, people often design a specific algorithm for a type of defect to complete the defect detection task. For fabric defects detection, a detection method-based low-rank representation technique was proposed in the Ref. [4]. The technique can achieve good textile detection results without training data. Many researchers also use Gabor filters to detect fabric defects [5; 6; 7; 8; 9]. To detect jean fabric, the Ref. [5] proposed an improved algorithm based on the optimized Gabor filter. It selected the optimal filter from 24 Gabor filter banks by the one-dimensional image entropy algorithm and the two-dimensional image entropy algorithm. For wood defect detection, the work of [10] designed a novel method to detect and measure defects on the surface of trunks by using high-density 3D information. It used a segmentation algorithm to detect singularities on the trunk surface and a Random Forests machine learning algorithm  
Figure 1: The general process of this paper’s method. The wavelet-transformed images are extracted as defective and non-defective patches, respectively. Feed it into the network to train the model. When testing, use a sliding window to input the wavelet-transformed image into the model for judgment and decision-making. to find the defect area. The results show that the method has high accuracy in defect detection and classification. For glass products, the Ref. [11] proposed a method to detect fibreglass components in the marine environment using terahertz waves. For steel products, a new Haar-Weibull variance model was proposed for steel surface defect detection in an unsupervised manner [12]. In the Ref. [13], the researchers proposed a robust sparse representation-based detection system to detect and classify hidden defects in radiographs of castings. In the Ref. [14], a multi-pair pixel consistency model was developed to represent the statistical relationship between each pair of pixels in a defect-free image. The algorithm developed based on this method can achieve a 100% defect detection rate. The above studies used traditional defect detection methods, often designed for specific defects, and can obtain high accuracy. With the development of computing power and deep learning, current researchers prefer to use convolutional neural networks to detect defects automatically [15]. Convolutional neural networks have many advantages in the field of image processing [16], and gradually occupy the leading position in image classification [17]. In the Ref. [18], researchers used CNN to detect concrete cracks. The results show that the method performs well and can find concrete cracks in the actual situation. CNN is also used in the field of medical detection. In the Ref. [19], researchers trained an 18-layer CNN to detect glaucoma. In addition, there are also some people using CNN to detect fabric defects [20; 21]. However, CNN also has some disadvantages, such as requiring a lot of training data and computing power. Furthermore, training a CNN using only original images may result in losing some indistinguishable features. In order to improve the performance of CNN networks, many researchers combine wavelet analysis with CNN and use the wavelet transform to analyze the multi-scale characteristics of data. The Ref. [22] proposed a new method called MSCDAE, which uses only defect-free images for model training. The method utilizes CDAE to reconstruct image patches at different Gaussian pyramid levels and utilizes the reconstruction residuals of training patches to display detection results. The results show that the multimodal result fusion strategy can improve the defect detection performance. In the Ref. [23], the researchers used information in the wavelet domain as input to train a CNN model. Their method improves the learning ability, eliminates the overfitting phenomenon, and improves the efficiency of object detection. In the Ref. [24], [PERSON] et al.