A text detection method based on CNN and Transformer hybrid model

By combining CNN and Transformer to extract local and global information of natural scene text, and designing a dynamic scale fusion module, the problem of insufficient detection accuracy in natural scene text detection is solved, and the detection accuracy and robustness are significantly improved.

CN115019143BInactive Publication Date: 2024-10-01HUNAN UNIV
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202210677277.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-16
Publication Date
2024-10-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Natural scene text detection methods have problems with insufficient detection accuracy when dealing with irregular shapes, diverse scales, extreme aspect ratios and perspective distortions, and blurred texts. CNN locality limits global information extraction, while Transformer suffers from low-level feature extraction and training efficiency. There are flaws.

Method used

Combining CNN and Transformer, extract local and global information of the image through the convolutional backbone network and Transformer decoder, and design a dynamic scale fusion module to dynamically fuse multi-scale feature maps to improve scale robustness and representation capabilities, using data enhancement and multi-scale feature maps. The layer perceptron further optimizes the model.

Benefits of technology

Significantly improves the detection accuracy of long and curved texts, enhances network representation capabilities, suppresses noise, and improves the accuracy and robustness of detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115019143B_ABST
    Figure CN115019143B_ABST
Patent Text Reader

Abstract

The invention discloses a text detection method based on a hybrid model of CNN and Transformer. The method uses CNN to extract a series of basic features of different scales of a text image, and generates weight embedding and probability threshold embedding through Transformer. The weight embedding is used to generate attention weights, and the basic features of different scales are dynamically scaled to obtain a fused feature map with powerful feature representation capabilities; the probability threshold embedding and the fused feature map are scalar-multiplied to obtain a probability threshold prediction with a light structure and also powerful representation capabilities; then, the probability threshold prediction is deconvolved to obtain a probability map and a threshold map; finally, a binary map of the text image is obtained through an approximate binarization formula, and the bounding box of the text can be obtained by searching for a connected area on the binary map. The present invention can effectively extract local information and global information of the image, so that the decoded features contain more and more accurate text information, and significantly improve the accuracy of text detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of text detection under computer vision technology, and specifically is a text detection method based on a CNN and Transformer hybrid model. Background Art

[0002] Natural scene text detection aims to accurately locate text of arbitrary shapes in natural scenes, and it is widely used in many fields such as document analysis, billboard reading, autonomous driving, etc. Although great efforts and great progress have been made in recent years, natural scene text detection is still a challenging problem due to the irregular shapes, diverse scales, extreme aspect ratios, perspective distortion and severe blur of text.

[0003] Currently, most natural scene text detection methods are built on top of convolutional neural networks (CNNs). These methods can capture semantically rich information through a series of stacked convolutions and have achieved great success in computer vision. The success of CNN is attributed to two advantages, namely translation invariance and locality. However, the locality of the convolutional filter limits its extraction of global information in the image, resulting in suboptimal detection results for long texts. To alleviate this problem, a mainstream approach is to use deformable convolutions to expand the receptive field of the convolutional network. However, this approach still relies on the convolutional backbone network, so its global expressiveness is still weak.

[0004] In recent years, the Transformer algorithm has performed well in the field of natural language processing. Many researchers have tried to apply Transformer to the field of computer vision and have achieved good results. However, the Transformer algorithm still has defects. On the one hand, Transformer has no built-in prior knowledge, so it takes more time to train the model. On the other hand, since Transformer performs poorly in extracting low-level features, it is easy to make wrong predictions for small text instances.

[0005] To solve these problems, the present invention combines the advantages of CNN and Transformer, effectively extracts local and global information of the image through the convolutional backbone network and Transformer decoder, and greatly enhances the network representation ability. In addition, the present invention also proposes a dynamic scale fusion module to dynamically fuse multi-scale feature maps, which significantly improves scale robustness and provides powerful representation capabilities for subsequent decoding. Summary of the invention

[0006] The technical problem to be solved by the present invention is to provide a text detection method based on a CNN and Transformer hybrid model, which mainly solves the problems mentioned in the background technology.

[0007] In order to achieve the above object, the present invention adopts the following technical solution:

[0008] S1. Obtain a public dataset of natural scene text and perform a series of data enhancements on the text images to improve the robustness of the model. To improve training efficiency, all input images are uniformly scaled to H×W, where H and W represent the length and width of the image, respectively. Public datasets of natural scene text include the multi-directional text dataset ICDAR2015, the curved text dataset CTW-1500, and Total-Text.

