## 1 Introduction  
In the 1860s, human society began transforming from agricultural to industrial civilization. Machine production was gradually replacing manual labor. The development of the industry significantly promoted the progress of society. Since the 1950s, computer technology has made great progress and therefore was gradually combined with many other fields. In industrial manufacturing, surface defects are inevitable in the production process. There are many kinds of defects in the industry, such as scratches and cracks on steel surfaces, wear and stains on fabrics, scratches and impurities on glass products. The surface defects will not only affect the appearance and comfort of these products but also cause security incidents. At the same time, for factories, the low product quality will not only waste raw materials and increase production costs but also damage the reputation of the factory. Therefore, product quality control has always been the focus of attention. In the past, many factories used to use artificial methods to complete detection tasks, which are inefficient and unreliable. It will also bring greater human cost to the factories. With the development of computer technology, people focus on automatic detection technology and want to use the computer to complete the task of product quality control.  
In recent years, with the integration and application of Informatization and industrialization, many links of industrial production have been replaced by computers. Computer vision technology has been successfully applied to the surface defect detection of industrial products.  
This paper proposes a texture surface defect detection approach based on CNN and wavelet transform, which can detect tiny defects in complex texture backgrounds. Compared with the existing approaches [1; 2; 3], this approach can achieve high detection accuracy with a small amount of training data. The general process of this approach is shown in Figure 1.  
The main contributions of this paper are listed below:  
1. To solve the problem of tiny defect detection, a new method based on wavelet analysis and patch extraction is proposed, which can detect and locate many kinds of tiny defects in complex texture backgrounds with only a small amount of training data. Experimental results have verified its good performance.
2. In the data preprocessing phase of our method, we propose a method which can automatically extract defective patches based on binary label images. Experiments show that this method can greatly reduce the workload of building a defective training dataset;
3. A judgment strategy based on the sliding-window is proposed, which can improve the robustness of CNN networks. It can reduce the detection error probability in complex backgrounds.  
The remainder of this paper is organized as follows. In Section 2, we firstly introduce the dataset and some theoretical background information, including the CNN network and theories of wavelet analysis. Then the procedures of our approach are introduced in detail, including the CNN network we used, the random-window method in the training phase, the sliding-window method, and judgment strategy in the defect detection phase. In Section 3, implementation details are illustrated. Experimental results are analyzed and compared with other well-known defect detection methods in Section 4. Finally, the conclusions are given in Section 5.