# MRS-Transformer: Texture Splicing Method to Remove Defects in Solid Wood Board
## 2 Related Work
Although image inpainting methods based on CNN+GAN have made many advances and proposed targeted solutions, the inpainting task relies heavily on known feature information of the image, and the CNN can only rely on dilated convolution to achieve long-distance relationship modeling, which has difficulty achieving true global relationship modeling. Transformer was originally used in the field of NLP (natural language processing), which is a branch of artificial intelligence. NLP involves the technology and methods for the interaction and processing of human natural language by computers. The goal of NLP is to enable computers to understand, interpret, generate, and manipulate natural language text or speech data. The Transformer has found widespread applications in NLP tasks such as machine translation, speech recognition, and text generation, using global relational modeling to extract features, and the breakthrough in NLP has attracted the interest of researchers in computer vision (CV) due to its powerful global modeling capabilities. Because visual data are temporally and spatially consistent, ordinary Transformer models cannot meet the requirements of computer vision tasks. The strategy of ViT, which divides images into patches of the same size and uses the patches as the basic unit for model training, makes it possible to use Transformer models for computer vision tasks. Many scholars have also experimented with Transformer models in image inpainting. [PERSON] et al. [25] used ViT coarse inpainting first, then CNN fine reconstruction. [PERSON] et al. [26] used a multi-generator network; one generator was a traditional CNN encoder, one downscaled the image and then sub-patch it into the ViT model and, finally, the output of both generators was decoded using a CNN model. [PERSON] et al. [27] used Transformer to repair the structure, incrementally adding the structure to the subsequent CNN for texture generation. [PERSON] et al. [28] used the Transformer model for the encoder and decoder of image inpainting, using the method of updating the mask region to improve the inpainting effect, but still needed to use convolutional layers to process the image at the start and end, failing to exploit the full capability of Transformer. Although these studies have attempted to use Transformer for image inpainting, they still use CNN+GAN as the basic idea, adding Transformer as an auxiliary or branching module to the model. Transformer uses self-attention for feature extraction, is computationally demanding, and requires a large amount of memory during training, making it challenging to train the model effectively. Many scholars have attempted to optimize the Transformer structure by using local attention instead of global attention; for example, [PERSON] et al. [29] used a shifted window attention to narrow the scope of attentional computation and [PERSON] et al. [30] used a random mask operation that selects only a small amount of data as input. The use of local attention reduces model calculations but, at the same time, reduces the performance of Transformer, which derives much of its superior performance from its global modeling capabilities. The redundancy in image information is very large compared to natural language data, so removing redundancy is key to the use of Transformer in computer vision. Unlike other image inpainting tasks, wood defect texture inpainting requires the following considerations: the wood texture is irregular and the texture around the defect is deformed due to the presence of the defect, so the masked area for the defect is larger than for other inpainting tasks to ensure the consistency of the completed texture. In addition, the texture reconstruction at the location of the wood defects prepares for later splicing, which is carried out in long strips, so the mask should be set to rectangular.