# CPAM: Cross Patch Attention Module for Complex Texture Tile Block Defect Detection
## 1 Introduction  
Production and inspection are two important parts of the tile industry. Although there are numerous facilities currently that can automate the production of tiles, the assessment of the tile's surface quality is still conducted manually [1]. Defects can occur everywhere on the tile surface, and detecting subtle defects in large-format tile images can be a tough task, especially on complex textured tiles. Complex textured tiles have intrusive background information, and some of the background information is relatively similar to and between defects, so they are easily confused when performing defect detection tasks. Therefore, providing a stable, accurate, and efficient method for surface defect detection is crucial to the development of the tile industry. Vision-based inspection methods have developed rapidly in recent years, and many scholars have applied methods based on deep learning models to the field of industrial defect detection, such as Fabric Defect Detection [2], Electrical Insulator Defects Detection [3], and Bamboo Surface Sliver Detection [4]. In the field of tile defect detection, tile defect detection is still a difficult task due to the special characteristics of tile datasets, the great resolution of tile images, and the many types and tiny sizes of defects. There are many scholars who have conducted related investigations using machine vision inspection methods, [PERSON] et al. [5] use a first-order derivative edge detector (Sobel) for the tiledefect detection task, but this method is only applied to solid-colored tiles and no tests are performed regarding complex textured tiles. [PERSON] et al. [6] conduct a variety of defect detection methods, such as histograms, neural networks, morphological techniques, Gabor filters and wavelet transforms. Both of these methods have their own pros and cons, and there is no more comprehensive approach. [PERSON] et al. [7] integrate defect classification using a multi-class support vector machine with defect edge detection using a rotation invariant local variance metric (RIMLV) operator. This approach can detect tile defects more accurately, but only for solid-colored tiles, and has not been extended to complex textured tiles for related experiments. Deep learning models have stronger performance in defect detection tasks in complex scenes [8], but traditional deep learning models still have unresolved challenges in complex texture tile defect detection tasks [9]. This problem is reflected in the fact that traditional deep learning models do not easily take into account the connection between regional features, which makes it difficult for the model to extract the differences between different regions and exclude interference information, and therefore it is tough to identify some of the tile block defects. In the field of tile block defect detection, this paper summarizes the characteristics of different methods, as shown in Table 1. As observe from the table, only traditional deep learning models are applied to complex textured tiles, but there are limitations in the connection between regional features. To address the challenges of traditional deep learning models for tile block defect detection, this paper is inspired by [PERSON] et al. [10] to relate tile block defect characteristics to regional features. Then, considering the specificity of the tile dataset, this study applies this method to the attention mechanism, which can effectively extract the regional features of tile block defects. As a result, this paper proposes a new attention module--CPAM, which focuses on the different patches. This attention module can be easily added to the end-to-end model and effectively helps the model to accomplish the tile block defect detection task. In this paper, tiles from three different backgrounds containing four defects are studied and a series of experiments are conducted on a dataset based on this. The contributions made in this paper can be summarized as follows:  
1.