A processing method, device and electronic device for font migration model

By using radical attention model and parameter adjustment technology in the font migration model, the problem of inaccurate recognition of radical positions in the existing technology is solved, and the font migration effect of the target font text image is significantly improved.

CN113627124BActive Publication Date: 2025-05-16ALIBABA GROUP HOLDING LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010381723.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-05-08
Publication Date
2025-05-16
Estimated Expiration
2040-05-08

AI Technical Summary

Technical Problem

The existing font migration method based on radicals cannot accurately find the location of the radical, resulting in poor font migration effect of the target font text image.

Method used

By inputting the sample text image and the target font image into the font migration model to be trained, the target font migration image is obtained, and the text radical dicing diagram is obtained through the radical attention model, and the model parameters are adjusted until the radical dicing diagram is matched to the target font image.

Benefits of technology

It significantly improves the font migration effect of the target font text image, so that the text radical tiling diagram can be processed and migrated more accurately.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113627124B_ABST
    Figure CN113627124B_ABST
Patent Text Reader

Abstract

The present application provides a processing method for a font migration model, including: inputting a sample text image and a target font image into a current font migration model to be trained, obtaining a target font migration image corresponding to the sample text image, the current font migration model to be trained being used to obtain a font migration image corresponding to the text image based on the text image and the target font image; obtaining a text radical cut-up diagram corresponding to the text in the target font migration image, and obtaining a text radical cut-up diagram corresponding to the text in the target font image; if the font in the text radical cut-up diagram corresponding to the text in the target font migration image matches the font in the text radical cut-up diagram corresponding to the text in the target font image, then using the current font migration model to be trained as the target font migration model. The processing method for a font migration model provided by the present application improves the font migration effect of the target font text image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and specifically to a processing method for a font migration model, and also to a processing device, electronic device and storage medium for a font migration model. Background Art

[0002] As a new research direction in the field of machine learning, deep learning models have been widely used in the fields of text recognition, image recognition, and sound recognition. At present, the accuracy of deep learning models is closely related to model training data. However, the model training data used to train deep learning models often has very few or even no training data of some rare categories, which is a catastrophic problem for the training of deep learning models. For example, the model training data of deep learning models used for text recognition generally has a long tail effect. In order to improve the accuracy of deep learning models used for text recognition, it is often necessary to synthesize text training images, and in order to ensure that the synthesized text training images have better representation capabilities, relevant personnel often use font migration to make the synthesized text training images have target fonts, so that the synthesized text training images are closer to the actual text data.

[0003] At present, among the existing methods for synthesizing target font text images through font migration, the radical-based font migration method is effective for text with complex structures, such as Chinese. However, the existing radical-based font migration method can only generally divide the radical, that is, generally split the text into upper and lower parts as radicals, or left and right parts as radicals, and cannot accurately find the exact position of the radical, resulting in poor font migration effect of the target font text image. Summary of the invention

[0004] The present application provides a processing method, device, electronic device and storage medium for a font migration model to improve the font migration effect of a target font text image.

[0005] The present application provides a processing method for a font migration model, including:

[0006] Inputting a sample text image and a target font image into a current font transfer model to be trained to obtain a target font transfer image corresponding to the sample text image, wherein the current font transfer model to be trained is used to obtain a font transfer image corresponding to the text image based on the text image and the target font image;

[0007] Obtaining a text radical block diagram corresponding to the text in the target font migration image, and obtaining a text radical block diagram corresponding to the text in the target font image;

[0008] If the font in the character radical block diagram corresponding to the characters in the target font migration image matches the font in the character radical block diagram corresponding to the characters in the target font image, the current font migration model to be trained is used as the target font migration model.

[0009] Optionally, also include:

[0010] If the font in the character radical block diagram corresponding to the character in the target font migration image does not match the font in the character radical block diagram corresponding to the character in the target font image, adjusting the parameters of the current font migration model to be trained to obtain a first font migration model;

[0011] Using the first font migration model as the current font migration model to be trained;

[0012] Inputting the sample text image and the target font image into the current to-be-trained font migration model to obtain a first target font migration image corresponding to the sample text image;

[0013] Obtaining a character radical block diagram corresponding to the characters in the first target font migration image, and obtaining a character radical block diagram corresponding to the characters in the target font image;

[0014] If the font in the character radical block diagram corresponding to the characters in the first target font migration image matches the font in the character radical block diagram corresponding to the characters in the target font image, the current font migration model to be trained is used as the target font migration model.

[0015] Optionally, it also includes: if the font in the text radical cut-block diagram corresponding to the text in the first target font migration image does not match the font in the text radical cut-block diagram corresponding to the text in the target font image, then adjusting the parameters of the current font migration model to be trained to obtain a second font migration model, and using the second font migration model as the current font migration model to be trained, and so on, until the target font migration model is obtained.

[0016] Optionally, the method of obtaining a text radical cut-up map corresponding to the text in the target font migration image and obtaining a text radical cut-up map corresponding to the text in the target font image includes: inputting the target font migration image and the target font image into a radical attention model, obtaining a text radical cut-up map corresponding to the text in the target font migration image, and obtaining a text radical cut-up map corresponding to the text in the target font image, the radical attention model being used to obtain a text radical heat map corresponding to the text in the font image based on the font image, and obtaining a text radical cut-up map corresponding to the text in the font image based on the text radical heat map corresponding to the text in the font image.

[0017] Optionally, also include:

[0018] Get the target radical segmentation diagram;

[0019] For the target radical segmentation diagram, a sample font image and a character radical heat map corresponding to the characters in the sample font image are obtained;

[0020] The radical attention model is obtained according to the target radical segmentation diagram, the sample font image, and a character radical heat map corresponding to the characters in the sample font image.

[0021] Optionally, the step of inputting the target font migration image and the target font image into a radical attention model, obtaining a text radical block diagram corresponding to the text in the target font migration image, and obtaining a text radical block diagram corresponding to the text in the target font image, comprises:

[0022] scaling the target font migration image and the target font image to a specified size;

[0023] Performing feature extraction on the target font migration image of the specified size and the target font image of the specified size to obtain text image features corresponding to the target font migration image and text image features corresponding to the target font image;

[0024] Obtaining a heat map of character radicals corresponding to the characters in the target font migration image and a heat map of character radicals corresponding to the characters in the target font image according to the character image features corresponding to the target font migration image and the character image features corresponding to the target font image;

[0025] According to the text radical heat map corresponding to the text in the target font migration image and the text radical heat map corresponding to the text in the target font image, a text radical cut-out map corresponding to the text in the target font migration image is obtained, and a text radical cut-out map corresponding to the text in the target font image is obtained.

[0026] Optionally, the performing feature extraction on the target font migration image of the specified size and the target font image of the specified size to obtain text image features corresponding to the target font migration image and text image features corresponding to the target font image includes: performing text outline image feature extraction on the target font migration image of the specified size and the target font image of the specified size to obtain text outline image features corresponding to the target font migration image and text outline image features corresponding to the target font image.

[0027] Optionally, the performing feature extraction on the target font migration image of the specified size and the target font image of the specified size to obtain text image features corresponding to the target font migration image and text image features corresponding to the target font image includes: performing text stroke image feature extraction on the target font migration image of the specified size and the target font image of the specified size to obtain text stroke image features corresponding to the target font migration image and text stroke image features corresponding to the target font image.

[0028] Optionally, obtaining a heat map of text radicals corresponding to the text in the target font migration image and a heat map of text radicals corresponding to the text in the target font image according to the text image features corresponding to the target font migration image and the text image features corresponding to the target font image includes:

[0029] Performing average pooling on the text image features corresponding to the target font migration image and the text image features corresponding to the target font image to obtain one-dimensional text image features corresponding to the target font migration image and one-dimensional text image features corresponding to the target font image;

[0030] Encoding the one-dimensional text image features corresponding to the target font migration image and the one-dimensional text image features corresponding to the target font image to obtain contextual coding features of the text image corresponding to the target font migration image and contextual coding features of the text image features corresponding to the target font image;

[0031] According to the contextual coding features of the text image corresponding to the target font migration image and the contextual coding features of the text image features corresponding to the target font image, a text radical heat map corresponding to the text in the target font migration image and a text radical heat map corresponding to the text in the target font image are obtained.

[0032] Optionally, obtaining a heat map of text radicals corresponding to the text in the target font migration image and a heat map of text radicals corresponding to the text in the target font image according to the contextual coding features of the text image corresponding to the target font migration image and the contextual coding features of the text image features corresponding to the target font image, comprises:

[0033] Obtaining probability distribution information corresponding to the characters in the target font migration image and probability distribution information corresponding to the characters in the target font image according to context coding features of the character image corresponding to the target font migration image and context coding features of the character image features corresponding to the target font image;

[0034] According to the probability distribution information corresponding to the characters in the target font migration image and the probability distribution information corresponding to the characters in the target font image, a heat map of character radicals corresponding to the characters in the target font migration image and a heat map of character radicals corresponding to the characters in the target font image are obtained.

[0035] Optionally, the method of obtaining a cut-up map of text radicals corresponding to the text in the target font migration image and a cut-up map of text radicals corresponding to the text in the target font image based on a heat map of text radicals corresponding to the text in the target font migration image and a heat map of text radicals corresponding to the text in the target font image comprises: obtaining a cut-up map of text radicals corresponding to the text in the target font migration image and a cut-up map of text radicals corresponding to the text in the target font image based on contextual coding features of the text image corresponding to the target font migration image, a heat map of text radicals corresponding to the text in the target font migration image and contextual coding features of text image features corresponding to the target font image and a heat map of text radicals corresponding to the text in the target font image, and obtaining a cut-up map of text radicals corresponding to the text in the target font image.

[0036] Optionally, if the font in the text radical cut-block diagram corresponding to the text in the target font migration image matches the font in the text radical cut-block diagram corresponding to the text in the target font image, then the current font migration model to be trained is used as the target font migration model, including: if the font in the text radical cut-block diagram corresponding to the text in the target font migration image matches the font in the text radical cut-block diagram corresponding to the text in the target font image, the degree of matching is greater than or equal to a font matching degree threshold, then the current font migration model to be trained is used as the target font migration model.

[0037] Optionally, if the font in the text radical cut-block diagram corresponding to the text in the target font migration image does not match the font in the text radical cut-block diagram corresponding to the text in the target font image, then the parameters of the current font migration model to be trained are adjusted to obtain a first font migration model, including: if the font in the text radical cut-block diagram corresponding to the text in the target font migration image and the font in the text radical cut-block diagram corresponding to the text in the target font image have a matching degree less than the font matching degree threshold, then the parameters of the current font migration model to be trained are adjusted to obtain a first font migration model.

[0038] Optionally, it also includes: obtaining the matching degree between the font in the character radical cutting block diagram corresponding to the characters in the target font migration image and the font in the character radical cutting block diagram corresponding to the characters in the target font image.

[0039] Optionally, the step of inputting the sample text image and the target font image into the current font transfer model to be trained to obtain the target font transfer image corresponding to the sample text image includes:

[0040] Scaling the sample text image and the target font image to a preset size;

[0041] According to the sample text image of the preset size and the target font image of the preset size, a target font migration image corresponding to the sample text image is obtained.

[0042] In another aspect, the present application provides a processing device for a font migration model, comprising:

[0043] A target font migration image obtaining unit is used to input a sample text image and a target font image into a current font migration model to be trained, and obtain a target font migration image corresponding to the sample text image. The current font migration model to be trained is used to obtain a font migration image corresponding to the text image based on the text image and the target font image.

