Burmese text image generation method fused with gated attention

By integrating gating attention, the Myanmar image dataset is constructed and the gated attention map is introduced, which solves the problem of large gap between Myanmar text image synthesis and real scenes, and the generated image quality and recognition accuracy are significantly improved.

CN118864659BActive Publication Date: 2025-08-19小语智能信息科技(云南)有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410826376.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2025-08-19
Estimated Expiration
2044-06-25

AI Technical Summary

Technical Problem

The existing Burmese text image synthesis algorithm has a large gap with real scenes, resulting in poor performance of the training model, especially in low-resource language conditions, which is difficult to obtain high-quality labeled data.

Method used

Using a method of fusion gated attention, by constructing a Myanmar image dataset and introducing a gated attention map, combining the encoder-decoder structure and skeleton-guided learning, text and background information are extracted to generate more realistic Burmese text images.

Benefits of technology

The generated Burmese text image quality is improved, the background and text style retain a sense of reality, the text area and background are separated clearly, and the model performs better than traditional methods in the quality of generated images and the accuracy of recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118864659B_ABST
    Figure CN118864659B_ABST
Patent Text Reader

Abstract

The present invention relates to a method for generating Burmese text images by integrating gated attention, and belongs to the field of natural language processing. In order to solve the problem that the Burmese images synthesized by traditional text image synthesis algorithms are significantly different from real application scenarios, resulting in poor performance of the trained recognition model, a method for generating Burmese text images by integrating gated attention is proposed. The method mainly includes three parts: construction and preprocessing of a Burmese image dataset, a Burmese text rendering module, and generation of Burmese image text images by integrating gated attention. Compared with the general image text generation method, the present invention effectively synthesizes higher-quality text images, making the generated Burmese text images closer to text images in real scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a Burmese text image generation method integrating gated attention, and belongs to the technical field of natural language processing. Background Art

[0002] The performance of models trained using deep learning methods is closely related to the quality and quantity of training data. Burmese is a typical low-resource language, making it extremely difficult to obtain large amounts of high-quality annotated data. Manual annotation is also time-consuming and prone to human error. Therefore, in the absence of sufficient annotated data, automatically synthesizing annotated images is gaining increasing attention, successfully alleviating the problems of data scarcity and manual annotation.

[0003] Some existing OCR data synthesis methods are mainly implemented through algorithm design. The main implementation method is to set the font style, size and font color of the input text, randomly select a background image and simply combine it with the rendered text to form a new image, and add Gaussian noise or salt and pepper noise to simulate the noise interference of Burmese images in real application scenarios. Although this method can effectively alleviate the problem of insufficient training data in OCR tasks, the data synthesized by this method is quite different from the real scene, as shown in Table 1:

[0004] Table 1 Examples of low-quality images synthesized by existing algorithms

[0005] Summary of the Invention

[0006] This paper proposes a Burmese text image generation method that incorporates gated attention. While maintaining the realism of the original image, this method replaces or modifies one word in the source image with another, generating a realistic Burmese text image that preserves the style of both the text and the background. During the image synthesis process, the model learns the Burmese text rendering effect and background layer information. To avoid background interference with the text during text image generation, a gated attention map is integrated to focus the model on the text strokes and the texture and color of the surrounding area. This allows for more accurate background extraction from the input image, effectively improving the quality of the generated Burmese text image.

[0007] The technical solution of the present invention is: a method for generating Burmese text images by integrating gated attention, and the specific steps of the method are as follows:

[0008] Step 1. Construction and preprocessing of the Burmese image dataset: A Burmese text image dataset is constructed based on the character combination features of the Burmese language. The constructed Burmese text image dataset includes the source image, an image of the target text on a gray background, a skeletonized image of the target text, a background image of the source image, a rendering image of the target text in the source text style on the source background image, a binary mask of the target text grayscale image, and a rendering image of the target text in the source text style on the gray background. These image data serve as training data for the model network.

