# Scene Text Detection Based on Multi-Headed Self-Attention Using Shifted Windows
## 1 Introduction  
Text is an important tool for humans to express information. Textual content in images often contains rich and accurate high-level semantic information, which is an important cue for visual recognition. The task of text detection is to annotate the location coordinates of each text instance in the input image, which can be a single character location or an entire text line location. Scene text refers to text content that exists in any natural scenario. Scene text detection is difficult due to text diversity (text color, size, font, shape, orientation, language, length), complex backgrounds and interference (image distortion, blur, low resolution, shadow, luminance), and dense or even overlapping text. The text detection technology of scene images helps to obtain and analyze the scene content information, which can be applied to image retrieval, industrial automation, automatic driving, license plate ticket recognition, and other scenarios, and has high research value. Current research [1; 2; 3] has usually used deep learning methods, such as CNNs, Recurrent Neural Networks (RNNs), and other network structures to learn from a large number of samples to automatically obtain the feature representation of the input data, and perform text detection based on the features. According to the characteristics of text detection models, a large number of scene text detection methods based on deep learning that have emerged so far can be classified into two types based on text region suggestion and image semantic segmentation. The text-region-proposal-based methods mainly apply classical object detection algorithms to text detection, such as RCNN (Region ProposalCNN) [4], SSD (Single Shot multi-box Detector) [5], R-FCN (Region-based Fully Convolutional Networks) [6], and YOLO (You Only Look Once) [7]. The method is also often referred to as a regression-based approach because it obtains text detection results by regressing the text box. This method works better for regular shape text detection, but it is often difficult to obtain smooth text wrap-around curves for solving curved text, and the model is more complex and does not have performance advantages. The methods based on image semantic segmentation have borrowed the ideas of classical semantic segmentation algorithms, such as FCNs (Fully Convolutional Networks) [8], FPNs (Feature Pyramid Networks) [9], and FCIS (Fully Convolutional Instance-aware Semantic Segmentation) [10]. This method predicts each pixel in the image and then obtains the minimum envelope curve of the text region through post-processing. This method does not need to consider the characteristics of long text and deformed text, and it can detect different shapes of text. However, its disadvantage is that the segmentation results can easily become sticky, and the post-processing method is more complicated. The main method of improving the accuracy of text detection in natural scenes is by improving the image feature extraction network and acquiring complex features of natural scene text. The more comprehensive the acquired features, the higher the accuracy of text detection. In order to solve the problem of improving the accuracy of scene text detection with controlled computation, this paper proposed a scene text detection model based on shifting windows and multi-headed self-attention. To address the problem of the variable scale and diverse distribution of natural scene texts, this paper introduced the multi-headed self-attention mechanism proposed in the Transformer [11] model, while using convolutional networks to extract local features. The multi-headed self-attention mechanism is used to obtain the global features of an image by taking advantage of its characteristic that the number of operations required to compute the relationship between any two pixels in an image does not grow with the distance between pixels. Then, the features of different levels are fused to improve the accuracy of detection.