[0044] A character radical block diagram obtaining unit, used to obtain a character radical block diagram corresponding to the character in the target font migration image, and obtain a character radical block diagram corresponding to the character in the target font image;

[0045] The target font migration model obtaining unit is used to use the current font migration model to be trained as the target font migration model if the font in the character radical cutting block diagram corresponding to the character in the target font migration image matches the font in the character radical cutting block diagram corresponding to the character in the target font image.

[0046] In another aspect, the present application provides an electronic device, including:

[0047] Processor; and

[0048] The memory is used to store a program of a processing method for a font migration model. After the device is powered on and the program of the processing method for the font migration model is run by the processor, the following steps are performed:

[0049] Inputting a sample text image and a target font image into a current font transfer model to be trained to obtain a target font transfer image corresponding to the sample text image, wherein the current font transfer model to be trained is used to obtain a font transfer image corresponding to the text image based on the text image and the target font image;

[0050] Obtaining a text radical block diagram corresponding to the text in the target font migration image, and obtaining a text radical block diagram corresponding to the text in the target font image;

[0051] If the font in the character radical block diagram corresponding to the characters in the target font migration image matches the font in the character radical block diagram corresponding to the characters in the target font image, the current font migration model to be trained is used as the target font migration model.

[0052] In another aspect of the present application, a storage medium is provided, which stores a program of a processing method for a font migration model, and the program is executed by a processor to perform the following steps:

[0053] Inputting a sample text image and a target font image into a current font transfer model to be trained to obtain a target font transfer image corresponding to the sample text image, wherein the current font transfer model to be trained is used to obtain a font transfer image corresponding to the text image based on the text image and the target font image;

[0054] Obtaining a text radical block diagram corresponding to the text in the target font migration image, and obtaining a text radical block diagram corresponding to the text in the target font image;

[0055] If the font in the character radical block diagram corresponding to the characters in the target font migration image matches the font in the character radical block diagram corresponding to the characters in the target font image, the current font migration model to be trained is used as the target font migration model.

[0056] In another aspect, the present application provides a font migration method, comprising:

[0057] Obtain the text image to be processed and the target font image;

[0058] Inputting the to-be-processed text image and the target font image into a radical segmentation unit of a target font migration model, outputting a text radical segmentation diagram corresponding to the text in the to-be-processed text image, and outputting a text radical segmentation diagram corresponding to the text in the target font image, wherein the target font migration model is used to obtain a font migration image corresponding to the text image according to the text image and the target font image;

[0059] The character radical block diagram corresponding to the characters in the character image to be processed and the character radical block diagram corresponding to the characters in the target font image are input into the font migration unit of the target font migration model, and the target font migration image corresponding to the character image to be processed is output.

[0060] Optionally, the method further includes: displaying the target font migration image.

[0061] Optionally, obtaining the to-be-processed text image and the target font image includes: obtaining the to-be-processed text image and the target font image provided by a client.

[0062] Optionally, the method further includes: providing a designated target font migration image corresponding to the text image to be processed to the client.

[0063] In another aspect, the present application provides a processing device for a font migration model, comprising:

[0064] An image acquisition unit, used for acquiring a text image to be processed and a target font image;

[0065] A character radical block diagram obtaining unit, used for inputting the to-be-processed character image and the target font image into the radical block diagram of the target font migration model, outputting the character radical block diagram corresponding to the characters in the to-be-processed character image, and outputting the character radical block diagram corresponding to the characters in the target font image;

[0066] a radical font migration image obtaining unit, used for inputting the character radical block diagram corresponding to the characters in the to-be-processed character image and the character radical block diagram corresponding to the characters in the target font image into the font migration unit of the target font migration model, obtaining the target radical font migration image of the character radical corresponding to the characters in the to-be-processed character image through font migration, wherein the font in the target radical font migration image matches the font in the character radical block diagram corresponding to the characters in the target font image;

[0067] The target font migration image obtaining unit is used to assemble the target font radical migration images to obtain a target font migration image.

[0068] In another aspect, the present application provides an electronic device, including:

[0069] Processor; and

[0070] The memory is used to store a program of the font migration method. After the device is powered on and the processor runs the program of the processing method for the font migration model, the following steps are performed:

[0071] Obtain the text image to be processed and the target font image;

[0072] Input the to-be-processed text image and the target font image into the radical segmentation unit of the target font migration model, output the text radical segmentation diagram corresponding to the text in the to-be-processed text image, and output the text radical segmentation diagram corresponding to the text in the target font image;

[0073] Inputting a text radical block diagram corresponding to the text in the to-be-processed text image and a text radical block diagram corresponding to the text in the target font image into a font migration unit of the target font migration model, obtaining a target radical font migration image of the text radical corresponding to the text in the to-be-processed text image through font migration, wherein the font in the target radical font migration image matches the font in the text radical block diagram corresponding to the text in the target font image;

[0074] The target font radical migration images are assembled to obtain a target font migration image.

[0075] In another aspect of the present application, a storage medium is provided, which stores a program for a font migration method, and the program is executed by a processor to perform the following steps:

[0076] Obtain the text image to be processed and the target font image;

[0077] Input the to-be-processed text image and the target font image into the radical segmentation unit of the target font migration model, output the text radical segmentation diagram corresponding to the text in the to-be-processed text image, and output the text radical segmentation diagram corresponding to the text in the target font image;

[0078] Inputting a text radical block diagram corresponding to the text in the to-be-processed text image and a text radical block diagram corresponding to the text in the target font image into a font migration unit of the target font migration model, obtaining a target radical font migration image of the text radical corresponding to the text in the to-be-processed text image through font migration, wherein the font in the target radical font migration image matches the font in the text radical block diagram corresponding to the text in the target font image;

[0079] The target font radical migration images are assembled to obtain a target font migration image.

[0080] On the other hand, the present application provides a processing method for a font migration model, including:

[0081] Inputting a sample text image and a target font image into a current font transfer model to be trained to obtain a target font transfer image corresponding to the sample text image, wherein the current font transfer model to be trained is used to obtain a font transfer image corresponding to the text image based on the text image and the target font image;

[0082] Obtaining a text letter block diagram corresponding to the text in the target font migration image, and obtaining a text letter block diagram corresponding to the text in the target font image;

[0083] If the font in the text letter block diagram corresponding to the text in the target font migration image matches the font in the text letter block diagram corresponding to the text in the target font image, the current font migration model to be trained is used as the target font migration model.

[0084] In another aspect, the present application provides a font migration method, comprising:

[0085] Obtain the text image to be processed and the target font image;

[0086] Input the to-be-processed text image and the target font image into the radical segmentation unit of the target font migration model, output the text letter segmentation diagram corresponding to the text in the to-be-processed text image, and output the text letter segmentation diagram corresponding to the text in the target font image;

[0087] Inputting a text letter segmentation diagram corresponding to the text in the to-be-processed text image and a text letter segmentation diagram corresponding to the text in the target font image into a font migration unit of the target font migration model, obtaining a target radical font migration image of the text letters corresponding to the text in the to-be-processed text image through font migration, wherein the font in the target radical font migration image matches the font in the text letter segmentation diagram corresponding to the text in the target font image;

[0088] The target font radical migration images are assembled to obtain a target font migration image.

[0089] Compared with the prior art, this application has the following advantages:

[0090] The processing method for the font migration model provided by the present application first inputs the sample text image and the target font image into the current font migration model to be trained, and obtains the target font migration image corresponding to the sample text image; then obtains the text radical cut-up diagram corresponding to the text in the target font migration image, and obtains the text radical cut-up diagram corresponding to the text in the target font image; finally, if the font in the text radical cut-up diagram corresponding to the text in the target font migration image matches the font in the text radical cut-up diagram corresponding to the text in the target font image, the current font migration model to be trained is used as the target font migration model. The processing method for the font migration model provided by the present application enables the target font migration model to explicitly cut out the text radical cut-up diagram for processing, so as to better perform font migration on the radical of the text image to be processed based on the text radical, thereby improving the font migration effect of the target font text image. BRIEF DESCRIPTION OF THE DRAWINGS

[0091] Figure 1 This is a first schematic diagram of an application scenario of the processing method for the font migration model provided in the present application.

[0092] Figure 1A This is a first schematic diagram of an application scenario of the processing method for the font migration model provided in the present application.

[0093] Figure 2 This is a flowchart of a processing method for a font migration model provided in the first embodiment of the present application.

[0094] Figure 3 This is a flowchart of a method for obtaining a radical attention model provided in the first embodiment of the present application.

[0095] Figure 4 This is a flowchart of a method for obtaining a character radical block diagram provided in the first embodiment of the present application.

[0096] Figure 5 It is a schematic diagram of a processing device for a font migration model provided in the second embodiment of the present application.

[0097] Figure 6 A schematic diagram of an electronic device provided in an embodiment of the present application.

[0098] Figure 7 This is a flowchart of a font migration method provided in the fifth embodiment of the present application.

[0099] Figure 8 This is a schematic diagram of a font migration device provided in the sixth embodiment of the present application. DETAILED DESCRIPTION

[0100] In the following description, numerous specific details are set forth to provide a thorough understanding of the present application. However, the present application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar generalizations without departing from the connotation of the present application. Therefore, the present application is not limited by the specific implementations disclosed below.

[0101] To more clearly demonstrate the processing method for the font migration model provided by the present application, first introduce the application scenario of the processing method for the font migration model provided by the present application.

[0102] The processing method for the font migration model provided by the present application is generally applied to the application scenario of transforming the text in the text image to be processed into a specified target font. In the application scenario of the processing method for the font migration model provided by the present application, the text is composed of radicals and has a complex structure, such as Chinese, Korean, Japanese, etc.; the target font is the standard of the font migration result and is used to indicate the font that the text in the text image to be processed ultimately needs to be transformed into; font migration is to transform the text in the text image to be processed into a specified target font; the target font migration model is a font migration model obtained through model training with a large number of samples and meeting the preset conditions, where the preset condition is that the font in the text radical cut-out map corresponding to the text in the font migration image obtained through the target font migration model matches the font in the text radical cut-out map corresponding to the text in the target font image. In the application scenario of the processing method for the font migration model provided by the present application, the font migration model is used to obtain the font migration image corresponding to the text image based on the text image and the target font image.

[0103] In the application scenario of the processing method for the font migration model provided by the present application, the text radical is the basic component of the text and is generally the text component cut out according to the structure of the text. The "radical" and "head radical" in dictionaries, etc. all correspond to the radicals in the present application. In the application scenario of the processing method for the font migration model provided by the present application, the text radical cut-out map is the image corresponding to the radical cut out from the text in the text image. For example, for the text image corresponding to "ice", its text radical cut-out map is the image corresponding to the radical "冫" and the image corresponding to the radical "水"; for the text image corresponding to "迩", its text radical cut-out map is the image corresponding to the radical "辶" and the image corresponding to the radical "尔".

[0104] In the application scenario of the processing method for the font migration model provided by this application, the execution subject can be a server or a client with a related font migration application installed, such as a smartphone, tablet computer, and PC (Personal Computer) with a related font migration application installed. The following specifically takes the execution subject as an example to explain in detail the application scenario of the processing method for the font migration model provided by the application.

[0105] like Figure 1 As shown, it is a first schematic diagram of an application scenario of the processing method for the font migration model provided by the present application.

[0106] After obtaining the to-be-processed text image 102 and the designated target font image 103 , the server 101 inputs the to-be-processed text image 102 and the designated target font image 103 into the target font migration model to obtain the designated target font migration image 104 corresponding to the to-be-processed text image.

