Efficient scene text image super-resolution method with semantic guidance
By introducing semantic guidance branches and super-resolution branches into scene text image super-resolution technology, combined with self-attention and cross-attention mechanisms, the problems of high computational complexity and limited resources in the existing technology are solved, and high efficiency is achieved. Super-resolution reconstruction of scene text images for resource-limited devices.
Patent Information
- Application Number
- CN202410702281.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-02
- Publication Date
- 2024-09-06
AI Technical Summary
Existing scene text image super-resolution technology performs poorly in handling low-light or motion blur conditions, has high computational complexity, and is limited in application on resource-constrained devices, making it difficult to achieve real-time and high efficiency.
An efficient scene text image super-resolution method with semantic guidance is adopted. By constructing a fusion super-resolution branch and a semantic guidance branch, the CNN encoder and text recognition model are used to extract visual features and text features, combined with self-attention and cross-attention mechanisms. , perform pixel reorganization to generate high-resolution images, and train using a combination of sequential residual blocks and loss functions with low computational complexity.
It achieves efficient reconstruction of super-resolution scene text images, significantly reduces the number of parameters and computational complexity, improves recognition accuracy, can be easily deployed on devices with limited resources, and the inference process is efficient.
Smart Images

Figure CN118608385A
Abstract
Description
Technical Field
[0001] The invention relates to an efficient scene text image super-resolution method with semantic guidance, and belongs to the field of computer image processing. Background Art
[0002] The core goal of scene text image super-resolution (STISR) technology is to significantly improve the resolution and clarity of text images captured from real scenes. With the rapid increase in the number of low-resolution scene text images captured under low-light or motion blur conditions, STISR technology has become a hot topic in the research field. As an indispensable preprocessing step in the text recognition process, STISR is of great significance for subsequent scene text recognition, document in-depth analysis, and accurate extraction and parsing of text information. Its importance is not only reflected in improving recognition accuracy, but also in that it can greatly optimize the efficiency and performance of the entire text processing process.
[0003] In recent years, with the growing demand for improving the quality of scene text images, researchers have proposed a variety of methods to optimize the performance of STR (scene text recognition). Some methods directly use single image super-resolution models as the baseline for text image reconstruction, significantly improving the resolution of the image. However, these traditional single image super-resolution models usually treat scene text images as general objects when processing, ignoring the unique properties and structure of text. To overcome this limitation, subsequent studies began to introduce text prior information to guide the reconstruction process of scene text images. Among them, some methods use character probability sequences to more effectively restore the details of text characters. Some methods further improve the clarity of text structure by ensuring the structural consistency between the restored regular text and the deformed text.
[0004] Although these methods have achieved significant progress in performance, they also have some limitations that cannot be ignored. These methods often rely on complex network structures and may require prior knowledge provided by extensive pre-trained models, which to some extent limits their application on resource-constrained devices. In addition, due to the large number of parameters involved in the inference process and the high computational complexity, these STISR models often perform poorly in terms of real-time performance, and processing each image consumes a lot of time. Summary of the invention
[0005] In order to overcome the shortcomings of the prior art, the present invention provides an efficient scene text image super-resolution method with semantic guidance. While achieving excellent performance, the present invention significantly reduces the number of parameters and computational complexity. The input of the present invention is a low-resolution scene text image, and the output is a high-resolution scene text image. The present invention first constructs a fusion of a super-resolution branch and a semantic guidance branch, and then inputs the image into the two branches respectively, obtains the image feature and text feature distribution for fusion, and finally inputs them into a sequential residual block to generate a high-resolution text image in a pixel-by-pixel recombination manner.
[0006] The technical solution of the present invention is specifically described as follows.
[0007] An efficient scene text image super-resolution method with semantic guidance, wherein the scene text image is super-resolved based on a super-resolution branch stage model and a semantic guidance branch stage model, wherein the super-resolution branch stage model is composed of a CNN encoder and a feature fusion module, and the semantic guidance branch stage model is composed of a text recognition model and a visual-semantic alignment module; the method comprises the following steps:
[0008] Step 1: preprocess the image;
[0009] Step 2: Use the low-resolution scene text image as the input of the super-resolution branch model and use the CNN encoder to extract important visual features f from the text image. s , and then input into the feature fusion module to fuse the visual features f s and advanced guidance information g , to reconstruct high-resolution scene text images; where: high-level guidance information h g Obtained by the following method:
[0010] The low-resolution scene text image is used as the input of the semantic guidance branch stage model. The pre-trained text recognition model is used to extract important text distribution features from the text image and perform self-attention calculation to obtain rich semantic features h. t , and then the semantic feature h t Compared with the visual features f extracted by CNN encoder in the super-resolution branch model s Input into the visual-semantic alignment module composed of self-attention and cross-attention mechanisms, and alignment is achieved through the cross-attention mechanism to obtain high-level guidance information h g .
[0011] In the present invention, in the feature fusion module, the visual feature f extracted by the CNN encoder s and the high-level guidance information h output by the visual-semantic alignment module g First, three parallel 1×1 convolutions are connected to generate different features f s1 、f s 2 and f s 3 , then for f s 1 Perform channel attention operation to obtain the attention score and compare it with f s 2 Multiply them together to generate channel attention features and add them to f s 3 Add together to get the fused feature f; as shown in formula (1):
[0012]
[0013] Where CA represents the channel attention mechanism.
[0014] In the present invention, in step 2, the feature f fused by the feature fusion module is input into a sequential residual block to construct a deeper residual dependency relationship, and then a super-resolution image is generated by pixel reorganization; wherein: the sequential residual block is composed of a CNN encoder and a bidirectional long short-term memory mechanism BLSTM, the input of the sequential residual block is a feature map, the features are extracted by the CNN encoder, and then the feature map is arranged and resized, and then the error differential is propagated through the BLSTM, and the feature map is reversed into a feature sequence, and finally fed back to the convolution layer.
[0015] In the present invention, the number of sequential residual blocks is 2.
[0016] In the present invention, the text recognition model adopts the SVTR model. Since SVTR adopts the design of a single visual model, the entire recognition process is more concise and efficient, and is suitable for various scene text recognition tasks.
[0017] In the present invention, the visual-semantic alignment module includes a self-attention layer and two cross-attention layers; for the first cross-attention layer, the semantic feature h t As a query, the visual feature f s As keys and values, the relationship between each character and different regions in the image is calculated, as shown in formula (2) and formula (3):
[0018] h′ i =LN(MultiHead(h i-1 ,f s ,f s )+h i-1 ) (2)
[0019] h i =LN(MLP(h′ i )+f′ i ) (3)
[0020] Where i represents the i-th attention layer, and the initial h0 is the semantic feature h t ,h i-1 is the output of the previous attention layer; using the output h of the first cross attention layer ca As the key of the second cross-attention layer, f s As a query, h t As value, let f s Each element of h ca Find the text features it should focus on, and align text information and visual features through the second cross-attention layer to obtain high-level guidance h g .
[0021] In the present invention, three different types of loss function combinations are used as the final loss function L, as shown in formula (4):
[0022] L=L rc +α1L re +α2L ft (4)
[0023] Where L rc The mean square error loss is used to supervise image reconstruction in the super-resolution branch; the recognition loss L re is the position-aware loss L pos and content-aware loss L re Composition, used to supervise the learning of language knowledge; L ft As the fine-tuning loss for adapting the text recognition model to low-resolution input, α1 and α2 are hyperparameters; in the embodiment, α1 = 0.5, α2 = 0.01; L rc =MSE(I SR -I HR ) (5)
[0024] Among them, I SR and I HR Represent the super-resolution image predicted by the model and the real label image respectively;
[0025] L pos =||A HR -A SR ||1
[0026] L con =WCE(P SR ,y label ) (6)
[0027] L re =λ pos L pos +λ con L con
[0028] Among them, A HR is the attention map output by the pre-trained text recognition model for a given HR text image, A SR is the attention map output by the pre-trained text recognition model of the super-resolution image, WCE represents weighted cross entropy, P SR is the character probability distribution predicted by the pre-trained text recognition model of the super-resolution image, y label is the character label corresponding to each text image in the dataset, λ pos , con is a hyperparameter. In this example, λ pos =10,λ con =0.0005;
[0029] L ft =CE(P pr ,y label ) (7)
[0030] Among them, CE is the cross entropy loss function, P pr Represents the character probability distribution predicted by the pre-trained text recognition model.
[0031] Compared with the prior art, the present invention has the following beneficial effects:
[0032] The proposed method can efficiently reconstruct super-resolution scene text images, and the model achieves excellent performance with less computational cost. The computational complexity of the proposed method is low and the reasoning process is very efficient, which makes it easy to deploy on devices with limited resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is a flow chart of the efficient scene text image super-resolution method of the present invention. DETAILED DESCRIPTION
[0034] The technical solution of the present invention is described in detail below in conjunction with the accompanying drawings and embodiments.
[0035] Example 1
[0036] The present invention provides an efficient scene text image super-resolution method with semantic guidance, and its flow chart is as follows: Figure 1 As shown in Figure 1, it is divided into two stages, namely the super-resolution branch stage and the semantic guidance branch stage. The details are as follows:
[0037] 1. Super-resolution branch stage
[0038] The super-resolution branch stage aims to reconstruct high-resolution scene text images from shallow features and high-level guidance information. The input of this stage is a low-resolution scene text image. The super-resolution branch stage model consists of a CNN encoder and a feature fusion module. The CNN encoder is used to extract important visual features from the text image, and then input into the feature fusion module to fuse the visual features and high-level guidance information to reconstruct the high-resolution scene text image. In the preprocessing stage, the image is resized to a fixed shape of 32*128, and then the pixels of the three channels of the image R, G, and B are normalized respectively.
[0039] In the feature fusion module, the image feature f s and advanced guidance information g First, three parallel 1×1 convolutions are connected to generate different features f s 1 、f s 2 and f s 3 Then for f s 1 Perform channel attention operation to obtain the attention score and compare it with f s 2 Multiply them together to generate channel attention features and add them to f s 3 Add them together to get the final result. As shown in formula (1):
[0040]
[0041] Where CA represents the channel attention mechanism;
[0042] The fused features f are then input into the sequential residual block to build deeper residual dependencies.
[0043] Finally, the shape of the feature map is converted from [H, W, C×r^2] to [H×r, W×r, C] through pixel reorganization PixelShuffle to generate a high-resolution image.
[0044] In the present invention, a sequential residual block [1] is composed of a CNN encoder and a bidirectional long short-term memory mechanism (BLSTM). The input of the block is a feature map, and features are extracted by the CNN encoder. The feature map is then arranged and resized because horizontal text lines can be encoded into sequences. The BLSTM can then propagate error differentials and invert the feature map into a feature sequence, which is finally fed back to the convolutional layer. In order to balance parameters and performance, the present invention selects the number of sequential residual blocks to be 2.
[0045] 2. Semantic-guided branching stage
[0046] The input of the semantic-guided branch stage is a low-resolution scene text image. The semantic-guided branch stage model consists of a text recognition model and a visual-semantic alignment module. The pre-trained text recognition model SVTR ([8] and [9]) is used to extract important text distribution features from the text image and perform self-attention calculation to obtain rich semantic features h t , and then combined with the visual features f extracted by the CNN encoder in the super-resolution branch model s The input is sent to the subsequent visual-semantic alignment module, and the alignment is achieved through the cross-attention mechanism. Unlike the self-attention mechanism, the cross-attention mechanism can handle different modalities, such as text and images. Specifically, the visual-semantic alignment module contains one self-attention layer and two cross-attention layers. For the first cross-attention layer, we use the semantic feature h t As a query, the visual feature f s As keys and values, the relationship between each character and different regions in the image is calculated, as shown in formula (2) and formula (3):
[0047] h′ i =LN(MultiHead(h i-1 ,f s ,f s )+h i-1 ) (2)
[0048] h i =LN(MLP(h′ i )+h′ i ) (3)
[0049] Where i represents the i-th attention layer, and the initial h0 is the semantic feature h t ,h i-1 is the output of the previous attention layer. The present invention uses the output h of the first cross attention layer ca As the key of the second cross-attention layer, f s As a query, h t As value, let f s Each element of h ca Find the text features it should focus on. Through the cross-attention layer, the model can align text information and visual features and obtain high-level guidance information h g .
[0050] In the present invention, three different types of loss function combinations are used as the final loss function, such as formula (4):
[0051] L=L rc +α1L re +α2L ft (4)
[0052] Where L rc The mean square error loss is used to supervise image reconstruction in the super-resolution branch; the recognition loss L re It is composed of position-aware and content-aware losses and is used to supervise the learning of language knowledge; L ft As a fine-tuning loss used for text recognition models to adapt to low-resolution inputs; such as formula (5), formula (6) and formula (7):
[0053] L rc =MSE(I SR -I HR ) (5)
[0054] Among them I SR and I HR Represent the super-resolved image predicted by the model and the true label image respectively.
[0055] L pos =||A HR -A SR ||1
[0056] L con =WCE(P SR ,y label ) (6)
[0057] L re =λ pos L pos +λ con L con
[0058] Where A represents the attention map extracted from the middle layer of Transformer, P represents the probability distribution, and WCE represents the weighted cross entropy.
[0059] L ft =CE(P pr ,y label ) (7)
[0060] Among them, CE is the cross entropy loss function, P pr Represents the character probability distribution predicted by the pre-trained text recognition model.
[0061] In the specific embodiment, the TextZoom dataset [1] used consists of 17,367 low-resolution scene text image pairs for training and 4,373 pairs for testing. According to the focal length of the digital camera, the test samples can be divided into three subsets, namely easy (1,619 samples), medium (1,411 samples) and difficult (1,343 samples). The low-resolution scene text image is resized to 16×64, and the high-resolution scene text image is resized to 32×128. The experimental results are shown in Table 1. The method is compared with other existing super-resolution models on the recognition model ASTER [7]. The accuracy of this method reaches 61.4%. Compared with the current best performing method LEMMA [3], this method reduces the computational complexity by 85%. Due to the low computational complexity of this method, the inference process is very efficient, which makes it easy to deploy on devices with limited resources.
[0062] Table 1 Experimental results
[0063]
[0064]
[0065] References
[0066] [1] Wang, Wenjia and Xie, Enze and Liu, Xuebo and Wang, Wenhai and Liang, Ding and Shen, Chunhua and Bai, Xiang. Scene text image super-resolution in the wild, in ECCV, 2020.
[0067] [2] J.Chen, B.Li, and X.Xue.Scene text telescope: Text-focused sceneimage super-resolution, in CVPR, 2021.
[0068] [3] H. Guo, T. Dai, G. MEng, and S. Xia. Towards robust scene text image super-resolution via explicit location enhancement, in IJCAI, 2023.
[0069] [4]C.Zhao,S.Feng,B.N.Zhao,Z.Ding,J.Wu,F.Shen,and H.T.Shen.Scene textimage super-resolution via parallelly contextual attention network,in ACMMultimedia,2021.
[0070] [5]J.Ma,Z.Liang,and L.Zhang.A text attention network for spatialdeformation robust scene text image super-resolution,in CVPR,2022.
[0071] [6]C.Dong,C.C.Loy,K.He,and X.Tang.Image super-resolution using deepconvolutional networks,IEEE Transactions on Pattern Analysis and MachineIntelligence,2015.
[0072] [7]B.Shi,M.Yang,X.Wang,P.Lyu,C.Yao,and X.Bai.Aster:An attentionalscene text recognizer with flexible rectification,IEEE Transactions onPattern Analysis and Machine Intelligence,2019.
[0073] [8]Du,Y.,Chen,Z.,Jia,C.,Yin,X.,Zheng,T.,Li,C.,and Jiang,Y.G.Svtr:Scene text recognition with a single visual model.in IJCAI,2022.
[0074] [9]J.Chen,B.Li,and X.Xue,Scene text telescope:Textfocused scene imagesuper-resolution.in CVPR,2021。
Claims
1. An efficient scene text image super-resolution method with semantic guidance, It is characterized in that The scene text image is super-resolved based on the super-resolution branch stage model and the semantic guidance branch stage model. The super-resolution branch stage model consists of a CNN encoder and a feature fusion module, and the semantic guidance branch stage model consists of a text recognition model and a visual-semantic alignment module. The following steps are included: Step 1: preprocess the image; Step 2: Use the low-resolution scene text image as the input of the super-resolution branch model and use the CNN encoder to extract important visual features f from the text image. s , and then input into the feature fusion module to fuse the visual features f s and advanced guidance information g , to reconstruct high-resolution scene text images; where: high-level guidance information h g Obtained by the following method: The low-resolution scene text image is used as the input of the semantic guidance branch stage model. The pre-trained text recognition model is used to extract important text distribution features from the text image and perform self-attention calculation to obtain rich semantic features h. t , and then the semantic feature h t Compared with the visual features f extracted by CNN encoder in the super-resolution branch model s Input into the visual-semantic alignment module composed of self-attention and cross-attention mechanisms, and alignment is achieved through the cross-attention mechanism to obtain high-level guidance information h g .
2. The efficient scene text image super-resolution method according to claim 1, It is characterized in that In step 1, the preprocessing includes the steps of adjusting the image size in sequence and normalizing the pixels of the three channels R, G, and B of the image respectively.
3. The efficient scene text image super-resolution method according to claim 1, It is characterized in that In the feature fusion module, the visual feature f extracted by the CNN encoder s and the high-level guidance information h output by the visual-semantic alignment module g First, three parallel 1×1 convolutions are connected to generate different features f s 1 、f s 2 and f s 3 , then for f s 1 Perform channel attention operation to obtain the attention score and compare it with f s 2 Multiply them together to generate channel attention features and add them to f s 3 Add together to get the fused feature f; as shown in formula (1): Where CA represents the channel attention mechanism.
4. The efficient scene text image super-resolution method according to claim 3, It is characterized in that In step 2, the features fused by the feature fusion module are input into the sequential residual block to construct a deeper residual dependency relationship, and then a high-resolution image is generated by pixel reorganization; wherein: the sequential residual block is composed of a CNN encoder and a bidirectional long short-term memory mechanism BLSTM, the input of the sequential residual block is a feature map, the features are extracted through the CNN encoder, and then the feature map is arranged and resized, and then the error differential is propagated through the BLSTM, and the feature map is reversed into a feature sequence, and finally fed back to the convolution layer.
5. The efficient scene text image super-resolution method according to claim 4, It is characterized in that The number of sequential residual blocks is 2.
6. The efficient scene text image super-resolution method according to claim 1, It is characterized in that The text recognition model uses the SVTR model.
7. The efficient scene text image super-resolution method according to claim 1, It is characterized in that The visual-semantic alignment module consists of a self-attention layer and two cross-attention layers; for the first cross-attention layer, the semantic feature h t As a query, the visual feature f s As keys and values, the relationship between each character and different regions in the image is calculated, as shown in formula (2) and formula (3): h′ i =LN(MultiHead(h i-1 ,f s ,f s )+h i-1 ) (2) h i =LN(MLP(h i ′)+h i ′) (3) Where i represents the i-th attention layer, and the initial h 0 is the semantic feature h t ,h i-1 is the output of the previous attention layer; Use the output h of the first cross-attention layer ca As the key of the second cross-attention layer, f s As a query, h t As value, let f s Each element of h ca Find the text features it should focus on, and align the text information and visual features through the second cross-attention layer to obtain high-level guidance information h g .
8. The efficient scene text image super-resolution method according to claim 1, It is characterized in that Three different types of loss functions are used as the final loss function L, as shown in formula (4): L=L rc +a 1 L re +a 2 L ft (4) Where L rc The mean square error loss is used to supervise image reconstruction in the super-resolution branch; the recognition loss L re is the position-aware loss L pos and content-aware loss L re Composition, used to supervise the learning of language knowledge; L ft As the fine-tuning loss for text recognition model to adapt to low-resolution input, α 1 , α 2 is a hyperparameter; L rc =MSE(I SR -I HR ) (5) Among them, I SR and I HR Represent the super-resolution image predicted by the model and the real label image respectively; Among them, A HR is the attention map output by the pre-trained text recognition model for a given HR text image, A SR is the attention map output by the pre-trained text recognition model of the super-resolution image, WCE represents weighted cross entropy, P SR is the character probability distribution predicted by the pre-trained text recognition model of the super-resolution image, y label is the character label corresponding to each text image in the dataset, λ pos , con is a hyperparameter; IT ft =CE(P pr ,y label ) (7) Among them, CE is the cross entropy loss function, P pr Represents the character probability distribution predicted by the pre-trained text recognition model.
Citation Information
Cited By
Fast face image super-resolution method and system based on stable diffusion model
CN119006292A
Fast face image super-resolution method and system based on stable diffusion model
CN119006292B
Text image super-resolution enhancement method, electronic equipment and storage medium
CN119338680A
Image processing method, system, equipment and medium
CN119941770A
Monocular depth estimation method and system based on text guidance and multi-scale fusion
CN119941816A