[0009] Step 2, use the Burmese text rendering module to render the source image I s Source text style rendering effect diagram of the target text on the source image background image I t As input, the purpose is to s The foreground style is extracted from the text rendering module, including font, color, and geometric deformation; the text rendering module outputs a semantic image containing the target text. t and the text style image O of the source image sk ;

[0010] Step 3. Erase all text stroke pixels in the source image through the background advance network and fill them with appropriate textures. In order to better assist in extracting the text style and background of the Burmese image, a picture erasing method fused with gated attention is proposed to reduce the interference of background noise, so that the model can better distinguish the texture and background image of the text stroke area, so as to more accurately extract the background part from the input image. Finally, the extracted background image is fused with the target text obtained by the text rendering module and the text style of the source image to obtain the edited Burmese image.

[0011] Furthermore, the specific steps of Step 1 are:

[0012] Step 1.1: Obtain cross-border Burmese text data from Burmese websites. Perform preprocessing by removing duplicates, segmenting, and filtering special characters. Construct a Burmese text label dictionary and randomly assign two different Burmese words to form "source text-target text" pairs. The source and target texts can be randomly assigned different fonts, colors, and bolding. At the same time, obtain real background images from Google and official Burmese websites to facilitate subsequent generation of training samples.

[0013] Step 1.2. For the obtained Burmese text and background image pairs, write an algorithm to construct image datasets under different conditions, including the source image, the image of the target text on the gray background image, the skeletonized image of the target text, the background image of the source image, the source text style rendering effect image of the target text on the source image background image, the binary mask of the target text grayscale image, and the source text style rendering effect image of the target text on the gray background image, and give corresponding labels;

[0014] Step 1.3: The constructed image dataset contains Burmese text images with various backgrounds, font colors, and different tilt angles, and is divided into corresponding training sets, validation sets, and test sets.

[0015] Furthermore, the specific steps of Step 2 are:

[0016] Step 2.1, use the encoder-decoder FCN structure to perform text rendering; for the encoding process, the source image I s After 3 downsampling convolution layers and 4 residual blocks, the input text image I t It is also encoded by the same architecture, and then the feature maps generated by the two images are concatenated. For decoding, there are three upsampling transposed convolution layers and 1 convolution block to generate the output O t Image. Its output can be expressed as:

[0017] O t =G t (I t , I s )

[0018] Step 2.2, in order to obtain the source image more realistically s text style, a skeleton-guided learning mechanism is introduced; specifically, a skeleton response block consisting of 3 upsampling layers and 1 convolutional layer is constructed, and a sigmoid activation function is added to predict a single-channel skeleton map, and then the skeleton heat map and the decoder output are connected along the depth axis; in order to generate more accurate results, the skeleton loss is used to measure the reconstruction quality of the skeleton response map, which is defined as follows.

[0019]

[0020] Where N is the number of pixels, T sk is the label of the target text skeleton image, O sk is the text skeleton output graph of the module;

[0021] Step 2.3. L1 loss is used to supervise the output of the text rendering module. Combined with the skeleton loss, the text rendering loss is calculated as follows:

[0022] L T =||T t -O t ||1+αL sk

[0023] Among them, T t is the true value of the text rendering module, and α is the regularization parameter, which is set to 1.

[0024] Furthermore, the specific steps of Step 3 are:

[0025] Step 3.1, firstly take the source image I s As input, extract its background image O b , source image I s The text stroke pixels are erased and filled with appropriate textures through the background subtraction network; the input source image I s It is encoded by 3 downsampling convolution layers with a stride of 2, followed by 4 residual blocks, and then the decoder generates an output image with the original size through 3 upsampling convolution layers; the ReLU activation function is used after each layer, and the tanh function is used in the output layer; U-Net is used to connect the previously encoded feature maps of the same size to retain richer texture information, which helps to recover the background information lost in the downsampling process;