[0107] In the application scenario of the processing method for the font transfer model provided by the present application, the designated target font transfer image corresponding to the text image to be processed is an image after the font of the text in the text image to be processed is converted into the font of the text in the designated target font image through the target font transfer model with reference to the designated target font image. In the application scenario of the processing method for the font transfer model provided by the present application, the target font image is generally a plurality of pre-designed font images with the same font style, and the text in the target font image can be split into all or part of the predetermined radicals that constitute the text. Figure 1 The font image corresponding to "he" is the designated target font image 103, but the designated target font image 103 often includes multiple pre-designed font images with the same font style. In the embodiment of the present application, only the font image corresponding to "he" is used to represent the designated target font image 103. The designated target font image 103 will also include the font image corresponding to "you" with the same font style as the font image corresponding to "he", the font image corresponding to "I" and the font image corresponding to "bao". It should be noted that if the execution subject is not the server 101 but the client, then after obtaining the designated target font migration image 104 corresponding to the text image to be processed, the client will further display the designated target font migration image corresponding to the text image to be processed. If the execution subject is the server 101, and the server 101 is based on the text image to be processed 102 and the designated target font image 103 provided by the client, then after obtaining the designated target font migration image corresponding to the text image to be processed, the server 101 will further provide the designated target font migration image 104 corresponding to the text image to be processed to the client.

[0108] In order to obtain the specified target font migration image corresponding to the to-be-processed text image through the target font migration model, in the application scenario of the processing method for the font migration model provided in this application, it is necessary to first train the target font migration model. For the specific training process, please refer to Figure 1A , which is the first schematic diagram of an application scenario of the processing method for the font migration model provided in this application.

[0109] First, the sample text image and the target font image are input into the current font transfer model to be trained 101A to obtain the target font transfer image corresponding to the sample text image. The current font transfer model to be trained is used to obtain the font transfer image corresponding to the text image according to the text image and the target font image. Then, the target font transfer image and the target font image are input into the text radical attention training model 102A to obtain the text radical block diagram corresponding to the text in the target font transfer image, and obtain the text radical block diagram corresponding to the text in the target font image. Finally, the text radical block diagram corresponding to the text in the target font transfer image and the text radical block diagram corresponding to the text in the target font image are input into the font discrimination module or font discriminator 103A to determine whether the font in the text radical block diagram corresponding to the text in the target font transfer image matches the font in the text radical block diagram corresponding to the text in the target font image. If the font in the text radical block diagram corresponding to the text in the target font transfer image matches the font in the text radical block diagram corresponding to the text in the target font image, the initial font transfer model is used as the target font transfer model.

[0110] In the application scenario of the processing method for the font migration model provided in the present application, whether the font in the text radical cut-block diagram corresponding to the text in the target font migration image matches the font in the text radical cut-block diagram corresponding to the text in the target font image is determined by inputting the text radical cut-block diagram body corresponding to the text in the target font migration image and the text radical cut-block diagram corresponding to the text in the target font image into a font discrimination module or a font discriminator for discrimination. The specific process is: inputting the text radical cut-block diagram body corresponding to the text in the target font migration image and the text radical cut-block diagram corresponding to the text in the target font image into a font discrimination module or a font discriminator to obtain the degree of matching between the font in the text radical cut-block diagram corresponding to the text in the target font migration image and the font in the text radical cut-block diagram corresponding to the text in the target font image.

[0111] If the font in the text radical cut-block diagram corresponding to the text in the target font migration image does not match the font in the text radical cut-block diagram corresponding to the text in the target font image, then adjust the parameters of the current font migration model to be trained to obtain a first font migration model; use the first font migration model as the current font migration model to be trained; input the sample text image and the target font image into the current font migration model to be trained to obtain the first target font migration image corresponding to the sample text image; obtain the text radical cut-block diagram corresponding to the text in the first target font migration image, and obtain the text radical cut-block diagram corresponding to the text in the target font image; if the font in the text radical cut-block diagram corresponding to the text in the first target font migration image matches the font in the text radical cut-block diagram corresponding to the text in the target font image, then use the current font migration model to be trained as the target font migration model. Among them, the process of determining whether the font in the text radical cut-block diagram corresponding to the text in the first target font migration image matches the font in the text radical cut-block diagram corresponding to the text in the target font image is also implemented by a font discrimination module or a font discriminator.

[0112] If the font in the text radical cut-block diagram corresponding to the text in the first target font migration image does not match the font in the text radical cut-block diagram corresponding to the text in the target font image, adjust the parameters of the current font migration model to be trained to obtain a second font migration model, and use the second font migration model as the current font migration model to be trained, and so on, until the target font migration model is obtained. In the application scenario of the processing method for the font migration model provided in the present application, the process of determining the target font migration model is a process of continuously conducting network confrontation between the current font migration model to be trained and the body discrimination module or font discriminator.

[0113] In the application scenario of the processing method for the font migration model provided in the present application, the sample text image is a pre-collected single-character text image, which can specifically be a single synthetic single-character text image synthesized using open source code and a single font; in the application scenario of the processing method for the font migration model provided in the present application, the target font migration image corresponding to the sample text image is an image after the font of the characters in the sample text image is converted into the font of the characters in the target font image through the initial font migration model with the target font image as a reference; the text radical segmentation diagram is an image generated by segmenting the characters in the image according to the radicals of the characters in the image.

[0114] It should be noted that the application scenario embodiment of the above-mentioned processing method for the font migration model provided in the present application is only an embodiment of the application scenario of the processing method for the font migration model provided in the present application. The purpose of providing the above-mentioned application scenario embodiment is to facilitate the understanding of the processing method for the font migration model provided in the present application, and is not used to limit the processing method for the font migration model provided in the present application. The processing method for the font migration model provided in the present application can also be applied to other application scenarios. The processing method for the font migration model provided in the present application does not specifically limit the execution subject. When applying the processing method for the font migration model provided in the present application to other application scenarios, please refer to the application scenario embodiment of the above-mentioned processing method for the font migration model provided in the present application, which will not be repeated here one by one.

[0115] First embodiment

[0116] In the first embodiment of the present application, a processing method for a font migration model is provided. Figure 2-Figure 4 Provide explanation.

[0117] Please refer to Figure 2 , which is a flowchart of a processing method for a font migration model provided in the first embodiment of the present application.

[0118] In step S201, a sample text image and a target font image are input into the current font transfer model to be trained to obtain a target font transfer image corresponding to the sample text image. The current font transfer model to be trained is used to obtain a font transfer image corresponding to the text image based on the text image and the target font image.

[0119] In the first embodiment of the present application, the text is a text with a complex structure based on radicals, such as Chinese, Korean, and Japanese, etc. It can also be a text with a relatively simple text structure such as English and Latin. However, in general, English, Latin, etc. do not need to be transferred through the font transfer model provided in the first embodiment of the present application. In addition, the text can also be a text containing characters of specific shapes, such as inverted triangle characters, square characters, etc.; the sample text image is the image to be transferred to the font, and the sample text image is a pre-collected single-word text image, which can be a single synthetic single-word text image synthesized using open source code and a single font; the target font transfer image corresponding to the sample text image is an image after the font of the text in the sample text image is converted into the font of the text in the target font image by using the current font transfer model to be trained with reference to the target font image. Among them, the target font is the standard of the font transfer result, which is used to indicate the font that the text in the text image to be processed needs to be finally converted into; font migration is to convert the text in the text image to be processed into a specified target font.

[0120] In the first embodiment of the present application, the sample text image and the target font image can be partial images of an image containing the target text, such as a partial image corresponding to the text in a landscape painting. The sample text image and the target font image can be images corresponding to video frames in a video.

[0121] In the first embodiment of the present application, a sample text image and a target font image are input into the current font transfer model to be trained to obtain a target font transfer image corresponding to the sample text image, including: scaling the sample text image and the target font image to a preset size; and obtaining a target font transfer image corresponding to the sample text image based on the sample text image of the preset size and the target font image of the preset size. Scaling the sample text image and the target font image to the preset size is to ensure that the size of each character in the image is relatively stable and to reduce the amount of calculation when performing image processing on the sample text image and the target font image.

[0122] In step S202, a character radical segmentation diagram corresponding to the characters in the target font migration image is obtained, and a character radical segmentation diagram corresponding to the characters in the target font image is obtained.

[0123] In the first embodiment of the present application, the text radical segmentation diagram is an image generated by segmenting the text in the image according to the radicals of the text in the image.

[0124] The process of obtaining a text radical cut-up map corresponding to the text in the target font migration image and obtaining a text radical cut-up map corresponding to the text in the target font image is as follows: inputting the target font migration image and the target font image into a radical attention model, obtaining a text radical cut-up map corresponding to the text in the target font migration image, and obtaining a text radical cut-up map corresponding to the text in the target font image, wherein the radical attention model is used to obtain a text radical heat map corresponding to the text in the font image based on the font image, and obtaining a text radical cut-up map corresponding to the text in the font image based on the text radical heat map corresponding to the text in the font image.

[0125] Since the radical attention model is required when obtaining the text radical block diagram corresponding to the text in the target font migration image and obtaining the text radical block diagram corresponding to the text in the target font image, in the first embodiment of the present application, the radical attention model needs to be obtained first. For details, please refer to Figure 3 , which is a flowchart of a method for obtaining a radical attention model provided in the first embodiment of the present application.

[0126] Step S301: Obtain a target radical segmentation diagram.

[0127] Step S302: for the target radical segmentation diagram, obtain a sample font image and a character radical heat map corresponding to the characters in the sample font image.

[0128] Step S303: Obtain a radical attention model according to the target radical segmentation diagram, the sample font image, and the text radical heat map corresponding to the text in the sample font image.

[0129] In the first embodiment of the present application, the target font migration image and the target font image are input into the radical attention model to obtain the text radical block diagram corresponding to the text in the target font migration image, and the text radical block diagram corresponding to the text in the target font image is obtained. For a detailed process, please refer to Figure 4 , which is a flowchart of a method for obtaining a character radical block diagram provided in the first embodiment of the present application.

[0130] Step S401: scaling the target font migration image and the target font image to a specified size.

[0131] The target font migration image and the target font image are scaled to a specified size, firstly to ensure that the size of each character in the image is relatively stable, and secondly to reduce the amount of calculation when performing image processing on the sample character image and the target font image.

[0132] Step S402: extracting features from the target font migration image of the specified size and the target font image of the specified size to obtain text image features corresponding to the target font migration image and text image features corresponding to the target font image.

[0133] In the first embodiment of the present application, feature extraction is performed on a target font migration image of a specified size and a target font image of a specified size to obtain text image features corresponding to the target font migration image and text image features corresponding to the target font image, including: text outline image feature extraction is performed on a target font migration image of a specified size and a target font image of a specified size to obtain text outline image features corresponding to the target font migration image and text outline image features corresponding to the target font image.

[0134] In the first embodiment of the present application, feature extraction is performed on a target font migration image of a specified size and a target font image of a specified size to obtain text image features corresponding to the target font migration image and text image features corresponding to the target font image, and it also includes: text stroke image feature extraction is performed on a target font migration image of a specified size and a target font image of a specified size to obtain text stroke image features corresponding to the target font migration image and text stroke image features corresponding to the target font image.

[0135] It should be noted that the character stroke image feature extraction for the target font migration image of the specified size and the target font image of the specified size can be performed by the principle of the edge detection operator. The character stroke image feature extraction for the target font migration image of the specified size and the target font image of the specified size is generally to extract the character edge features, connected areas, textures, projections and other character features. Among them, the stroke image feature extraction method is as follows: 1. According to the preset character splitting rule, the target font image is divided into multiple stroke sub-images, and the character splitting rule is used to indicate that the character is split into one or more strokes according to the character structure; 2. From the multiple stroke sub-images, the skeleton map of the stroke components is extracted, and the intersection in the skeleton map is found, and then the trunk curve of the two-dimensional neighborhood midpoint of the intersection in the binary image is calculated to extract the intersection area; 3. The features of the stroke components are extracted, and the features of the stroke components to be extracted are matched with the features of the stroke components in the standard library; 4. The stroke segments are combined according to the matching results to obtain the stroke image features.