[0009] S2. Use a basic feature module to extract the natural scene text image to obtain four feature maps of different scales: P i , i∈{2,3,4,5}, whose image sizes are 1 / 4, 1 / 8, 1 / 16, and 1 / 32 of the input image size respectively. Then these different scale feature maps are upsampled to the same scale as P2 to obtain F2, F3, F4, and F5;

[0010] S3, the low-resolution feature map P5 and N queries are fed into the Transformer module to obtain N embeddings; then the embeddings are further decoded through a three-layer multi-layer perceptron to obtain N dimensions C ε The function embedding of C ε Equal to the concatenated feature map F described in step S2 concat The number of channels, that is, C ε =4C; N feature embeddings contain N1 weight embeddings ε w and N2 probability thresholds embedded in ε pt ; Wherein N1 is equal to the number of feature maps to be fused in step S2, that is, 4; the N value is obtained in an adaptive manner, which is equal to the sum of N1 and N2; different N values ​​may be used for different application scenarios; the present invention sets N to 36;

[0011] S4, dynamically fuse the same scale feature maps F2, F3, F4, and F5 described in step S2 to obtain a fused feature map F fused ,The fused feature map provides a powerful feature representation for subsequent decoding;

[0012] S5, decoding the fused feature map in step S4 through an approximate binarization module to obtain a probability map and a threshold map, and using an approximate binarization formula to calculate the probability map and the threshold map to obtain a binary map. The final text box is predicted based on the binary map.

[0013] Further, step S2 is specifically to perform the following steps on the low-resolution feature map P i+1 and high-resolution feature map P iPerform 1×1 convolution so that their number of channels becomes C; the number of channels C is set to 64; then i+1 The convolutional feature map is upsampled by 2 times and P i The convolved feature maps are added together; then the added feature maps are nearest upsampled to the same scale as feature map P2 to obtain F2, F3, F4, and F5; the following formula can summarize the above process:

[0014]

[0015] in Indicates progress 2 i-2 times upsampling, Conv k×k (:) represents a k×k convolution kernel.

[0016] Furthermore, in step S3, the Transformer module does not contain an encoder, but only consists of 6 decoders. Each decoder contains a multi-head self-attention (MSA) unit, a multi-head cross-attention (MCA) unit, and a multi-layer perceptron unit (MLP); the input of each decoder is z i-1 , the output is z i , LN represents layer normalization, then the calculation formula of the decoder is as follows:

[0017]

[0018] where a i-1 and c i-1 represents only the intermediate variables, i∈{1,2,…,6}; the self-attention mechanism consists of three point-by-point linear layers, which transform the input z i-1 Mapping to the intermediate representation: query Q, key K and value V; where the point-by-point linear layer is composed of input z i-1 And multiply it with a learnable matrix; the calculation formula of the self-attention mechanism is as follows:

[0019]

[0020] The criss-cross attention mechanism (MCA) also consists of three point-wise linear layers, where the query Q is composed of a i-1 Mapping gets, key Sum It is mapped by the low-resolution feature map P5 described in step S2. The calculation formula of the cross attention mechanism is as follows:

[0021]

[0022] Due to their own characteristics, the self-attention mechanism and the cross-attention mechanism will interact with each vector in the input during the calculation process, so they can easily model long-range semantic dependencies and better capture global range features.

[0023] Furthermore, step S4 is specifically as follows: first, F2, F3, F4, and F5 in step S2 are spliced ​​along the channel direction to obtain a spliced ​​feature map F with a channel number of 4C. concat ; Then embed the transposed weights in step S3 And the above concatenated feature map F concat ∈R 4C×H / 4×W / 4 (4C=C ε ) is multiplied by a scalar product, and then the result of the multiplication is activated by a sigmoid function to obtain the attention weight F w ∈R 4×H / 4×W / 4 , whose value is between 0 and 1, can achieve the effect of strengthening useful image information and suppressing useless information. The calculation formula of this process is as follows:

[0024]

[0025] Reshape(4C,H / 4·W / 4)(F concat ) represents the concatenation of feature maps F concat The shape of is re-transformed to 4C×(H / 4·W / 4), where σ represents the sigmoid activation function. Finally, the attention weight is divided into 4 parts along the channel dimension and combined with the corresponding scaled feature F in step S2 i Perform weighted multiplication to obtain the fused feature map F fused ∈R 4C×H / 4×W / 4 .