[0026] Step 3.2. In order to make the model pay better attention to the text area in the Burmese image when extracting the background, an image erasing method integrating gated attention is proposed to better assist in extracting the text style and background of the Burmese image and reduce the interference of background noise. The gated attention module takes the feature map extracted by the feature extraction network as input, and generates a pseudo text stroke mask by calculating the pixel value difference between the input image and the true label image, and generates a text stroke area feature map and a text stroke surrounding area feature map respectively. The text stroke area feature map helps to strengthen the gated attention module's attention to the text area of the image, and the text stroke surrounding area feature map helps to better distinguish the text area range by focusing on the color and texture outside the text area. At the same time, the gated attention module adjusts the attention ratio allocated to the text stroke area feature map and the text stroke surrounding area feature map during the training process through Gate parameter adjustment. The calculation method is shown in the formula below.

[0027]

[0028] F t =W t ·F

[0029] F s =W s ·F

[0030] A out =σ(α i F t +β i F s )

[0031] O b =F In A out

[0032] Among them F In , O b are the input feature map and output feature map of the module respectively, W t and W s represents the 7x7 convolution kernel, F s , F t The text stroke area feature map and the text stroke surrounding area feature map are extracted by operation, α and β represent the gating parameters respectively, and σ represents the activation function;

[0033] Step 3.3: To better fuse the text style with the background image, the semantic image containing the target text generated by the text rendering module is fed into an encoder consisting of three downsampling convolutional layers and a residual block. A decoder with three upsampling transposed convolutional layers and a convolutional layer is used to generate the final edited image. Simultaneously, during the upsampling stage of the fusion decoder, the decoded feature map from the background restoration module is concatenated to the corresponding feature map of the same resolution. This results in an image output by the fusion network that essentially restores background details, effectively blends the text object with the background, and achieves a synthetically realistic appearance.

[0034] The beneficial effects of the present invention are:

[0035] 1. This paper proposes a Burmese text image generation method that integrates gated attention. While maintaining the realism of the original image, this method replaces or modifies one word in the source image with another, generating a realistic Burmese text image that preserves the style of both the text and the background. During the image synthesis process, the model learns the Burmese text rendering effect and background layer information.

[0036] 2. To avoid background interference with text during text image generation, the present invention proposes fusing a gated attention map to focus the model on the text strokes and the texture and color of the surrounding area, thereby more accurately extracting the background from the input image. This method achieves good results in the quality of Burmese text image generation, making the generated Burmese text images closer to real-world text images. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 This is a diagram of the Burmese text image generation model structure that integrates gated attention in the present invention;

[0038] Figure 2 This is a structural diagram of the gated attention module in the present invention;

[0039] Figure 3 This is the attention visualization result diagram in the present invention. DETAILED DESCRIPTION

[0040] Example 1: Figure 1-Figure 3 As shown in FIG, a Burmese text image generation method integrating gated attention is shown, and the specific steps of the method are as follows:

[0041] Step 1. Construction and preprocessing of the Burmese image dataset: A Burmese text image dataset is constructed based on the character combination features of the Burmese language. The constructed Burmese text image dataset includes the source image, an image of the target text on a gray background, a skeletonized image of the target text, a background image of the source image, a rendering image of the target text in the source text style on the source background image, a binary mask of the target text grayscale image, and a rendering image of the target text in the source text style on the gray background. These image data serve as training data for the model network.

[0042] Step 2, use the Burmese text rendering module to render the source image I s Source text style rendering effect diagram of the target text on the source image background image I t As input, the purpose is to s The foreground style is extracted from the text rendering module, including font, color, and geometric deformation; the text rendering module outputs a semantic image containing the target text. t and the text style image O of the source image sk ;