[0136] Step S403: obtaining a heat map of text radicals corresponding to the text in the target font migration image and a heat map of text radicals corresponding to the text in the target font image according to the text image features corresponding to the target font migration image and the text image features corresponding to the target font image.

[0137] In the first embodiment of the present application, the steps of obtaining a heat map of text radicals corresponding to the text in the target font migration image and a heat map of text radicals corresponding to the text in the target font image according to the text image features corresponding to the target font migration image and the text image features corresponding to the target font image are as follows: First, average pooling is performed on the text image features corresponding to the target font migration image and the text image features corresponding to the target font image to obtain a one-dimensional text image features corresponding to the target font migration image and a one-dimensional text image features corresponding to the target font image. Then, the one-dimensional text image features corresponding to the target font migration image and the one-dimensional text image features corresponding to the target font image are encoded to obtain contextual encoding features of the text image corresponding to the target font migration image and contextual encoding features of the text image features corresponding to the target font image. Finally, based on the contextual encoding features of the text image corresponding to the target font migration image and the contextual encoding features of the text image features corresponding to the target font image, a heat map of text radicals corresponding to the text in the target font migration image and a heat map of text radicals corresponding to the text in the target font image are obtained.

[0138] It should be noted that the process of obtaining a heat map of text radicals corresponding to the text in the target font transfer image and a heat map of text radicals corresponding to the text in the target font image according to the contextual coding features of the text image corresponding to the target font transfer image and the contextual coding features of the text image features corresponding to the target font image is as follows: First, according to the contextual coding features of the text image corresponding to the target font transfer image and the contextual coding features of the text image features corresponding to the target font image, obtain the probability distribution information corresponding to the text in the target font transfer image and the probability distribution information corresponding to the text in the target font image. Then, according to the probability distribution information corresponding to the text in the target font transfer image and the probability distribution information corresponding to the text in the target font image, obtain a heat map of text radicals corresponding to the text in the target font transfer image and a heat map of text radicals corresponding to the text in the target font image. Specifically, according to a heat map of text radicals corresponding to the text in the target font migration image and a heat map of text radicals corresponding to the text in the target font image, a cut-up map of text radicals corresponding to the text in the target font migration image is obtained, and a cut-up map of text radicals corresponding to the text in the target font image is obtained, including: according to contextual coding features of the text image corresponding to the target font migration image, a heat map of text radicals corresponding to the text in the target font migration image and contextual coding features of text image features corresponding to the target font image, and a heat map of text radicals corresponding to the text in the target font image, a cut-up map of text radicals corresponding to the text in the target font migration image is obtained, and a cut-up map of text radicals corresponding to the text in the target font image is obtained.

[0139] In the first embodiment of the present application, taking the example of obtaining the text radical cut-up map corresponding to the text in the target font migration image, how to obtain the text radical cut-up map is explained. First, the activation value of the text radical heat map is obtained, and an activation value threshold is set according to the activation value of the text radical heat map, such as 0.5; then, according to the activation value of the text radical heat map, the mask corresponding to the text radical heat map is determined. Specifically, the points above the threshold are set to 1, and the points below the threshold are set to 0 as the mask; finally, the minimum circumscribed rectangular frame is obtained for each separated connected domain with a pixel of 1 on the mask, and the rectangular frame is the position of the text radical cut-up map corresponding to the text in the target font migration image.

[0140] Step S404: According to the text radical heat map corresponding to the text in the target font migration image and the text radical heat map corresponding to the text in the target font image, obtain the text radical segmentation map corresponding to the text in the target font migration image, and obtain the text radical segmentation map corresponding to the text in the target font image.

[0141] In the first embodiment of the present application, based on a heat map of text radicals corresponding to the text in the target font migration image and a heat map of text radicals corresponding to the text in the target font image, a cut-up map of text radicals corresponding to the text in the target font migration image is obtained, and a cut-up map of text radicals corresponding to the text in the target font image is obtained, including: based on contextual coding features of the text image corresponding to the target font migration image, a heat map of text radicals corresponding to the text in the target font migration image and contextual coding features of text image features corresponding to the target font image, and a heat map of text radicals corresponding to the text in the target font image, a cut-up map of text radicals corresponding to the text in the target font migration image is obtained, and a cut-up map of text radicals corresponding to the text in the target font image is obtained.

[0142] After obtaining the text radical cut-block diagram corresponding to the text in the target font migration image and the text radical cut-block diagram corresponding to the text in the target font image, it is necessary to first obtain the matching degree between the font in the text radical cut-block diagram corresponding to the text in the target font migration image and the font in the text radical cut-block diagram corresponding to the text in the target font image, and then determine whether the matching degree between the font in the text radical cut-block diagram corresponding to the text in the target font migration image and the font in the text radical cut-block diagram corresponding to the text in the target font image is greater than or equal to the font matching degree threshold, and execute different steps according to the determination result.

[0143] In step S203, if the font in the character radical block diagram corresponding to the characters in the target font migration image matches the font in the character radical block diagram corresponding to the characters in the target font image, the current font migration model to be trained is used as the target font migration model.

[0144] If the font in the text radical cut-block diagram corresponding to the text in the target font migration image matches the font in the text radical cut-block diagram corresponding to the text in the target font image, then the current font migration model to be trained is used as the target font migration model, including: if the matching degree of the font in the text radical cut-block diagram corresponding to the text in the target font migration image and the font in the text radical cut-block diagram corresponding to the text in the target font image is greater than or equal to the font matching degree threshold, then the current font migration model to be trained is used as the target font migration model. Specifically, first, obtain the matching degree of the font in the text radical cut-block diagram corresponding to the text in the target font migration image and the font in the text radical cut-block diagram corresponding to the text in the target font image; then, determine whether the matching degree of the font in the text radical cut-block diagram corresponding to the text in the target font migration image and the font in the text radical cut-block diagram corresponding to the text in the target font image is greater than or equal to the font matching degree threshold; if so, the font in the text radical cut-block diagram corresponding to the text in the target font migration image matches the font in the text radical cut-block diagram corresponding to the text in the target font image.

[0145] It should be noted that in order to ensure that the fonts in the text radical block diagram corresponding to the text in the target font migration image have a high matching degree with the fonts in the text radical block diagram corresponding to the text in the target font image, a discriminant loss function L g To achieve the matching degree training of the font in the text radical block diagram corresponding to the text in the target font migration image and the font in the text radical block diagram corresponding to the text in the target font image: In order to ensure that the matching degree between the font in the text radical block diagram corresponding to the text in the target font migration image and the font in the text radical block diagram corresponding to the text in the target font image is greater than or equal to the font matching degree threshold, an L2 loss function L P To limit the above training process: L P =∑(Ω f -Ω t ) 2 , H i The ith radical in the character radical block diagram, I f is the font data corresponding to the target font image, I t The font data corresponding to the target font migration image, D f is the probability that the matching degree is greater than or equal to the font matching degree threshold, and AE is the autoencoder.

[0146] If the degree of match between the font in the text radical cut-block diagram corresponding to the text in the target font migration image and the font in the text radical cut-block diagram corresponding to the text in the target font image is less than the font matching threshold, then adjust the parameters of the current font migration model to be trained to obtain a first font migration model; and use the first font migration model as the current font migration model to be trained. That is, if the font in the text radical cut-block diagram corresponding to the text in the target font migration image does not match the font in the text radical cut-block diagram corresponding to the text in the target font image, then adjust the parameters of the current font migration model to be trained to obtain a first font migration model, and use the first font migration model as the new current font migration model to be trained. After obtaining the second font migration model, in the first embodiment of the present application, it is also necessary to first input the sample text image and the target font image into the new current font migration model to be trained to obtain the first target font migration image corresponding to the sample text image. Then, obtain the text radical cut-block diagram corresponding to the text in the first target font migration image, and obtain the text radical cut-block diagram corresponding to the text in the target font image. Finally, if the font in the text radical cut-block diagram corresponding to the text in the first target font migration image matches the font in the text radical cut-block diagram corresponding to the text in the target font image, the new current font migration model to be trained is used as the target font migration model; or if the font in the text radical cut-block diagram corresponding to the text in the first target font migration image does not match the font in the text radical cut-block diagram corresponding to the text in the target font image, the parameters of the new current font migration model to be trained are adjusted to obtain a second font migration model, and the second font migration model is used as the current font migration model to be trained, and so on, until the target font migration model is obtained.

[0147] In the first embodiment of the present application, after obtaining the target font migration model, it also includes: after obtaining the text image to be processed and the designated target font image, the text image to be processed and the designated target font image are input into the target font migration model to obtain the designated target font migration image corresponding to the text image to be processed. The designated target font migration image corresponding to the text image to be processed is an image after the font of the text in the text image to be processed is converted into the font of the text in the designated target font image through the target font migration model with reference to the designated target font image, and the font in the text radical block diagram corresponding to the text in the designated target font migration image matches the font in the text radical block diagram corresponding to the text in the designated target font image. Specifically, the text image to be processed and the designated target font image are input into the target font migration model to obtain the designated target font migration image corresponding to the text image to be processed, including: inputting the text image to be processed and the designated target font image into the target font migration model to obtain a text radical cut-up diagram corresponding to the text in the text image to be processed, and obtaining a text radical cut-up diagram corresponding to the text in the designated target font image; obtaining the designated target font migration image corresponding to the text image to be processed based on the text radical cut-up diagram corresponding to the text in the text image to be processed and the text radical cut-up diagram corresponding to the text in the designated target font image.

[0148] It should be noted that the above steps need to rely on the execution subject. Figure 1 Generally, it is a server, but it can also be a client with relevant font migration applications installed, such as a smartphone, tablet computer, and PC with relevant font migration applications installed. If the execution subject is not the server, but the client, then after obtaining the designated target font migration image corresponding to the text image to be processed, the client will further display the designated target font migration image corresponding to the text image to be processed. If the execution subject is the server, and the server is based on the text image to be processed and the designated target font image provided by the client, then, after obtaining the designated target font migration image corresponding to the text image to be processed, the server will further provide the designated target font migration image corresponding to the text image to be processed to the client.

[0149] The first embodiment of the present application provides a processing method for a font migration model. First, a sample text image and a target font image are input into the current font migration model to be trained to obtain a target font migration image corresponding to the sample text image; then, a text radical cut-up diagram corresponding to the text in the target font migration image is obtained, and a text radical cut-up diagram corresponding to the text in the target font image is obtained; finally, if the font in the text radical cut-up diagram corresponding to the text in the target font migration image matches the font in the text radical cut-up diagram corresponding to the text in the target font image, the current font migration model to be trained is used as the target font migration model. The processing method for a font migration model provided in the first embodiment of the present application enables the target font migration model to explicitly cut out the text radical cut-up diagram for processing, so as to better perform font migration on the radical of the text image to be processed based on the text radical, thereby improving the font migration effect of the target font text image.

[0150] Second embodiment

[0151] Corresponding to the processing method for the font migration model provided in the first embodiment of the present application, the second embodiment of the present application provides a processing device for the font migration model. Since the device embodiment is basically similar to the first method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described below is only illustrative.

[0152] Please refer to Figure 5 , which is a schematic diagram of a processing device for a font migration model provided in the second embodiment of the present application.