[0026] Furthermore, step S5 specifically includes the following three steps:

[0027] S51, the fusion feature map F described in step S4 fused ∈R 4C×H / 4×W / 4 (4C=C ε ) and the probability threshold embedding after transposition in step S3 Perform scalar product multiplication to get the probability threshold prediction F pt ∈R 32×H / 4×W / 4 , the calculation formula of this process is as follows:

[0028]

[0029] Reshape(C ε ,H / 4·W / 4)(F fused ) represents the concatenation of feature maps F concat The shape is reshaped into C ε×(H / 4·W / 4). Usually C ε is much larger than 32, so the probability threshold predicts F pt Compared with the fusion feature map F fused It is more lightweight and can also provide a powerful feature representation for subsequent decoding.

[0030] S52, then predict the probability threshold F pt Perform two deconvolutions with a stride of 2 to obtain a feature map with 2 channels and a size of H×W. The first channel of the feature map corresponds to the probability map P, and the second channel feature is the threshold map T. Then, an approximate binarization formula is used to obtain a binary map, and the calculation formula is:

[0031]

[0032] Where P i,j and T i,j They respectively represent the values ​​of the pixel position (i, j) in the probability map P and the threshold map T; k represents the scaling factor, which is set to 50 in the present invention.

[0033] S53. Use minAreaRect in the Opencv connected region method to find the connected area of ​​the binary image, and use the Vatti clipping algorithm to expand the connected area to form the final text detection box.

[0034] Beneficial effects: Compared with previous text detection methods, the advantage of the present invention is that the detection accuracy is significantly improved when detecting long text and curved text; it combines the advantages of CNN and Transformer, can effectively extract local and global information of the image, so that the network representation ability is greatly enhanced; design an attention-based dynamic scale fusion module, use the Transformer decoder to generate attention weights, so as to extract significant features and suppress noise. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 This is a detection flow chart of a hybrid text model method based on CNN and Transformer according to an embodiment of the present invention.

[0036] Figure 2 This is a network structure diagram used in the embodiment of the present invention.

[0037] Figure 3 This is a schematic diagram of the dynamic scale fusion structure.

[0038] Figure 4 This is a schematic diagram of the Transformer structure DETAILED DESCRIPTION

[0039] In order to make those skilled in the art better understand the present application scheme, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. However, the present invention is not limited in any way, and any changes or substitutions made based on the teachings of the present invention belong to the protection scope of the present invention.

[0040] This embodiment is a text detection method based on a CNN and Transformer hybrid model. The overall method flow is as follows: Figure 1 As shown, the network architecture and internal details of the module are as follows Figure 2-Figure 4 As shown, the method comprises the following steps:

[0041] S1. Obtain a public dataset of natural scene text as training images; the public dataset of natural scene text includes the multi-directional text dataset ICDAR2015, the curved text dataset CTW-1500 and Total-Text; then perform a series of data enhancements on the text images to improve the robustness of the model; the specific data enhancement strategies include:

[0042] (1) Randomly rotate the image in the range of [-10°, 10°].

[0043] (2) Randomly flip the image with a probability of 0.5.

[0044] (3) Randomly crop the image.

[0045] (4) In order to overcome the imbalance problem of positive and negative samples, a difficult example mining strategy is adopted, in which the ratio of positive and negative samples is 1:3.

[0046] (5) To improve training efficiency, during training, all images are scaled to H×W, where H and W are both 640.

[0047] S2. Use a basic feature module to extract the natural scene text image to obtain four feature maps of different scales: P i , i∈{2,3,4,5}, whose image sizes are 1 / 4, 1 / 8, 1 / 16, and 1 / 32 of the input image size respectively; in one embodiment of the present invention, the backbone network used in the basic feature module is the residual network ResNet-50 and ResNet-18. Then, these different scale feature maps are upsampled to the same scale as P2 to obtain F2, F3, F4, and F5 with the same number of channels C. Specifically, for the low-resolution feature map P i+1 and high-resolution feature map P i Perform 1×1 convolution so that the number of their channels becomes C. In the embodiment of the present invention, the number of channels C is set to 64; then i+1 The convolutional feature map is upsampled by 2 times and P iThe convolved feature maps are added together; the added feature maps are then nearest-neighbor upsampled to the same scale as feature map P2; the following formula can summarize the above process:

[0048]

[0049] in Indicates progress 2 i-2 times upsampling, Conv k×k (:) represents a k×k convolution kernel.

[0050] S3, such as Figure 2 As shown in Figure 2, the low-resolution feature map P5 and N queries are fed into the Transformer module to obtain N embeddings; then the embeddings are further decoded through a three-layer multi-layer perceptron to obtain N dimensions of C. ε The function embedding of C ε Equal to the concatenated feature map F described in step S2 concat The number of channels, that is, C ε =4C; N feature embeddings contain N1 weight embeddings ε w and N2 probability thresholds embedded in ε pt ; Wherein N1 is equal to the number of feature maps to be fused in step S2, that is, 4; the N value is obtained in an adaptive manner, which is equal to the sum of N1 and N2; different N values ​​may be used for different application scenarios; the present invention sets N to 36;

[0051] Specifically, Figure 4 As shown in the figure, the Transformer module does not contain an encoder and consists of only 6 decoders. Each decoder contains a multi-head self-attention (MSA) unit, a multi-head cross-attention (MCA) unit, and a multi-layer perceptron unit (MLP); the input of each decoder is z i-1 , the output is z i , LN represents layer normalization, then the calculation formula of the decoder is as follows:

[0052]

[0053] where a i-1 and c i-1 represents only the intermediate variables, i∈{1,2,…,6}; the self-attention mechanism consists of three point-by-point linear layers, which transform the input z i-1 Mapping to the intermediate representation: query Q, key K and value V; where the point-by-point linear layer is composed of input z i-1 And multiply it with a learnable matrix; the calculation formula of the self-attention mechanism is as follows:

[0054]

[0055] The criss-cross attention mechanism (MCA) also consists of three point-wise linear layers, where the query Q is composed of a i-1 Mapping gets, key Sum It is mapped by the low-resolution feature map P5 described in step S2. The calculation formula of the cross attention mechanism is as follows:

[0056]

[0057] Due to their own characteristics, the self-attention mechanism and the cross-attention mechanism will interact with each vector in the input during the calculation process, so they can easily model long-range semantic dependencies and better capture global range features.

[0058] S4, such as Figure 3 As shown, first, F2, F3, F4, and F5 described in step S2 are spliced ​​along the channel direction to obtain a spliced ​​feature map F with a channel number of 4C. concat ; Then embed the transposed weights in step S3 And the above concatenated feature map F concat ∈R 4C×H / 4×W / 4 (4C=C ε ) is multiplied by a scalar product, and then the result of the multiplication is activated by a sigmoid function to obtain the attention weight F w ∈R 4×H / 4×W / 4 , whose value is between 0 and 1, can achieve the effect of strengthening useful image information and suppressing useless information. The calculation formula of this process is as follows:

[0059]

[0060] Reshape(4C,H / 4·W / 4)(F concat ) represents the concatenation of feature maps F concat The shape of is re-transformed to 4C×(H / 4·W / 4), where σ represents the sigmoid activation function. Finally, the attention weight is divided into 4 parts along the channel dimension and combined with the corresponding scaled feature F in step S2 i Perform weighted multiplication to obtain the fused feature map F fused ∈R 4C×H / 4×W / 4 The fused feature map provides a powerful feature representation for subsequent decoding;

[0061] S5, such as Figure 2 As shown, an approximate binarization module decodes the fused feature map described in step S4 to obtain a probability map and a threshold map, and uses an approximate binarization formula to calculate the probability map and the threshold map to obtain a binary map; the final text box is predicted based on the binary map.

[0062] Specifically, step S5 includes the following three steps:

[0063] S51, the feature graph F described in step S4 fused ∈R 4C×H / 4×W / 4 (4C=C ε ) and the probability threshold embedding after transposition in step S3 Perform scalar product multiplication to get the probability threshold prediction F pt ∈R 32×H / 4×W / 4 , the calculation formula of this process is as follows:

[0064]

[0065] Reshape(C ε ,H / 4·W / 4)(F fused ) represents the concatenation of feature maps F concat The shape is reshaped into C ε ×(H / 4·W / 4). According to step S2, C=64, so C ε =256, so the probability threshold predicts F pt Compared with the fusion feature map F fused It is more lightweight and can also provide a powerful feature representation for subsequent decoding.