[0043] Step 3. Erase all text stroke pixels in the source image through the background advance network and fill them with appropriate textures. In order to better assist in extracting the text style and background of the Burmese image, a picture erasing method fused with gated attention is proposed to reduce the interference of background noise, so that the model can better distinguish the texture and background image of the text stroke area, so as to more accurately extract the background part from the input image. Finally, the extracted background image is fused with the target text obtained by the text rendering module and the text style of the source image to obtain the edited Burmese image.

[0044] Furthermore, the specific steps of Step 1 are:

[0045] Step 1.1: Obtain cross-border Burmese text data from Burmese websites. Perform preprocessing by removing duplicates, segmenting, and filtering special characters. Construct a Burmese text label dictionary and randomly assign two different Burmese words to form "source text-target text" pairs. The source and target texts can be randomly assigned different fonts, colors, and bolding. At the same time, obtain real background images from Google and official Burmese websites to facilitate subsequent generation of training samples.

[0046] Step 1.2. For the obtained Burmese text and background image pairs, write an algorithm to construct image datasets under different conditions, including the source image, the image of the target text on the gray background image, the skeletonized image of the target text, the background image of the source image, the source text style rendering effect image of the target text on the source image background image, the binary mask of the target text grayscale image, and the source text style rendering effect image of the target text on the gray background image, and give corresponding labels;

[0047] Step 1.3: The constructed image dataset contains Burmese text images with various backgrounds, font colors, and different tilt angles, and is divided into corresponding training sets, validation sets, and test sets.

[0048] Furthermore, the specific steps of Step 2 are:

[0049] Step 2.1, use the encoder-decoder FCN structure to perform text rendering; for the encoding process, the source image I s After 3 downsampling convolution layers and 4 residual blocks, the input text image I t It is also encoded by the same architecture, and then the feature maps generated by the two images are concatenated. For decoding, there are three upsampling transposed convolution layers and 1 convolution block to generate the output O t Image. Its output can be expressed as:

[0050] O t =G t (I t , I s )

[0051] Step 2.2, in order to obtain the source image more realistically s text style, a skeleton-guided learning mechanism is introduced; specifically, a skeleton response block consisting of 3 upsampling layers and 1 convolutional layer is constructed, and a sigmoid activation function is added to predict a single-channel skeleton map, and then the skeleton heat map and the decoder output are connected along the depth axis; in order to generate more accurate results, the skeleton loss is used to measure the reconstruction quality of the skeleton response map, which is defined as follows.

[0052]

[0053] Where N is the number of pixels, T sk is the label of the target text skeleton image, O sk is the text skeleton output graph of the module;

[0054] Step 2.3. L1 loss is used to supervise the output of the text rendering module. Combined with the skeleton loss, the text rendering loss is calculated as follows:

[0055] L T =||T t -O t ||1+αL sk

[0056] Among them, T t is the true value of the text rendering module, and α is the regularization parameter, which is set to 1.

[0057] Furthermore, the specific steps of Step 3 are:

[0058] Step 3.1, firstly take the source image I s As input, extract its background image O b , source image I s The text stroke pixels are erased and filled with appropriate textures through the background subtraction network; the input source image I s It is encoded by 3 downsampling convolution layers with a stride of 2, followed by 4 residual blocks, and then the decoder generates an output image with the original size through 3 upsampling convolution layers; the ReLU activation function is used after each layer, and the tanh function is used in the output layer; U-Net is used to connect the previously encoded feature maps of the same size to retain richer texture information, which helps to recover the background information lost in the downsampling process;

[0059] Step 3.2. In order to make the model pay better attention to the text area in the Burmese image when extracting the background, an image erasing method integrating gated attention is proposed to better assist in extracting the text style and background of the Burmese image and reduce the interference of background noise. The gated attention module takes the feature map extracted by the feature extraction network as input, and generates a pseudo text stroke mask by calculating the pixel value difference between the input image and the true label image, and generates a text stroke area feature map and a text stroke surrounding area feature map respectively. The text stroke area feature map helps to strengthen the gated attention module's attention to the text area of the image, and the text stroke surrounding area feature map helps to better distinguish the text area range by focusing on the color and texture outside the text area. At the same time, the gated attention module adjusts the attention ratio allocated to the text stroke area feature map and the text stroke surrounding area feature map during the training process through Gate parameter adjustment. The calculation method is shown in the formula below.