[0153] The processing device for the font migration model includes:

[0154] The target font migration image obtaining unit 501 is used to input the sample text image and the target font image into the current font migration model to be trained, and obtain the target font migration image corresponding to the sample text image. The current font migration model to be trained is used to obtain the font migration image corresponding to the text image according to the text image and the target font image.

[0155] The character radical block diagram obtaining unit 502 is used to obtain the character radical block diagram corresponding to the character in the target font migration image, and obtain the character radical block diagram corresponding to the character in the target font image;

[0156] The target font migration model obtaining unit 503 is used to use the current font migration model to be trained as the target font migration model if the font in the character radical block diagram corresponding to the characters in the target font migration image matches the font in the character radical block diagram corresponding to the characters in the target font image.

[0157] Optionally, the processing device for the font migration model provided in the second embodiment of the present application further includes:

[0158] a first font migration model obtaining unit, configured to adjust the parameters of the current font migration model to be trained to obtain a first font migration model if the font in the character radical block diagram corresponding to the character in the target font migration image does not match the font in the character radical block diagram corresponding to the character in the target font image;

[0159] Using the first font migration model as the current font migration model to be trained;

[0160] A first target font migration image obtaining unit, configured to input a sample text image and the target font image into the current to-be-trained font migration model, and obtain a first target font migration image corresponding to the sample text image;

[0161] A first character radical block diagram obtaining unit, used to obtain a character radical block diagram corresponding to the characters in the first target font migration image, and obtain a character radical block diagram corresponding to the characters in the target font image;

[0162] The second target font migration model obtaining unit is used to use the current font migration model to be trained as the target font migration model if the font in the character radical cutting diagram corresponding to the characters in the first target font migration image matches the font in the character radical cutting diagram corresponding to the characters in the target font image.

[0163] Optionally, the processing device for the font migration model provided in the second embodiment of the present application further includes: a third target font migration model acquisition unit, which is used to adjust the parameters of the current font migration model to be trained if the font in the text radical cut-block diagram corresponding to the text in the second target font migration image does not match the font in the text radical cut-block diagram corresponding to the text in the target font image, obtain the second font migration model, use the second font migration model as the current font migration model to be trained, and so on, until the target font migration model is obtained.

[0164] Optionally, the text radical cutting map obtaining unit 502 is specifically used to input the target font migration image and the target font image into the radical attention model, obtain the text radical cutting map corresponding to the text in the target font migration image, and obtain the text radical cutting map corresponding to the text in the target font image. The radical attention model is used to obtain a text radical heat map corresponding to the text in the font image based on the font image, and obtain a text radical cutting map corresponding to the text in the font image based on the text radical heat map corresponding to the text in the font image.

[0165] Optionally, the processing device for the font migration model provided in the second embodiment of the present application further includes:

[0166] A target radical block diagram obtaining unit, used for obtaining a target radical block diagram;

[0167] A third character radical heat map obtaining unit is used to obtain a sample font image and a character radical heat map corresponding to the characters in the sample font image according to the target radical segmentation map;

[0168] The radical attention model obtaining unit is used to obtain the radical attention model according to the target radical block diagram, the sample font image and the character radical heat map corresponding to the characters in the sample font image.

[0169] Optionally, the step of inputting the target font migration image and the target font image into a radical attention model, obtaining a text radical block diagram corresponding to the text in the target font migration image, and obtaining a text radical block diagram corresponding to the text in the target font image, comprises:

[0170] scaling the target font migration image and the target font image to a specified size;

[0171] Performing feature extraction on the target font migration image of the specified size and the target font image of the specified size to obtain text image features corresponding to the target font migration image and text image features corresponding to the target font image;

[0172] Obtaining a heat map of character radicals corresponding to the characters in the target font migration image and a heat map of character radicals corresponding to the characters in the target font image according to the character image features corresponding to the target font migration image and the character image features corresponding to the target font image;

[0173] According to the text radical heat map corresponding to the text in the target font migration image and the text radical heat map corresponding to the text in the target font image, a text radical cut-out map corresponding to the text in the target font migration image is obtained, and a text radical cut-out map corresponding to the text in the target font image is obtained.

[0174] Optionally, the performing feature extraction on the target font migration image of the specified size and the target font image of the specified size to obtain text image features corresponding to the target font migration image and text image features corresponding to the target font image includes: performing text outline image feature extraction on the target font migration image of the specified size and the target font image of the specified size to obtain text outline image features corresponding to the target font migration image and text outline image features corresponding to the target font image.

[0175] Optionally, the performing feature extraction on the target font migration image of the specified size and the target font image of the specified size to obtain text image features corresponding to the target font migration image and text image features corresponding to the target font image includes: performing text stroke image feature extraction on the target font migration image of the specified size and the target font image of the specified size to obtain text stroke image features corresponding to the target font migration image and text stroke image features corresponding to the target font image.

[0176] Optionally, obtaining a heat map of text radicals corresponding to the text in the target font migration image and a heat map of text radicals corresponding to the text in the target font image according to the text image features corresponding to the target font migration image and the text image features corresponding to the target font image includes:

[0177] Performing average pooling on the text image features corresponding to the target font migration image and the text image features corresponding to the target font image to obtain one-dimensional text image features corresponding to the target font migration image and one-dimensional text image features corresponding to the target font image;

[0178] Encoding the one-dimensional text image features corresponding to the target font migration image and the one-dimensional text image features corresponding to the target font image to obtain contextual coding features of the text image corresponding to the target font migration image and contextual coding features of the text image features corresponding to the target font image;

[0179] According to the contextual coding features of the text image corresponding to the target font migration image and the contextual coding features of the text image features corresponding to the target font image, a text radical heat map corresponding to the text in the target font migration image and a text radical heat map corresponding to the text in the target font image are obtained.

[0180] Optionally, obtaining a heat map of text radicals corresponding to the text in the target font migration image and a heat map of text radicals corresponding to the text in the target font image according to the contextual coding features of the text image corresponding to the target font migration image and the contextual coding features of the text image features corresponding to the target font image, comprises:

[0181] Obtaining probability distribution information corresponding to the characters in the target font migration image and probability distribution information corresponding to the characters in the target font image according to context coding features of the character image corresponding to the target font migration image and context coding features of the character image features corresponding to the target font image;

[0182] According to the probability distribution information corresponding to the characters in the target font migration image and the probability distribution information corresponding to the characters in the target font image, a heat map of character radicals corresponding to the characters in the target font migration image and a heat map of character radicals corresponding to the characters in the target font image are obtained.

[0183] Optionally, the method of obtaining a cut-up map of text radicals corresponding to the text in the target font migration image and a cut-up map of text radicals corresponding to the text in the target font image based on a heat map of text radicals corresponding to the text in the target font migration image and a heat map of text radicals corresponding to the text in the target font image comprises: obtaining a cut-up map of text radicals corresponding to the text in the target font migration image and a cut-up map of text radicals corresponding to the text in the target font image based on contextual coding features of the text image corresponding to the target font migration image, a heat map of text radicals corresponding to the text in the target font migration image and contextual coding features of text image features corresponding to the target font image and a heat map of text radicals corresponding to the text in the target font image, and obtaining a cut-up map of text radicals corresponding to the text in the target font image.

[0184] Optionally, the target font migration model obtaining unit 503 is specifically used to use the current font migration model to be trained as the target font migration model if the degree of matching between the font in the text radical cutting diagram corresponding to the text in the target font migration image and the font in the text radical cutting diagram corresponding to the text in the target font image is greater than or equal to a font matching threshold.

[0185] Optionally, if the font in the text radical cut-block diagram corresponding to the text in the target font migration image does not match the font in the text radical cut-block diagram corresponding to the text in the target font image, then the parameters of the current font migration model to be trained are adjusted to obtain a first font migration model, including: if the font in the text radical cut-block diagram corresponding to the text in the target font migration image and the font in the text radical cut-block diagram corresponding to the text in the target font image have a matching degree less than the font matching degree threshold, then the parameters of the current font migration model to be trained are adjusted to obtain a first font migration model.

[0186] Optionally, it also includes: obtaining the matching degree between the font in the character radical cutting block diagram corresponding to the characters in the target font migration image and the font in the character radical cutting block diagram corresponding to the characters in the target font image.

[0187] Optionally, the target font migration image obtaining unit 501 is specifically used to scale the sample text image and the target font image to a preset size; and obtain a target font migration image corresponding to the sample text image based on the sample text image of the preset size and the target font image of the preset size.

[0188] In the second embodiment of the present application, a processing device for a font migration model is provided. First, a sample text image and a target font image are input into the current font migration model to be trained to obtain a target font migration image corresponding to the sample text image; then, a text radical cut-up diagram corresponding to the text in the target font migration image is obtained, and a text radical cut-up diagram corresponding to the text in the target font image is obtained; finally, if the font in the text radical cut-up diagram corresponding to the text in the target font migration image matches the font in the text radical cut-up diagram corresponding to the text in the target font image, the current font migration model to be trained is used as the target font migration model. The processing device for a font migration model provided in the second embodiment of the present application enables the target font migration model to explicitly cut out the text radical cut-up diagram for processing, so as to better perform font migration on the radical of the text image to be processed based on the text radical, thereby improving the font migration effect of the target font text image.

[0189] Third embodiment

[0190] Corresponding to the information method provided in the first embodiment of the present application, the third embodiment of the present application provides an electronic device.

[0191] like Figure 6 As shown, Figure 6 A schematic diagram of an electronic device provided in an embodiment of the present application.

[0192] The electronic device includes:

[0193] Processor 601; and

[0194] The memory 602 is used to store a program for a processing method for a font migration model. After the device is powered on and the processor runs the program for the processing method for a font migration model, the following steps are performed:

[0195] A program for storing a processing method for a font migration model. After the device is powered on and the processor runs the program for the processing method for the font migration model, the following steps are performed:

[0196] Inputting a sample text image and a target font image into a current font transfer model to be trained to obtain a target font transfer image corresponding to the sample text image, wherein the current font transfer model to be trained is used to obtain a font transfer image corresponding to the text image based on the text image and the target font image;

[0197] Obtaining a text radical block diagram corresponding to the text in the target font migration image, and obtaining a text radical block diagram corresponding to the text in the target font image;

[0198] If the font in the character radical block diagram corresponding to the characters in the target font migration image matches the font in the character radical block diagram corresponding to the characters in the target font image, the current font migration model to be trained is used as the target font migration model.

[0199] It should be noted that, for the detailed description of the processing method for the font migration model performed by the electronic device provided in the third embodiment of the present application, reference can be made to the relevant description of the first embodiment of the present application, which will not be repeated here.

[0200] Fourth embodiment

[0201] Corresponding to the processing method for the font migration model provided in the first embodiment of the present application, the fourth embodiment of the present application provides a storage medium storing a program for the processing method for the font migration model, the program is executed by a processor to perform the following steps:

[0202] A program for storing a processing method for a font migration model. After the device is powered on and the processor runs the program for the processing method for the font migration model, the following steps are performed:

[0203] Inputting a sample text image and a target font image into a current font transfer model to be trained to obtain a target font transfer image corresponding to the sample text image, wherein the current font transfer model to be trained is used to obtain a font transfer image corresponding to the text image based on the text image and the target font image;

[0204] Obtaining a text radical block diagram corresponding to the text in the target font migration image, and obtaining a text radical block diagram corresponding to the text in the target font image;

[0205] If the font in the character radical block diagram corresponding to the characters in the target font migration image matches the font in the character radical block diagram corresponding to the characters in the target font image, the current font migration model to be trained is used as the target font migration model.