[0066] S52, then predict the probability threshold F pt Perform two deconvolutions with a stride of 2 to obtain a feature map with 2 channels and a size of H×W. The first channel of the feature map corresponds to the probability map P, and the second channel feature is the threshold map T. Then, an approximate binarization formula is used to obtain a binary map, and the calculation formula is:

[0067]

[0068] Where P i,j and T i,j They respectively represent the values ​​of the pixel position (i, j) in the probability map P and the threshold map T; k represents the scaling factor, which is set to 50 in the present invention.

[0069] S53. Use minAreaRect in the Opencv connected region method to find the connected area of ​​the binary image, and use the Vatti clipping algorithm to expand the connected area to form the final text detection box.

[0070] After training the natural scene text dataset using the algorithm proposed in this invention, the performance comparison on the ICDAR2015 dataset with the DB algorithm (reference: Real-time Scene Text Detection with Differentiable Binarization) is as follows:

[0071] Table 1 Comparison of detection effects of two algorithms

[0072] method Backbone network Accuracy Recall Harmonic mean Single frame inference time (ms) DB ResNet-50 86.8% 81.4% 84.0% 206.5 Model of the present invention ResNet-50 89.1% 83.1% 86.0% 193.0

[0073] From Table 1, we can see that the detection accuracy, recall rate, and harmonic mean of the proposed model are improved by 2.3%, 1.7%, and 2% respectively compared with the DB algorithm, and the single-frame inference time is reduced by 13.5ms.

[0074] The above is only the basic idea and steps of the present invention, but the protection scope of the present invention is not limited thereto. It should be noted that for those skilled in the art, the present application may have various modifications and variations. Modifications, equivalent substitutions, improvements, etc. according to the technical solution and inventive concept of the present invention should all be included in the protection scope of the present application.

Claims

1. A text detection method based on CNN and Transformer hybrid model, Its characteristics are: The following steps are involved: S1. Obtain a public dataset of natural scene text and perform a series of data enhancements on the text images to improve the robustness of the model. In order to improve training efficiency, all input images are uniformly scaled to H×W, where H and W represent the length and width of the image, respectively. The public dataset of natural scene text includes the multi-directional text dataset ICDAR2015, the curved text dataset CTW-1500, and Total-Text. S2. Use a basic feature module to extract the natural scene text image to obtain four feature maps of different scales: P i , i∈{2,3,4,5}, whose image sizes are 1 / 4, 1 / 8, 1 / 16, and 1 / 32 of the input image size respectively; then these different scale feature maps are upsampled to and P 2 At the same scale, we get F with C channels. 2 、F 3 、F 4 、F 5 ; Finally, F 2 、F 3 、F 4 、F 5 Splice to get the 4C splicing feature map F concat ; S3, the low-resolution feature map P 5 and N queries are fed into the Transformer module to obtain N embeddings; then the embeddings are further decoded through a three-layer multi-layer perceptron to obtain N dimensions of C ε The function embedding of C ε Equal to the concatenated feature map F described in step S2 concat The number of channels, that is, C ε =4C; N function embeddings contain N 1 The weight embedding ε w and N 2 The probability threshold embedding ε pt ; where N 1 is equal to the number of feature maps that need to be fused in step S2, which is 4; the N value is obtained in an adaptive way, which is equal to N 1 and N 2 The addition of; different N values ​​can be used for different application scenarios. This method sets N to 36; S4, the same scale feature map F described in step S2 2 、F 3 、F 4 、F 5 and the weight embedding ε described in step S3 w Perform dynamic fusion to obtain the fusion feature map F fused , the fused feature map provides a powerful feature representation for subsequent decoding, which is specifically: (1) First, the F 2 、F 3 、F 4 、F 5 Splicing is performed along the channel direction to obtain a splicing feature map F with 4C channels. concat ; (2) Then embed the weights described in step S3 into ε w Transpose to get the transposed weight embedding And the concatenated feature map F concat ∈R 4C×H / 4×W / 4 Take the scalar product; (3) Then the sigmoid function is activated on the multiplication result to obtain the attention weight F w ∈R 4×H / 4×W / 4 , whose value is between 0 and 1, can achieve the effect of strengthening useful image information and suppressing useless information; the calculation formula of this process is as follows: Reshape(4C,H / 4·W / 4)(F concat ) represents the concatenation of feature maps F concat The shape of is re-transformed to 4C×(H / 4·W / 4), σ represents the sigmoid activation function; (4) Finally, the attention weight is divided into four parts along the channel dimension and compared with the corresponding scaled feature F described in step S2 i Perform weighted multiplication to obtain the fused feature map F fused ∈R 4C×H / 4×W / 4 ; S5, decoding the fused feature map in step S4 through an approximate binarization module to obtain a probability map and a threshold map, using an approximate binarization formula to calculate the probability map and the threshold map to obtain a binary map; predicting the final text box based on the binary map, the specific steps are: (1) The fusion feature map F described in step S4 fused ∈R 4C×H / 4×W / 4 (4C=C ε ) and the probability threshold embedding ε described in step S3 pt Transpose to obtain the transposed probability threshold embedding And perform scalar product multiplication to get the probability threshold prediction F pt ∈R 32×H / 4×W / 4 , the calculation formula of this process is as follows: Reshape(C ε ,H / 4·W / 4)(F fused ) represents the concatenation of feature maps F concat The shape is reshaped into C ε ×(H / 4·W / 4); usually C ε is much larger than 32, so the probability threshold predicts F pt Compared with the fusion feature map F fused It is more lightweight and can also provide a powerful feature representation for subsequent decoding; (2) Then the probability threshold F is predicted pt Perform two deconvolutions with a stride of 2 to obtain a feature map with 2 channels and a size of H×W. The first channel of the feature map corresponds to the probability map P, and the second channel feature is the threshold map T. Then, an approximate binarization formula is used to obtain a binary map. The calculation formula is: Where P i,j and T i,j They represent the values ​​of the pixel position (i, j) in the probability map P and the threshold map T respectively; k represents the scaling factor, which is set to 50; (3) Use the minAreaRect method in OpenCV to find the connected area of ​​the binary image, and use the Vatticlipping algorithm to expand the connected area to form the final text detection box.