[0060]

[0061] F t =W t ·F

[0062] F s =W s ·F

[0063] A out =σ(α i F t +β i F s )

[0064] O b =F In A out

[0065] Among them F In , O b are the input feature map and output feature map of the module respectively, W t and W s represents the 7x7 convolution kernel, F s , F t The text stroke area feature map and the text stroke surrounding area feature map are extracted by operation, α and β represent the gating parameters respectively, and σ represents the activation function;

[0066] Step 3.3: To better fuse the text style with the background image, the semantic image containing the target text generated by the text rendering module is fed into an encoder consisting of three downsampling convolutional layers and a residual block. A decoder with three upsampling transposed convolutional layers and a convolutional layer is used to generate the final edited image. Simultaneously, during the upsampling stage of the fusion decoder, the decoded feature map from the background restoration module is concatenated to the corresponding feature map of the same resolution. This results in an image output by the fusion network that essentially restores background details, effectively blends the text object with the background, and achieves a synthetically realistic appearance.

[0067] In order to verify the effectiveness of the Burmese text image generation method integrating gated attention proposed in this paper, the following comparative experiment was designed for analysis.

[0068] The experiment uses the commonly used evaluation criteria in image generation to evaluate this method, including: mean square error (MSE), peak signal-to-noise ratio (PSNR), and structural similarity index (SSIM). Smaller MSE values or higher SSIM and PSNR indicate higher quality of the generated image.

[0069] (1) Mean squared error (MSE), also known as L2 loss, is calculated by taking the mean of the squared difference between the model’s predicted value f(x) and the true sample value y. The calculation formula is as follows:

[0070]

[0071] Among them, y i and f xi They represent the true value of the i-th sample and its corresponding predicted value, and n is the number of samples.

[0072] (2) Calculate the peak signal-to-noise ratio (PSNR), which is the logarithm of the square error between the original image and the processed image relative to the square of the maximum signal. The calculation formula is as follows:

[0073]

[0074] Among them, MAX I 2 Indicates the maximum possible pixel value of the image.

[0075] (3) SSIM, the structural similarity index, compares the original image and the generated image in terms of brightness, contrast, and structure. The calculation formula is as follows:

[0076]

[0077] Among them, μ x is the mean value of x, μ y is the mean value of y, is the variance of x, is the variance of y, σ xy is the covariance of x and y, c1 and c2 are constants.

[0078] To verify the effectiveness of our method, we conducted experiments using 400,000 Burmese images as a training set and 20,000 images as a test set. The input images were resized to 64x256, and the batch size was 32. The entire framework was optimized using the Adam optimizer. During the training phase, the learning rate was set to 0.0001.

[0079] Experiment 1: Comparative experimental results

[0080] The experimental results are compared with other text image generation models. Specifically, the present invention selects open source models such as Pix2pix and SRNet for comparison, and the experimental results are shown in Table 2.

[0081] Table 2 Comparison of the results of the method of the present invention and other methods

[0082]

[0083] Table 2 shows that the proposed method achieves significant improvements across all three image quality evaluation metrics. Specifically, PSNR and SSIM improve by at least 0.27 and 0.05, respectively, compared to other methods. This indicates that the Burmese images synthesized using the proposed method exhibit improvements in structural similarity and contrast, with greater attention paid to image edges and textures during the synthesis process. The L2 error is reduced by at least 0.004, demonstrating that the image generation model has achieved a significant improvement in the accuracy of the target image.

[0084] Experiment 2: Model test comparison experiment