[0206] It should be noted that for the detailed description of the storage medium provided in the fourth embodiment of the present application, reference can be made to the relevant description of the first embodiment of the present application, and will not be repeated here.

[0207] Fifth embodiment

[0208] Corresponding to the processing method for the font migration model provided in the first embodiment of the present application, the fifth embodiment of the present application provides a font migration method. Since the relevant content in the fifth embodiment of the present application is similar to the relevant content in the first embodiment of the method, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The method embodiment described below is only illustrative.

[0209] Please refer to Figure 7 , which is a flowchart of a font migration method provided in the fifth embodiment of the present application.

[0210] In step S701, a text image to be processed and a target font image are obtained.

[0211] In the fifth embodiment of the present application, the text image to be processed is an image that needs to be font migrated, and the target font image is a font image that provides a font reference for the text image to be processed. The target font image is generally pre-generated and stored in a designated library, containing multiple different font images with the same font style, and the text in the target font image can be split into all or part of the predetermined radicals that constitute the text.

[0212] In the fifth embodiment of the present application, after obtaining the text image to be processed and the target font image, it is generally necessary to first scale the text image to be processed and the target font image to a preset size.

[0213] In step S702, the text image to be processed and the target font image are input into the radical segmentation unit of the target font migration model, and the text radical segmentation diagram corresponding to the text in the text image to be processed and the text radical segmentation diagram corresponding to the text in the target font image are output.

[0214] In the fifth embodiment of the present application, the target font migration model is used to obtain a font migration image corresponding to a text image based on a text image and a target font image; the radical cutting unit of the target font migration model is a unit in the target font migration model that is used to cut text images into text radicals.

[0215] In the fifth embodiment of the present application, taking the process of outputting the text radical block diagram corresponding to the text in the target font image as an example, the process of inputting the to-be-processed text image and the target font image into the radical block unit of the target font migration model, outputting the text radical block diagram corresponding to the text in the to-be-processed text image, and outputting the text radical block diagram corresponding to the text in the target font image is described. The specific process is as follows:

[0216] First, the text image features corresponding to the target font image are extracted. Specifically, it includes the extraction of the text image stroke features corresponding to the target font image and the extraction of the text image contour features corresponding to the target font image. Among them, the process of extracting the text image stroke features corresponding to the target font image is as follows: first, according to the preset text splitting rule, the target font image is divided into multiple stroke sub-images, and the text splitting rule is used to indicate the rule for splitting the text into one or more strokes according to the text structure; secondly, in the multiple stroke sub-images, the skeleton diagram of the stroke components is extracted, and the intersection in the skeleton diagram is found, and then the trunk curve of the two-dimensional neighborhood midpoint of the intersection in the binary image is calculated to extract the intersection area; thirdly, the features of the stroke components are extracted, and the features of the stroke components to be extracted are matched with the features of the stroke components in the standard library; finally, the stroke segments are combined according to the matching results to obtain the stroke image features.

[0217] Second, based on the text image features corresponding to the target font migration image, obtain the text radical heat map corresponding to the text in the target font image. First, average pool the text image features corresponding to the target font image to obtain the one-dimensional text image features corresponding to the target font image; then, encode the one-dimensional text image features corresponding to the target font image to obtain the context encoding features of the text image features corresponding to the target font image; finally, based on the context encoding features of the text image features corresponding to the target font image, obtain the text radical heat map corresponding to the text in the target font image.

[0218] Third, according to the text radical heat map corresponding to the text in the target font image, the text radical segmentation map corresponding to the text in the target font image is obtained. The specific process is: according to the context encoding features of the text image features corresponding to the target font image and the text radical heat map corresponding to the text in the target font image, the text radical segmentation map corresponding to the text in the target font image is obtained.

[0219] In step S703, the text radical segmentation diagram corresponding to the text in the text image to be processed and the text radical segmentation diagram corresponding to the text in the target font image are input into the font migration unit of the target font migration model, and the target radical font migration image of the text radical corresponding to the text in the text image to be processed is obtained through font migration.

[0220] In the fifth embodiment of the present application, the font migration unit of the target font migration model is a unit in the target font migration model, which is used to obtain a target font migration image based on a text radical cutting diagram corresponding to the text in the text image to be processed and a text radical cutting diagram corresponding to the text in the target font image; the font in the target radical font migration image is matched with the font in the text radical cutting diagram corresponding to the text in the target font image.

[0221] In the fifth embodiment of the present application, the process of obtaining a target radical font migration image of the text radical corresponding to the text in the text image to be processed through font migration is: according to the text radical corresponding to the text in the text image to be processed, a text radical cut-out map that is the same as the text radical corresponding to the text in the text image to be processed is obtained in the text radical cut-out map corresponding to the text in the target font image as the target radical font migration image.

[0222] In step S704, the target font radical migration images are assembled to obtain the target font migration image.

[0223] After obtaining the target font radical migration image, it is necessary to assemble the target font radical migration image with reference to the text structure corresponding to the text in the to-be-processed text image, and obtain the target font migration image. That is, the text radical segmentation diagram corresponding to the text in the target font image is replaced with the text radical segmentation diagram obtained from the text radical segmentation diagram corresponding to the text in the target font image, which is the same as the text radical corresponding to the text in the to-be-processed text image.

[0224] The font migration method provided in the fifth embodiment of the present application can segment the text radical block diagram for processing, so as to better perform font migration on the radicals of the text image to be processed based on the text radicals, thereby improving the font migration effect of the target font text image.

[0225] Sixth embodiment

[0226] Corresponding to the font migration method provided in the fifth embodiment of the present application, the sixth embodiment of the present application provides a font migration device. Since the device embodiment is basically similar to the fifth method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described below is only illustrative.

[0227] Please refer to Figure 8, which is a schematic diagram of a font migration device provided in the sixth embodiment of the present application.

[0228] The font migration device comprises:

[0229] An image acquisition unit 801 is used to obtain a text image to be processed and a target font image;

[0230] The character radical block diagram obtaining unit 802 is used to input the character image to be processed and the target font image into the radical block diagram of the target font migration model, output the character radical block diagram corresponding to the character in the character image to be processed, and output the character radical block diagram corresponding to the character in the target font image;

[0231] The radical font migration image obtaining unit 803 is used to input the text radical block diagram corresponding to the text in the to-be-processed text image and the text radical block diagram corresponding to the text in the target font image into the font migration unit of the target font migration model, and obtain the target radical font migration image of the text radical corresponding to the text in the to-be-processed text image through font migration, wherein the font in the target radical font migration image matches the font in the text radical block diagram corresponding to the text in the target font image;

[0232] The target font migration image obtaining unit 804 is used to assemble the target font radical migration images to obtain a target font migration image.

[0233] Optionally, the font migration device provided in the sixth embodiment of the present application further includes: an image display unit, used to display the target font migration image.

[0234] Optionally, the image obtaining unit 801 is specifically configured to obtain the to-be-processed text image and the target font image provided by the client.

[0235] Optionally, the method further includes: providing a designated target font migration image corresponding to the text image to be processed to the client.

[0236] Seventh embodiment

[0237] Corresponding to the information method provided in the fifth embodiment of the present application, the seventh embodiment of the present application provides an electronic device.

[0238] Please refer to Figure 6 , the electronic device comprises:

[0239] Processor 601; and

[0240] The memory 602 is used to store a program for the font migration method. After the device is powered on and the program for the font migration method is run by the processor, the following steps are performed:

[0241] A program for storing a font migration method is used. After the device is powered on and the program of the font migration method is run by the processor, the following steps are performed:

[0242] Obtain the text image to be processed and the target font image;

[0243] Inputting the to-be-processed text image and the target font image into a radical segmentation unit of a target font migration model, outputting a text radical segmentation diagram corresponding to the text in the to-be-processed text image, and outputting a text radical segmentation diagram corresponding to the text in the target font image, wherein the target font migration model is used to obtain a font migration image corresponding to the text image according to the text image and the target font image;

[0244] The character radical block diagram corresponding to the characters in the character image to be processed and the character radical block diagram corresponding to the characters in the target font image are input into the font migration unit of the target font migration model, and the target font migration image corresponding to the character image to be processed is output.

[0245] It should be noted that, for the detailed description of the font migration method performed by the electronic device provided in the seventh embodiment of the present application, reference can be made to the relevant description of the fifth embodiment of the present application, which will not be repeated here.

[0246] Eighth embodiment

[0247] Corresponding to the font migration method provided in the fifth embodiment of the present application, the eighth embodiment of the present application provides a storage medium storing a program of the font migration method, the program is executed by a processor to perform the following steps:

[0248] A program for storing a font migration method is used. After the device is powered on and the program of the font migration method is run by the processor, the following steps are performed:

[0249] Obtain the text image to be processed and the target font image;

[0250] Inputting the to-be-processed text image and the target font image into a radical segmentation unit of a target font migration model, outputting a text radical segmentation diagram corresponding to the text in the to-be-processed text image, and outputting a text radical segmentation diagram corresponding to the text in the target font image, wherein the target font migration model is used to obtain a font migration image corresponding to the text image according to the text image and the target font image;

[0251] The character radical block diagram corresponding to the characters in the character image to be processed and the character radical block diagram corresponding to the characters in the target font image are input into the font migration unit of the target font migration model, and the target font migration image corresponding to the character image to be processed is output.

[0252] It should be noted that for the detailed description of the storage medium provided in the eighth embodiment of the present application, reference can be made to the relevant description of the fifth embodiment of the present application, and will not be repeated here.

[0253] Ninth embodiment

[0254] Corresponding to the processing method for the font migration model provided in the first embodiment of the present application, the ninth embodiment of the present application provides another processing method for the font migration model. Since the relevant content in the ninth embodiment of the present application is similar to the relevant content in the first embodiment of the method, the description is relatively simple, and the relevant parts can be referred to the partial description of the first method embodiment. The device embodiment described below is merely illustrative.

[0255] First, the sample text image and the target font image are input into the current font transfer model to be trained to obtain the target font transfer image corresponding to the sample text image. The current font transfer model to be trained is used to obtain the font transfer image corresponding to the text image according to the text image and the target font image. Then, the target font transfer image and the target font image are input into the text letter attention training model to obtain the text letter cut-out diagram corresponding to the text in the target font transfer image, and obtain the text letter cut-out diagram corresponding to the text in the target font image. For example, the text letter cut-out diagram corresponding to the English word "hello" is the letter cut-out diagram corresponding to the five English letters "h", "e", "l", "l", and "o". Finally, the text letter cut-out diagram corresponding to the text in the target font migration image and the text letter cut-out diagram corresponding to the text in the target font image are input into a font discrimination module or a font discriminator to determine whether the font in the text letter cut-out diagram corresponding to the text in the target font migration image matches the font in the text letter cut-out diagram corresponding to the text in the target font image; if the font in the text letter cut-out diagram corresponding to the text in the target font migration image matches the font in the text letter cut-out diagram corresponding to the text in the target font image, the initial font migration model is used as the target font migration model.

[0256] In the ninth embodiment of the present application, the text generally has a simple text structure and is composed of English, Latin letters, etc. In addition, the text in the ninth embodiment of the present application may also refer to text including Arabic numerals.

[0257] Tenth embodiment

[0258] Corresponding to the font migration method provided in the fifth embodiment of the present application, the tenth embodiment of the present application provides another font migration method. Since the relevant content in the tenth embodiment of the present application is similar to the relevant content in the fifth embodiment of the method, the description is relatively simple, and the relevant parts can refer to the partial description of the fifth method embodiment. The method embodiment described below is only illustrative.