2. According to the text detection method based on CNN and Transformer hybrid model described in claim 1, It is characterized in that The step S2 specifically includes: i+1 and high-resolution feature map P i Perform 1×1 convolution so that their number of channels becomes C; the number of channels C is set to 64; then i+1 The convolutional feature map is upsampled by 2 times and P i The convolved feature maps are added; Then the added feature map is nearest upsampled to the sum feature map P 2 The same scale, F 2 、F 3 、F 4 、F 5 ; The following formula can summarize the above process: in Indicates 2 i-2 times upsampling, Conv k×k (:) represents a k×k convolution kernel.

3. According to the text detection method based on CNN and Transformer hybrid model described in claim 1, It is characterized in that In step S3, the Transformer module does not contain an encoder, but only consists of 6 decoders; each decoder contains a multi-head self-attention (MSA) unit, a multi-head cross-attention (MCA) unit and a multi-layer perceptron unit (MLP); the input of each decoder is z i-1 , the output is z i , LN represents layer normalization, then the calculation formula of the decoder is as follows: where a i-1 and c i-1 represents only the intermediate variables, i∈{1,2,...,6}; the self-attention mechanism consists of three point-by-point linear layers, which transform the input z i-1 Mapping to the intermediate representation: query Q, key K and value V; where the point-by-point linear layer is composed of input z i-1 And multiply it with a learnable matrix; the calculation formula of the self-attention mechanism is as follows: The criss-cross attention mechanism (MCA) also consists of three point-wise linear layers, where the query Q is composed of a i-1 Mapping gets, key Sum The low-resolution feature map P described in step S2 of claim 1 5 The mapping is obtained; the calculation formula of the cross attention mechanism is as follows: Due to their own characteristics, the self-attention mechanism and the cross-attention mechanism will interact with each vector in the input during the calculation process, so they can easily model long-range semantic dependencies and better capture global range features.

Citation Information

Patent Citations

  • Scene character detection method and system based on sequence deformation

    CN112926372A

  • Scene text recognition method based on explicit supervision attention mechanism

    CN113159023A

  • Adaptive threshold scene text detection method based on attention feature fusion

    CN113516126A

  • Chinese named entity recognition method fusing time sequence convolution and Transform encoder

    CN114169330A

  • Multi-directional scene text recognition method and system based on multi-element attention mechanism

    US20220121871A1