[0085] To further evaluate the quality of the generated images, we used Burmese text images synthesized using a common algorithm and images synthesized by the proposed model to train text recognition models using mainstream text recognition methods. We also used the same real Burmese image dataset as a test set, consisting of 1,000 manually annotated images. The experimental results are shown in Table 3:

[0086] Table 3 Comparison of results of images synthesized by different methods in text recognition model

[0087]

[0088] Table 3 shows the text recognition accuracy of the models trained using different text recognition methods for the image data synthesized by the present invention and the traditional method. The recognition accuracy of the present invention's method using the three different text recognition methods is superior to that of the data synthesized by the traditional method. The accuracy of "CNN+BiLSTM+CTC" reached 92.5%, indicating that the Burmese images synthesized by the present invention are closer to the real scene text than the data synthesized by the traditional method, and the fusion of the text rendering and background layer is closer to the distribution of the real image.

[0089] In order to fully verify the attention of the gated attention module to the background layer of the text image during model training, the model was visualized when extracting the background. Different colors were assigned according to the weight of the attention on the image area. The darker the orange, the higher the model's attention to the area. The visualization results are shown below. Figure 3 shown. Figure 3 (a) represents the input Burmese image, Figure 3 (b) shows the model attention visualization diagram after 30, 60, and 90 rounds of training. It can be seen from the figure that the model of the present invention can better focus on the text area when extracting the Burmese background layer, greatly reducing the interference caused by background information, and making the extracted background image more complete.

[0090] The specific embodiments of the present invention are described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Various changes can be made within the knowledge of ordinary technicians in this field without departing from the scope of the present invention.

Claims

1. A Burmese text image generation method integrating gated attention, characterized by: The specific steps of the method are as follows: Step 1. Construction and preprocessing of the Burmese image dataset: A Burmese text image dataset is constructed based on the character combination features of the Burmese language. The constructed Burmese text image dataset includes the source image, an image of the target text on a gray background, a skeletonized image of the target text, a background image of the source image, a rendering image of the target text in the source text style on the source background image, a binary mask of the target text grayscale image, and a rendering image of the target text in the source text style on the gray background. These image data serve as training data for the model network. Step 2, use the Burmese text rendering module to render the source image I s Source text style rendering effect diagram of the target text on the source image background image I t As input, the purpose is to s The foreground style is extracted from the text rendering module, including font, color, and geometric deformation; the text rendering module outputs a semantic image containing the target text. t and the text style image O of the source image sk ; Step 3: All text stroke pixels in the source image are erased and filled with appropriate textures through the background advance network. To better assist in extracting the text style and background of the Burmese image, an image erasure method fused with gated attention is proposed to reduce the interference of background noise, enabling the model to better distinguish the texture and background image of the text stroke area, thereby more accurately extracting the background part from the input image. Finally, the extracted background image is fused with the target text obtained by the text rendering module and the text style of the source image to obtain the edited Burmese image. The gated attention module takes the feature map extracted by the feature extraction network as input, generates a pseudo text stroke mask by calculating the pixel value difference between the input image and the real label image, and generates a text stroke area feature map and a text stroke surrounding area feature map respectively. The text stroke area feature map helps to strengthen the gated attention module's attention to the text area of the image, while the text stroke surrounding area feature map helps to better distinguish the text area range by focusing on the color and texture outside the text area; at the same time, the gated attention module adjusts the attention ratio allocated to the text stroke area feature map and the text stroke surrounding area feature map during the training process through Gate parameter adjustment.

2. The Burmese text image generation method integrating gated attention according to claim 1 is characterized in that: The specific steps of Step 1 are: Step 1.1: Obtain cross-border Burmese text data from Burmese websites. Perform preprocessing by removing duplicates, segmenting, and filtering special characters. Construct a Burmese text label dictionary and randomly assign two different Burmese words to form "source text-target text" pairs. The source and target texts can be randomly assigned different fonts, colors, and bolding. Also, obtain real background images from Google and official Burmese websites to facilitate subsequent training sample generation. Step 1.