[0259] The font migration process corresponding to the font migration method provided in the tenth embodiment of the present application is as follows:

[0260] First, obtain the text image to be processed and the target font image.

[0261] In the tenth embodiment of the present application, the to-be-processed text image is an image that needs to be subjected to font migration, and the target font image is a font image that provides a font reference for the to-be-processed text image. The target font image is generally pre-generated and stored in a designated library, and contains multiple different font images with the same font style, and the text in the target font image can be split into all or part of the predetermined letters that constitute the text.

[0262] In the tenth embodiment of the present application, after obtaining the to-be-processed text image and the target font image, it is generally necessary to first scale the to-be-processed text image and the target font image to a preset size.

[0263] Secondly, the text image to be processed and the target font image are input into the letter segmentation unit of the target font migration model, and the text letter segmentation map corresponding to the text in the text image to be processed is output, and the text letter segmentation map corresponding to the text in the target font image is output.

[0264] In the tenth embodiment of the present application, the target font migration model is used to obtain a font migration image corresponding to a text image based on a text image and a target font image; the letter cutting unit of the target font migration model is a unit in the target font migration model that is used to cut text letters into pieces in the text image.

[0265] In the tenth embodiment of the present application, taking the process of outputting the text letter block diagram corresponding to the text in the target font image as an example, the process of inputting the to-be-processed text image and the target font image into the letter block unit of the target font migration model, outputting the text letter block diagram corresponding to the text in the to-be-processed text image, and outputting the text letter block diagram corresponding to the text in the target font image is described. The specific process is as follows:

[0266] First, extract the image features corresponding to the target font image. First, obtain the shape image features corresponding to the target font image; then, according to the preset letter shape image features, match the preset letter shape image features with the shape image features corresponding to the target font image; finally, determine the letter image corresponding to the target font image according to the matching degree between the preset letter shape image features and the shape image features corresponding to the target font image, and extract the letter image features corresponding to the target font image.

[0267] Second, based on the text image features corresponding to the target font migration image, obtain the text letter heat map corresponding to the text in the target font image. First, average pool the text image features corresponding to the target font image to obtain the one-dimensional text image features corresponding to the target font image; then, encode the one-dimensional text image features corresponding to the target font image to obtain the context encoding features of the text image features corresponding to the target font image; finally, based on the context encoding features of the text image features corresponding to the target font image, obtain the text letter heat map corresponding to the text in the target font image.

[0268] Third, according to the heat map of the text letters corresponding to the text in the target font image, the text letter cut-out map corresponding to the text in the target font image is obtained. The specific process is: according to the context encoding features of the text image features corresponding to the target font image and the heat map of the text letters corresponding to the text in the target font image, the text letter cut-out map corresponding to the text in the target font image is obtained.

[0269] Again, the text letter block diagram corresponding to the text in the text image to be processed and the text letter block diagram corresponding to the text in the target font image are input into the font migration unit of the target font migration model, and the target letter font migration image of the text letters corresponding to the text in the text image to be processed is obtained through font migration.

[0270] In the tenth embodiment of the present application, the font migration unit of the target font migration model is a unit in the target font migration model, which is used to obtain a target font migration image based on a text letter cut-out diagram corresponding to the text in the text image to be processed and a text letter cut-out diagram corresponding to the text in the target font image; the font in the target letter font migration image is matched with the font in the text letter cut-out diagram corresponding to the text in the target font image.

[0271] In the tenth embodiment of the present application, the process of obtaining a target letter font migration image of text letters corresponding to the text in the text image to be processed through font migration is: according to the text letters corresponding to the text in the text image to be processed, a text letter cut-out diagram corresponding to the text in the target font image is obtained, which is the same as the text letter corresponding to the text in the text image to be processed, as the target letter font migration image.

[0272] Finally, the target font letter migration images are assembled to obtain the target font migration image.

[0273] After obtaining the target font letter migration image, it is necessary to assemble the target font letter migration image with reference to the text structure corresponding to the text in the to-be-processed text image, so as to obtain the target font migration image. That is, the text letter block diagram corresponding to the text in the target font image is replaced with the text letter block diagram obtained from the text letter block diagram corresponding to the text in the target font image, which is the same as the text letter corresponding to the text in the to-be-processed text image.

[0274] The font migration method provided in the tenth embodiment of the present application can segment the text letter block diagram for processing, so as to better migrate the fonts of the letters based on the text letters for the text image to be processed, thereby improving the font migration effect of the target font text image. Although the present application is disclosed as above with the preferred embodiments, it is not intended to limit the present application. Any person skilled in the art may make possible changes and modifications without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims of the present application.

[0275] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0276] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0277] 1. Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer-readable media does not include non-transitory media such as modulated data signals and carrier waves.

[0278] 2. Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

Claims

1. A processing method for a font migration model, characterized in that: include: Inputting a sample text image and a target font image into a current font transfer model to be trained to obtain a target font transfer image corresponding to the sample text image, wherein the current font transfer model to be trained is used to obtain a font transfer image corresponding to the text image based on the text image and the target font image; Inputting the target font migration image and the target font image into the radical attention model, obtaining a text radical block diagram corresponding to the text in the target font migration image, and obtaining a text radical block diagram corresponding to the text in the target font image, wherein the radical attention model is used to obtain a text radical heat map corresponding to the text in the font image according to the font image, and obtain a text radical block diagram corresponding to the text in the font image according to the text radical heat map corresponding to the text in the font image; If the font in the character radical block diagram corresponding to the character in the target font migration image matches the font in the character radical block diagram corresponding to the character in the target font image, then the current font migration model to be trained is used as the target font migration model; If the font in the text radical block diagram corresponding to the text in the target font migration image does not match the font in the text radical block diagram corresponding to the text in the target font image, the parameters of the current font migration model to be trained are iteratively adjusted until the target font migration model is obtained.

2. The processing method for the font migration model according to claim 1, characterized in that: Also includes: If the font in the character radical block diagram corresponding to the character in the target font migration image does not match the font in the character radical block diagram corresponding to the character in the target font image, adjusting the parameters of the current font migration model to be trained to obtain a first font migration model; Using the first font migration model as the current font migration model to be trained; Inputting the sample text image and the target font image into the current to-be-trained font migration model to obtain a first target font migration image corresponding to the sample text image; Obtaining a character radical block diagram corresponding to the characters in the first target font migration image, and obtaining a character radical block diagram corresponding to the characters in the target font image; If the font in the character radical block diagram corresponding to the characters in the first target font migration image matches the font in the character radical block diagram corresponding to the characters in the target font image, the current font migration model to be trained is used as the target font migration model.

3. The processing method for the font migration model according to claim 2, characterized in that: Also includes: If the font in the text radical cut-block diagram corresponding to the text in the first target font migration image does not match the font in the text radical cut-block diagram corresponding to the text in the target font image, adjust the parameters of the current font migration model to be trained to obtain a second font migration model, and use the second font migration model as the current font migration model to be trained, and so on, until the target font migration model is obtained.

4. The processing method for font migration model according to claim 1, characterized in that: Also includes: Get the target radical segmentation diagram; For the target radical segmentation diagram, a sample font image and a character radical heat map corresponding to the characters in the sample font image are obtained; The radical attention model is obtained according to the target radical segmentation diagram, the sample font image, and a character radical heat map corresponding to the characters in the sample font image.

5. The processing method for the font migration model according to claim 1, characterized in that: The step of inputting the target font migration image and the target font image into a radical attention model, obtaining a text radical block diagram corresponding to the text in the target font migration image, and obtaining a text radical block diagram corresponding to the text in the target font image, comprises: scaling the target font migration image and the target font image to a specified size; Performing feature extraction on the target font migration image of the specified size and the target font image of the specified size to obtain text image features corresponding to the target font migration image and text image features corresponding to the target font image; Obtaining a heat map of character radicals corresponding to the characters in the target font migration image and a heat map of character radicals corresponding to the characters in the target font image according to the character image features corresponding to the target font migration image and the character image features corresponding to the target font image; According to the text radical heat map corresponding to the text in the target font migration image and the text radical heat map corresponding to the text in the target font image, a text radical cut-out map corresponding to the text in the target font migration image is obtained, and a text radical cut-out map corresponding to the text in the target font image is obtained.

6. The processing method for the font migration model according to claim 5, characterized in that: The performing feature extraction on the target font migration image of the specified size and the target font image of the specified size to obtain text image features corresponding to the target font migration image and text image features corresponding to the target font image includes: performing text outline image feature extraction on the target font migration image of the specified size and the target font image of the specified size to obtain text outline image features corresponding to the target font migration image and text outline image features corresponding to the target font image.

7. The processing method for the font migration model according to claim 5, characterized in that: The step of performing feature extraction on the target font migration image of the specified size and the target font image of the specified size to obtain text image features corresponding to the target font migration image and text image features corresponding to the target font image includes: performing text stroke image feature extraction on the target font migration image of the specified size and the target font image of the specified size to obtain text stroke image features corresponding to the target font migration image and text stroke image features corresponding to the target font image.

8. The processing method for the font migration model according to claim 5, characterized in that: The step of obtaining a heat map of text radicals corresponding to the text in the target font migration image and a heat map of text radicals corresponding to the text in the target font image according to the text image features corresponding to the target font migration image and the text image features corresponding to the target font image comprises: Performing average pooling on the text image features corresponding to the target font migration image and the text image features corresponding to the target font image to obtain one-dimensional text image features corresponding to the target font migration image and one-dimensional text image features corresponding to the target font image; Encoding the one-dimensional text image features corresponding to the target font migration image and the one-dimensional text image features corresponding to the target font image to obtain contextual coding features of the text image corresponding to the target font migration image and contextual coding features of the text image features corresponding to the target font image; According to the contextual coding features of the text image corresponding to the target font migration image and the contextual coding features of the text image features corresponding to the target font image, a text radical heat map corresponding to the text in the target font migration image and a text radical heat map corresponding to the text in the target font image are obtained.

9. The processing method for the font migration model according to claim 8, characterized in that: The step of obtaining a heat map of text radicals corresponding to the text in the target font migration image and a heat map of text radicals corresponding to the text in the target font image according to the contextual coding features of the text image corresponding to the target font migration image and the contextual coding features of the text image features corresponding to the target font image comprises: Obtaining probability distribution information corresponding to the characters in the target font migration image and probability distribution information corresponding to the characters in the target font image according to context coding features of the character image corresponding to the target font migration image and context coding features of the character image features corresponding to the target font image; According to the probability distribution information corresponding to the characters in the target font migration image and the probability distribution information corresponding to the characters in the target font image, a heat map of character radicals corresponding to the characters in the target font migration image and a heat map of character radicals corresponding to the characters in the target font image are obtained.

10. The processing method for font migration model according to claim 9, characterized in that: The method of obtaining a text radical cut-out diagram corresponding to the text in the target font migration image and a text radical cut-out diagram corresponding to the text in the target font image based on a text radical heat map corresponding to the text in the target font migration image and a text radical heat map corresponding to the text in the target font image comprises: obtaining a text radical cut-out diagram corresponding to the text in the target font migration image and a text radical cut-out diagram corresponding to the text in the target font image based on contextual coding features of the text image corresponding to the target font migration image, a text radical heat map corresponding to the text in the target font migration image and contextual coding features of text image features corresponding to the target font image and a text radical heat map corresponding to the text in the target font image.

11. The processing method for font migration model according to claim 1, characterized in that: If the font in the text radical cut-block diagram corresponding to the text in the target font migration image matches the font in the text radical cut-block diagram corresponding to the text in the target font image, then the current font migration model to be trained is used as the target font migration model, including: if the font in the text radical cut-block diagram corresponding to the text in the target font migration image matches the font in the text radical cut-block diagram corresponding to the text in the target font image, the matching degree is greater than or equal to the font matching degree threshold, then the current font migration model to be trained is used as the target font migration model.