2. For the obtained Burmese text pairs and background images, write an algorithm to construct image datasets under different conditions: source image, image of target text on gray background, skeletonized image of target text, background image of source image, source text style rendering effect image of target text on source background image, binary mask of target text grayscale image, and source text style rendering effect image of target text on gray background, and give corresponding labels; Step 1.3: The constructed image dataset contains Burmese text images with various backgrounds, font colors, and different tilt angles, and is divided into corresponding training sets, validation sets, and test sets.

3. The Burmese text image generation method integrating gated attention according to claim 1 is characterized in that: The specific steps of Step 2 are: Step 2.1, use the encoder-decoder FCN structure to perform text rendering; for the encoding process, the source image I s After 3 downsampling convolution layers and 4 residual blocks, the input text image I t It is also encoded by the same architecture, and then the feature maps generated by the two images are concatenated. For decoding, there are three upsampling transposed convolution layers and 1 convolution block to generate the output O t The output of the image can be expressed as: O t =G t (I t ,I s ) Step 2.2, in order to obtain the source image more realistically s Specifically, a skeleton response block consisting of three upsampling layers and one convolutional layer is constructed, and a sigmoid activation function is added to predict a single-channel skeleton map. The skeleton heat map and the decoder output are then connected along the depth axis. In order to generate more accurate results, the skeleton loss is used to measure the reconstruction quality of the skeleton response map, which is defined as follows: Where N is the number of pixels, T sk is the label of the target text skeleton image, O sk is the text-style image of the source image; Step 2.

3. L1 loss is used to supervise the output of the text rendering module. Combined with the skeleton loss, the text rendering loss is calculated as follows: L T =||T t -O t ||1+αL sk Among them, T t is the true value of the text rendering module, and α is the regularization parameter, which is set to 1.

4. The Burmese text image generation method integrating gated attention according to claim 1 is characterized in that: The specific steps of Step 3 are: Step 3.1, firstly take the source image I s As input, extract its background image O b , source image I s The text stroke pixels are erased and filled with appropriate textures through the background subtraction network; the input source image I s It is encoded by 3 downsampling convolution layers with a stride of 2, followed by 4 residual blocks, and then the decoder generates an output image with the original size through 3 upsampling convolution layers; the ReLU activation function is used after each layer, and the tanh function is used in the output layer; U-Net is used to connect the previously encoded feature maps of the same size to retain richer texture information, which helps to recover the background information lost in the downsampling process; Step 3.2: To enable the model to better focus on the text area in the Burmese image while extracting the background, we propose an image erasing method that integrates gated attention. This method can better assist in extracting the text style and background of the Burmese image and reduce the interference of background noise. The calculation method of the image erasing method that integrates gated attention is shown in the formula below. F t =W t ·F F s =W s ·F A out =σ(α i F t +b i F s ) O b =F In A out Among them F In , O b are the input feature map and output feature map of the module respectively, W t and W s represents the 7x7 convolution kernel, F s , F t The text stroke area feature map and the text stroke surrounding area feature map are extracted by operation, α and β represent the gating parameters respectively, and σ represents the activation function; Step 3.

3. In order to better fuse the text style with the background image, the semantic image containing the target text generated by the text rendering module is fed into the encoder. The encoder consists of three downsampling convolutional layers and residual blocks. A decoder with three upsampling transposed convolutional layers and convolutional layers is used to generate the final edited image. At the same time, in the upsampling stage of the fusion decoder, the decoded feature map of the background restoration module is connected to the corresponding feature map with the same resolution. In this way, the image output by the fusion network is basically restored in terms of background details, the text object and the background are well integrated, and the synthetic realism is achieved in appearance.

Citation Information

Patent Citations

  • Method and device for recognizing Murankang language image text fused with double attention mechanisms

    CN115471851A

  • Method and device for training image generation model

    CN116091630A