12. The processing method for font migration model according to claim 2, characterized in that: If the font in the text radical cut-block diagram corresponding to the text in the target font migration image does not match the font in the text radical cut-block diagram corresponding to the text in the target font image, then adjust the parameters of the current font migration model to be trained to obtain a first font migration model, including: if the font in the text radical cut-block diagram corresponding to the text in the target font migration image and the font in the text radical cut-block diagram corresponding to the text in the target font image have a matching degree less than a font matching degree threshold, then adjust the parameters of the current font migration model to be trained to obtain a first font migration model.

13. The processing method for font migration model according to claim 11 or 12, characterized in that: Also includes: The degree of matching between the font in the character radical block diagram corresponding to the characters in the target font migration image and the font in the character radical block diagram corresponding to the characters in the target font image is obtained.

14. The processing method for font migration model according to claim 1, characterized in that: The step of inputting the sample text image and the target font image into the current font transfer model to be trained to obtain the target font transfer image corresponding to the sample text image includes: Scaling the sample text image and the target font image to a preset size; According to the sample text image of the preset size and the target font image of the preset size, a target font migration image corresponding to the sample text image is obtained.

15. A processing device for a font migration model, characterized in that: include: A target font migration image obtaining unit is used to input a sample text image and a target font image into a current font migration model to be trained, and obtain a target font migration image corresponding to the sample text image. The current font migration model to be trained is used to obtain a font migration image corresponding to the text image based on the text image and the target font image. A character radical block diagram obtaining unit is used to input the target font migration image and the target font image into a radical attention model to obtain a character radical block diagram corresponding to the characters in the target font migration image, and obtain a character radical block diagram corresponding to the characters in the target font image, wherein the radical attention model is used to obtain a character radical heat map corresponding to the characters in the font image according to the font image, and obtain a character radical block diagram corresponding to the characters in the font image according to the character radical heat map corresponding to the characters in the font image; a target font migration model obtaining unit, configured to use the current font migration model to be trained as the target font migration model if the font in the character radical block diagram corresponding to the character in the target font migration image matches the font in the character radical block diagram corresponding to the character in the target font image; Among them, the target font migration model acquisition unit is also used for iteratively adjusting the parameters of the current font migration model to be trained until the target font migration model is obtained if the font in the text radical cutting diagram corresponding to the text in the target font migration image does not match the font in the text radical cutting diagram corresponding to the text in the target font image.

16. An electronic device, characterized in that: include: processor; as well as The memory is used to store a program of a processing method for a font migration model. After the electronic device is powered on and the program of the processing method for the font migration model is run by the processor, the following steps are performed: Inputting a sample text image and a target font image into a current font transfer model to be trained, and obtaining a target font transfer image corresponding to the sample text image, wherein the current font transfer model to be trained is used to obtain a font transfer image corresponding to the text image according to the text image and the target font image; Inputting the target font migration image and the target font image into a radical attention model, obtaining a text radical block diagram corresponding to the text in the target font migration image, and obtaining a text radical block diagram corresponding to the text in the target font image, wherein the radical attention model is used to obtain a text radical heat map corresponding to the text in the font image according to the font image, and obtain a text radical block diagram corresponding to the text in the font image according to the text radical heat map corresponding to the text in the font image; If the font in the character radical block diagram corresponding to the characters in the target font migration image matches the font in the character radical block diagram corresponding to the characters in the target font image, then the current font migration model to be trained is used as the target font migration model; If the font in the text radical block diagram corresponding to the text in the target font migration image does not match the font in the text radical block diagram corresponding to the text in the target font image, iteratively adjust the parameters of the current font migration model to be trained until the target font migration model is obtained.

17. A storage medium, characterized in that: A program storing a processing method for a font migration model is executed by a processor to perform the following steps: Inputting a sample text image and a target font image into a current font transfer model to be trained, and obtaining a target font transfer image corresponding to the sample text image, wherein the current font transfer model to be trained is used to obtain a font transfer image corresponding to the text image according to the text image and the target font image; Inputting the target font migration image and the target font image into a radical attention model, obtaining a text radical block diagram corresponding to the text in the target font migration image, and obtaining a text radical block diagram corresponding to the text in the target font image, wherein the radical attention model is used to obtain a text radical heat map corresponding to the text in the font image according to the font image, and obtain a text radical block diagram corresponding to the text in the font image according to the text radical heat map corresponding to the text in the font image; If the font in the character radical block diagram corresponding to the characters in the target font migration image matches the font in the character radical block diagram corresponding to the characters in the target font image, then the current font migration model to be trained is used as the target font migration model; If the font in the text radical block diagram corresponding to the text in the target font migration image does not match the font in the text radical block diagram corresponding to the text in the target font image, the parameters of the current font migration model to be trained are iteratively adjusted until the target font migration model is obtained.

18. A font migration method, characterized in that: include: Obtain the text image to be processed and the target font image; Inputting the to-be-processed text image and the target font image into the radical segmentation unit of the target font migration model, outputting a text radical segmentation map corresponding to the text in the to-be-processed text image, and outputting a text radical segmentation map corresponding to the text in the target font image, wherein the radical segmentation unit is used to obtain a text radical heat map corresponding to the text in the font image according to the font image, and to obtain a text radical segmentation map corresponding to the text in the font image according to the text radical heat map corresponding to the text in the font image; Inputting a text radical block diagram corresponding to the text in the to-be-processed text image and a text radical block diagram corresponding to the text in the target font image into a font migration unit of the target font migration model, obtaining a target radical font migration image of the text radical corresponding to the text in the to-be-processed text image through font migration, wherein the font in the target radical font migration image matches the font in the text radical block diagram corresponding to the text in the target font image; The target radical font migration images are assembled to obtain a target font migration image.

19. The font migration method according to claim 18, characterized in that: Also includes: The target font migration image is displayed.

20. The font migration method according to claim 18, characterized in that: The obtaining of the to-be-processed text image and the target font image includes: obtaining the to-be-processed text image and the target font image provided by a client.

21. The font migration method according to claim 20, characterized in that: Also includes: The designated target font migration image corresponding to the to-be-processed text image is provided to the client.

22. A font migration device, characterized in that: include: An image acquisition unit, used for acquiring a text image to be processed and a target font image; A character radical block diagram obtaining unit is used to input the to-be-processed character image and the target font image into the radical block diagram of the target font migration model, output the character radical block diagram corresponding to the characters in the to-be-processed character image, and output the character radical block diagram corresponding to the characters in the target font image, wherein the radical block diagram unit is used to obtain a character radical heat map corresponding to the characters in the font image according to the font image, and obtain a character radical block diagram corresponding to the characters in the font image according to the character radical heat map corresponding to the characters in the font image; a radical font migration image obtaining unit, used for inputting the character radical block diagram corresponding to the characters in the to-be-processed character image and the character radical block diagram corresponding to the characters in the target font image into the font migration unit of the target font migration model, obtaining the target radical font migration image of the character radical corresponding to the characters in the to-be-processed character image through font migration, wherein the font in the target radical font migration image matches the font in the character radical block diagram corresponding to the characters in the target font image; The target font migration image obtaining unit is used to assemble the target radical font migration images to obtain a target font migration image.

23. An electronic device, characterized in that: include: processor; as well as The memory is used to store a program of the font migration method. After the electronic device is powered on and the program of the font migration method is run by the processor, the following steps are performed: Obtain the text image to be processed and the target font image; Inputting the to-be-processed text image and the target font image into the radical segmentation unit of the target font migration model, outputting a text radical segmentation map corresponding to the text in the to-be-processed text image, and outputting a text radical segmentation map corresponding to the text in the target font image, wherein the radical segmentation unit is used to obtain a text radical heat map corresponding to the text in the font image according to the font image, and to obtain a text radical segmentation map corresponding to the text in the font image according to the text radical heat map corresponding to the text in the font image; Inputting a text radical block diagram corresponding to the text in the to-be-processed text image and a text radical block diagram corresponding to the text in the target font image into a font migration unit of the target font migration model, obtaining a target radical font migration image of the text radical corresponding to the text in the to-be-processed text image through font migration, wherein the font in the target radical font migration image matches the font in the text radical block diagram corresponding to the text in the target font image; The target radical font migration images are assembled to obtain a target font migration image.

24. A storage medium, characterized in that A program for a font migration method is stored, and the program is executed by a processor to perform the following steps: Obtain the text image to be processed and the target font image; Inputting the to-be-processed text image and the target font image into the radical segmentation unit of the target font migration model, outputting a text radical segmentation map corresponding to the text in the to-be-processed text image, and outputting a text radical segmentation map corresponding to the text in the target font image, wherein the radical segmentation unit is used to obtain a text radical heat map corresponding to the text in the font image according to the font image, and to obtain a text radical segmentation map corresponding to the text in the font image according to the text radical heat map corresponding to the text in the font image; Inputting a text radical block diagram corresponding to the text in the to-be-processed text image and a text radical block diagram corresponding to the text in the target font image into a font migration unit of the target font migration model, obtaining a target radical font migration image of the text radical corresponding to the text in the to-be-processed text image through font migration, wherein the font in the target radical font migration image matches the font in the text radical block diagram corresponding to the text in the target font image; The target radical font migration images are assembled to obtain a target font migration image.

25. A processing method for a font migration model, characterized in that: include: Inputting a sample text image and a target font image into a current font transfer model to be trained to obtain a target font transfer image corresponding to the sample text image, wherein the current font transfer model to be trained is used to obtain a font transfer image corresponding to the text image based on the text image and the target font image; Input the target font migration image and the target font image into the radical attention model, obtain a text letter block diagram corresponding to the text in the target font migration image, and obtain a text letter block diagram corresponding to the text in the target font image, wherein the radical attention model is used to obtain a text letter heat map corresponding to the text in the font image according to the font image, and obtain a text letter block diagram corresponding to the text in the font image according to the text letter heat map corresponding to the text in the font image; If the font in the text letter block diagram corresponding to the text in the target font migration image matches the font in the text letter block diagram corresponding to the text in the target font image, then the current font migration model to be trained is used as the target font migration model; If the font in the text letter block diagram corresponding to the text in the target font migration image does not match the font in the text letter block diagram corresponding to the text in the target font image, the parameters of the current font migration model to be trained are iteratively adjusted until the target font migration model is obtained.

26. A font migration method, characterized in that: include: Obtain the text image to be processed and the target font image; Input the to-be-processed text image and the target font image into the radical block unit of the target font migration model, output a text letter block diagram corresponding to the text in the to-be-processed text image, and output a text letter block diagram corresponding to the text in the target font image, wherein the radical block unit is used to obtain a text letter heat map corresponding to the text in the font image according to the font image, and obtain a text letter block diagram corresponding to the text in the font image according to the text letter heat map corresponding to the text in the font image; Inputting a text letter segmentation diagram corresponding to the text in the to-be-processed text image and a text letter segmentation diagram corresponding to the text in the target font image into a font migration unit of the target font migration model, obtaining a target radical font migration image of the text letters corresponding to the text in the to-be-processed text image through font migration, wherein the font in the target radical font migration image matches the font in the text letter segmentation diagram corresponding to the text in the target font image; The target radical font migration images are assembled to obtain a target font migration image.

Citation Information

Patent Citations

  • Chinese character font migration system based on adversarial networks

    CN107577651A

  • Font style migration method based on conditional cycle consistency generative adversarial network

    CN110503598A