Word art generation method and device, equipment and storage medium

By using the glyph outline deformation model and texture rendering model, the preset text is deformed and texture fill processing is solved, and the problem of poor artistic word generation effect in the existing technology is achieved, and the diversity and semantic correlation of artistic word is achieved.

CN119624754APending Publication Date: 2025-03-14PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411539116.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

In the prior art, the generation effect of artistic characters is poor, and there is a problem of single changes.

Method used

By obtaining user input information, including preset text, first prompt text and second prompt text, the preset glyph contour deformation model and texture rendering model are used to deform and texture fill the outline of the preset text respectively to generate diverse artistic characters.

Benefits of technology

The generation effect of the word art is improved, so that the outline of the word generated is associated with the semantic information of the first prompt text, and similar to the outline of the preset text, the texture of the word art is associated with the semantic information of the second prompt text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119624754A_ABST
    Figure CN119624754A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of wordart generation, and provides a wordart generation method and device, equipment and a storage medium, and the method comprises the steps: obtaining user input information which comprises a preset text, a first prompt text and a second prompt text; based on a preset font contour deformation model, according to the first prompt text and the preset text, performing deformation processing on the contour of the preset text to obtain a target text; the contour of the target text is associated with the semantic information of the first prompt text, and the contour of the target text is similar to the contour of the preset text; based on a preset texture rendering model, performing texture filling processing on the interior of the contour of the target text according to the second prompt text to obtain a corresponding wordart; the texture of the wordart is associated with the semantic information of the second prompt text, so that the wordart generation effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of artistic word generation, and in particular to an artistic word generation method, device, equipment and storage medium. Background Art

[0002] Word art generation is an interesting and creative branch of digital art and design. Word art can be a font that combines technology, art, and linguistics to create a beautiful font that can convey a specific emotion or message.

[0003] At present, artistic words can be widely used in daily life, such as in marketing scenarios. For example, corresponding products can be marketed through artistic words. The demand for the generation of artistic words has also increased accordingly. However, in the related art, the generated artistic words are prone to single changes, which easily leads to poor generation effects of artistic words. Summary of the invention

[0004] The main purpose of this application is to provide a method, device, equipment and storage medium for generating artistic characters, aiming to improve the generation effect of artistic characters.

[0005] In a first aspect, the present application provides a method for generating an artistic word, comprising the following steps:

[0006] Acquire user input information, where the user input information includes a preset text, a first prompt text, and a second prompt text;

[0007] Based on a preset glyph contour deformation model, according to the first prompt text and the preset text, the contour of the preset text is deformed to obtain a target text; the contour of the target text is associated with the semantic information of the first prompt text, and the contour of the target text is similar to the contour of the preset text;

[0008] Based on a preset texture rendering model, texture filling processing is performed on the inside of the outline of the target text according to the second prompt text to obtain a corresponding artistic word; the texture of the artistic word is associated with the semantic information of the second prompt text.

[0009] In a second aspect, the present application further provides a device for generating artistic characters, the device comprising:

[0010] An acquisition module, used for acquiring user input information, wherein the user input information includes a preset text, a first prompt text and a second prompt text;

[0011] A contour deformation module, configured to deform the contour of the preset text based on the preset glyph contour deformation module and the first prompt text and obtain a target text; the contour of the target text is associated with the semantic information of the first prompt text, and the contour of the target text is similar to the contour of the preset text;

[0012] The texture rendering module is used to perform texture filling processing on the inside of the outline of the target text based on a preset texture rendering model and according to the second prompt text to obtain corresponding artistic characters; the texture of the artistic characters is associated with the semantic information of the second prompt text.

[0013] In a third aspect, the present application further provides a computer device, the computer device comprising a memory and a processor;

[0014] The memory is used to store computer programs;

[0015] The processor is used to execute the computer program and implement the steps of the method for generating artistic characters as described above when executing the computer program.

[0016] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method for generating artistic characters as described above are implemented.

[0017] The present application provides a method, device, equipment and storage medium for generating artistic characters. The method for generating artistic characters includes: obtaining user input information, the user input information includes a preset text, a first prompt text and a second prompt text; based on a preset character outline deformation model, deforming the outline of the preset text according to the first prompt text and the preset text to obtain a target text; the outline of the target text is associated with the semantic information of the first prompt text, and the outline of the target text is similar to the outline of the preset text; based on a preset texture rendering model, texture filling is performed on the inside of the outline of the target text according to the second prompt text to obtain the corresponding artistic characters; the texture of the artistic characters is associated with the semantic information of the second prompt text to improve the generation effect of the artistic characters.

[0018] In the case of obtaining the preset text, the glyph contour deformation model can deform the contour of the preset text according to the guidance of the first prompt text, so that the contour of the target text is associated with the contour of the preset text and the semantic information of the first prompt text. Correspondingly, the glyph contour deformation model can restrict the deformation of the contour of the preset text according to the restrictions of the preset text, so that the contour of the target text is similar to the contour of the preset text. In the case of obtaining the target text, the texture rendering model can fill the texture inside the contour of the target text according to the guidance of the second prompt text, so that the texture of the artistic word is associated with the semantic information of the second prompt text. Based on this, when the contour of the generated artistic word is associated with the semantic information of the first prompt text, and is similar to the contour of the preset text, and the texture of the artistic word is associated with the semantic information of the second prompt text, the generated artistic word meets the artistic word generation requirement indicated by the user input information. Correspondingly, the user's artistic word generation requirements for artistic words can be varied and diverse, and the computer device can implement the artistic word generation requirements through the glyph contour deformation model and the texture rendering model, and generate the corresponding artistic word, which is conducive to improving the generation effect of the artistic word. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0020] Figure 1 It is a flowchart of a method for generating artistic characters provided in an embodiment of the present application;

[0021] Figure 2 is a schematic diagram of a process of generating artistic characters involved in an embodiment of the present application;

[0022] Figure 3 is a schematic block diagram of a device for generating artistic characters provided in an embodiment of the present application;

[0023] Figure 4 It is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0025] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.

[0026] The embodiments of the present application provide a method, device, equipment and storage medium for generating artistic characters. The method for generating artistic characters can be applied to a computer device, which can be a mobile phone, a tablet computer, a laptop computer, a desktop computer and the like. The method can also be applied to a server, which can be a separate server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0027] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0028] See also Figure 1 , Figure 1 It is a flowchart of a method for generating artistic words provided in an embodiment of the present application. It should be noted that the method for generating artistic words provided in an embodiment of the present application can be used in a computer device, and of course can also be used in a server. For example, the server can obtain user input information from a computer device, and process the preset text included in the user input information according to the method for generating artistic words to obtain the corresponding artistic words. Exemplarily, the server can, for example, send the artistic words to a computer device; of course, it is not limited to this, and is not limited here.

[0029] In specific implementation, computer devices include but are not limited to: any one of mobile phones, tablet computers, laptop computers, and desktop computers; the server can be a single server or a server cluster, or a cloud server that provides cloud computing services.

[0030] like Figure 1 As shown, the method for generating artistic characters includes steps S101 to S103.

[0031] Step S101: obtaining user input information, where the user input information includes a preset text, a first prompt text, and a second prompt text.

[0032] Exemplarily, when a user has a need to generate word art, the user can configure the preset text, the first prompt text, and the second prompt text according to the instructions of the computer device. For example, the computer device can display an input information selection list, and a plurality of initial texts can be set in the input information selection list. The user can select the corresponding initial text from the plurality of initial texts as the preset text, the first prompt text, and the second prompt text. Of course, it is not limited to this. The user can also input the preset text, the first prompt text, and the second prompt text according to his own needs for generating word art, which is not limited here.

[0033] The preset text may include letters, words, symbols, etc., which are not limited here. The number of preset texts may include one or more, which are not limited here. The first prompt text and the second prompt text may include words, idioms, poems, etc., which are not limited here.

[0034] In some embodiments, the computer device may acquire the preset text in the form of a preset glyph image. For example, if the user input information includes a preset glyph image containing the preset text, the computer device may determine the preset text through the preset glyph image. Alternatively, when the computer device acquires the preset text, it may convert the preset text into a preset glyph image containing the preset text. The preset glyph image may be used to subsequently generate artistic characters corresponding to the preset text.

[0035] When the preset glyph image is obtained, the computer device may determine whether the image attribute information of the preset glyph image meets the preset conditions. The image attribute information may include the current size and current color of the preset glyph image, etc., which are not limited here. The preset conditions may include that the current size of the preset glyph image meets the preset image size, and the current color of the preset glyph image meets the preset image color. The preset conditions may be expressed as in, is used to indicate a preset glyph image, w and h are used to indicate a preset image size, and n is used to indicate the number of color channels corresponding to the preset image color. The color channels corresponding to the preset image color may include red, green, and blue (RGB) channels, and the number of color channels may include 3, which is not limited here.

[0036] When the image attribute information of the preset glyph image does not meet the preset conditions, the computer device can adjust the image attribute information of the preset glyph image so that the adjusted preset glyph image meets the preset conditions, and the computer device can subsequently generate artistic characters corresponding to the preset text based on the adjusted preset glyph image.

[0037] For example, the current size of the preset glyph image may include the current image width and the current image height. The preset image size may include the preset image width and the preset image height. When the current image width does not conform to the preset image width, and the current image height does not conform to the preset image height, the computer device may perform at least one of a scaling operation and a cropping operation on the preset glyph image to adjust the current size of the preset glyph image, so that the current size of the adjusted preset glyph image conforms to the preset image size. Taking the example that the preset glyph image may include preset text and a preset image background, in the process of adjusting the current size of the preset glyph image, the computer device may scale the preset text and the preset image background included in the preset glyph image, and the computer device may also perform a cropping operation on the preset image background alone, so that the current size of the adjusted preset glyph image conforms to the preset image size.

[0038] For example, when the current color of the preset glyph image does not conform to the preset image color, the computer device may perform color conversion processing on the preset glyph image so that the current color of the adjusted preset glyph image conforms to the preset image color. Take the preset glyph image as an example, which may include preset text and a preset image background. The preset text and the preset image background may correspond to different preset image colors. For example, the first preset image color corresponding to the preset text may include black, and the second preset image color corresponding to the preset image background may include white, which is not limited here. When the current color of the preset text does not conform to the first preset image color, the computer device may adjust the current color of the preset text to the first preset image color. Correspondingly, when the current color of the preset image background does not conform to the second preset image color, the computer device may adjust the current color of the preset image background to the second preset image color. Based on this, the current color of the adjusted preset glyph image conforms to the preset image color.

[0039] Of course, it is not limited to this. The preset condition may also include that the current color format of the preset glyph image meets the preset color format. Taking the preset color format including the RGB format as an example, if the current color format of the preset glyph image is not the RGB format, the computer device may adjust the current color format of the preset glyph image to the RGB format, which is not limited here.

[0040] In this way, when the preset text is obtained, the preset text can be used to subsequently generate corresponding artistic characters.

[0041] Step S102: Based on a preset glyph outline deformation model, according to the first prompt text and the preset text, the outline of the preset text is deformed to obtain a target text; the outline of the target text is associated with the semantic information of the first prompt text, and the outline of the target text is similar to the outline of the preset text.

[0042] The glyph outline deformation model can deform the outline of the preset text according to the semantic information of the first prompt text to improve the diversity of the outline of the target text. Accordingly, in the process of deforming the outline of the preset text, the glyph outline deformation model can constrain the deformation process according to the preset text to avoid the situation where the outline of the target text is far different from the outline of the preset text and has no connection, which is conducive to the subsequent improvement of the generation effect of the artistic text.

[0043] In some implementations, the outline of a preset text is obtained; the outline of the preset text is discretized to obtain control points corresponding to the outline; and the positions of the control points are changed according to the first prompt text and the preset text to obtain the target text.

[0044] For example, the glyph outline deformation model can extract the outline of the preset text through a tool with a glyph outline extraction function to obtain the outline of the preset text. Correspondingly, when the glyph outline deformation model obtains a preset glyph image containing the preset text, it can also extract the outline of the preset text in the preset glyph image through a tool with a glyph outline extraction function to obtain the outline of the preset text. The tool with a glyph outline extraction function can include a font processing library, a graphics processing library, etc., which is not limited here.

[0045] In the case of obtaining the outline of the preset text, based on the consideration of the glyph outline deformation, the glyph outline deformation model can convert the outline points included in the outline of the preset text into corresponding discrete control points for deforming the outline of the preset text. For example, the glyph outline deformation model can convert the outline of the preset text into editable control points through a tool with a contour discretization function. The control points may include Bezier curve control points, B-spline curve control points, and the like, which are not limited here. Among them, the control points can be used to indicate the key shape features of the preset text. Based on the editability of the control points, the glyph outline deformation model can change the position of the control points so that the computer device can deform the outline of the preset text.

[0046] In an exemplary embodiment, the control points corresponding to the outline of the preset text obtained by the glyph outline deformation model can be expressed as Wherein, P is used to indicate the control points corresponding to the outline of the preset text, k is used to indicate the total number of control points corresponding to the outline of the preset text, and p j Used to indicate the position of the jth control point, j∈[1,k].

[0047] When the control points corresponding to the contour are obtained, the glyph contour deformation model can change the position of the control points according to the semantic information of the first prompt text. For example, the glyph contour deformation model can change the positions of all control points, or can change the positions of some control points, which is not limited here. Accordingly, in the process of changing the positions of the control points, the glyph contour deformation model can constrain the process of changing the positions of the control points according to the preset text, so as to avoid the situation where the contour of the target text is very different from the contour of the preset text and has no connection, which is conducive to the subsequent improvement of the generation effect of artistic characters.

[0048] In some embodiments, the control points are initialized to obtain the control points to be trained; based on a preset rendering layer, the control points to be trained are rendered to obtain an intermediate text; based on a preset first loss function, a first loss value corresponding to the control points to be trained is determined according to the intermediate text and the first prompt text; based on a preset second loss function, a second loss value corresponding to the control points to be trained is determined according to the preset text and the intermediate text; based on the first loss value and the second loss value, the position of the control points to be trained is iteratively optimized to obtain the target text.

[0049] For example, the glyph outline deformation model can initialize the control points corresponding to the outline of the preset text to obtain the control points to be trained. If the control points to be trained are learnable, the glyph outline deformation model can iteratively optimize the positions of the control points to be trained based on the learnability of the control points to be trained, so as to generate the target text according to the positions of the control points to be trained after iterative optimization.

[0050] When the control points to be trained are obtained, the glyph outline deformation model can learn how to change the outline of the preset text, such as changing the position of the control points, based on the control points to be trained, so as to determine the target text.

[0051] For example, the glyph outline deformation model may be provided with a preset rendering layer. The rendering layer may be used to render the control points to be trained to obtain the corresponding intermediate text. The rendering layer may be provided with a tool with a vector graphics rendering function, and the rendering layer may generate the corresponding intermediate text according to the control points through the tool with a vector graphics rendering function. The rendering layer may be conductive. For example, the preset text may be represented as text l, and the intermediate text may be represented as text The rendering layer can be represented as R, the control point can be represented as control point P, and the control point to be trained can be represented as control point Then the rendering process of the rendering layer for the training control points can be expressed as

[0052] In an exemplary embodiment, the glyph outline deformation model can receive a preset glyph image containing preset text, initialize the control points corresponding to the outline of the preset text in the preset glyph image, obtain the corresponding control points to be trained, and render the control points to be trained through the rendering layer to obtain an intermediate glyph image, wherein the intermediate glyph image may include intermediate text corresponding to the preset text, which is not limited here.

[0053] Of course, it is not limited to this. After the rendering layer renders the training control points to obtain the corresponding intermediate text, the glyph contour deformation model can also perform random data enhancement, perspective transformation, random cropping, etc. on the intermediate text in turn to obtain the enhanced intermediate text. The enhanced intermediate text can be represented as text For example, a preset distortion ratio may be applied with a preset probability to perform perspective transformation on the intermediate text. For example, the intermediate text may be randomly cropped so that the cropped intermediate text is adapted to the input dimension of the glyph outline deformation model. For example, the input dimension of the glyph outline deformation model may be expressed as in, Used to indicate intermediate text, w′ and h′ are used to indicate the preset text size corresponding to the intermediate text adapted to the input dimension, and n is used to indicate the number of color channels corresponding to the preset text color of the intermediate text adapted to the input dimension. The color channels corresponding to the preset text color may include red, green, and blue (RGB) channels, and the number of color channels may include 3, which is not limited here. The glyph outline deformation model can subsequently iteratively optimize the positions of the control points to be trained based on the enhanced intermediate text to determine the target text, which is not limited here. Hereinafter, the unenhanced intermediate text and the enhanced intermediate text will be collectively referred to as the intermediate text.

[0054] When the intermediate text is obtained, the glyph contour deformation model can combine the first loss function and the second loss function respectively to determine the first loss value and the second loss value corresponding to the training control point, so as to iteratively optimize the position of the training control point to obtain the target text.

[0055] Exemplarily, the glyph outline deformation model can simulate a gradual "diffusion" process from a data distribution to a simple noise distribution, and then reconstruct high-quality data samples from the noise by learning an inverse process, such as reconstructing the training control points to determine the intermediate text. The first loss function may include a latent score distillation loss function. The first loss function can be used to predict and correct the noise of the glyph outline deformation model in a latent space.

[0056] For example, the glyph outline deformation model can generate new intermediate text by gradually adding noise to the control points to be trained, and then learning how to recover the control points to be trained from the noise. In this process, the glyph outline deformation model can evaluate the difference between the contour of the intermediate text and the semantic information of the first prompt text by combining the first prompt text and the intermediate text through the first loss function, so that the glyph outline deformation model can iteratively optimize the position of the control points to be trained, thereby improving the quality of the subsequently generated preset text to be processed.

[0057] In some embodiments, based on a preset first embedding layer, the first prompt text is embedded to obtain a first feature vector corresponding to the first prompt text; based on a preset diffusion layer, noise prediction information is determined according to the first feature vector and the intermediate text; the intermediate text, the first feature vector and the noise prediction information are substituted into a first loss function to obtain a first loss value.

[0058] The glyph contour deformation model can extract the semantic information of the first prompt text through the embedding process of the first embedding layer to form a first feature vector. The first feature vector can be used as a basis for the glyph contour deformation model to iteratively optimize the control points to be trained, so that the contour of the target text is associated with the semantic information of the first prompt text. For example, the first embedding layer can be provided with a contrastive language-image pre-training (CLIP) architecture. The first embedding layer can determine the first feature vector corresponding to the first prompt text through the CLIP architecture.

[0059] When the first eigenvector is determined, the glyph outline deformation model can perform noise prediction processing on the first eigenvector and the intermediate text through a diffusion layer to determine noise prediction information. For example, the diffusion layer can be provided with a stable diffusion (SD) network. The stable diffusion network can be provided with a U-Net editor. The diffusion layer can perform noise processing on the intermediate text through the SD network to obtain the noisy intermediate text, and obtain the preset latent features (latent) corresponding to the noisy intermediate text. Accordingly, the diffusion layer can output the prediction information of adding random noise to the preset latent features through the U-Net editor, combined with the preset latent features corresponding to the noisy intermediate text and the first eigenvector, to obtain the corresponding noise prediction information. The noise prediction information can be used as a basis for the glyph outline deformation model to iteratively optimize the positions of the control points to be trained to determine the target text.

[0060] When the noise prediction information is determined, the glyph outline deformation model can substitute the intermediate text, the first prompt text and the noise prediction information into the first loss function to obtain a first loss value. In the process of iteratively optimizing the position of the control point to be trained, the glyph outline deformation model can use a gradient descent method to back-propagate the first loss value to the position of the control point to be trained to update the position of the control point to be trained, so that the intermediate text corresponding to the control point to be trained gradually changes, and then the contour of the intermediate text can be associated with the semantic information of the first prompt text for subsequent determination of the target text.

[0061] For example, the first loss function can be expressed as the function function It can be expressed as:

[0062]

[0063] Used to indicate intermediate text. Used to indicate the control point to be trained. ∈∈N(0,1) is used to indicate random Gaussian noise. t is used to indicate the noise intensity. E t,∈ It is used to indicate the diffusion function corresponding to the diffusion layer. z is used to indicate the preset latent feature corresponding to the intermediate text after noise addition. The preset latent feature meets α t z+σ t ∈ is used to indicate the preset potential features after noise addition, α t and σ t It is used to indicate the preset value related to t, and w(t) is used to indicate the preset value related to α t c1 is used to indicate the first feature vector corresponding to the first prompt text. Used to indicate the noise prediction function corresponding to the diffusion layer, the diffusion layer The input of is the preset potential feature corresponding to the intermediate text after noise addition and the first feature vector corresponding to the first prompt text, and the output is the corresponding noise prediction information. φ is used to indicate the noise prediction parameter corresponding to the diffusion layer.

[0064] When the first loss value is determined, the glyph contour deformation model can iteratively optimize the control points to be trained according to the first loss value until the final target text is obtained, wherein the contour of the target text is associated with the semantic information of the first prompt text.

[0065] like Figure 2 As shown in FIG. 1 , the preset text l is “S” and the first prompt text is “Surfing”. The glyph contour deformation model can obtain the contour of the preset text “S” and obtain the corresponding control points. The glyph contour deformation model can initialize the control points to obtain the control points to be trained. The glyph outline deformation model can render the control points to be trained through the rendering layer Get the middle text The glyph outline deformation model can determine the first feature vector c1 corresponding to the first prompt text through the first embedding layer, and transform the first feature vector and the intermediate text according to the diffusion layer. The corresponding noise prediction processing is performed to obtain the noise prediction information. Based on this, the intermediate text is obtained in the glyph contour deformation model. In the case of the corresponding preset latent feature z, the glyph contour deformation model can perform noise processing on the preset latent feature to obtain the preset latent feature z after noise addition t Accordingly, the glyph outline deformation model can be combined with the intermediate text through the U-Net editor of the diffusion layer The corresponding preset potential feature z after noise addition t , the first eigenvector c1 and the noise prediction information, determine the first loss value Based on this, the glyph contour deformation model can adopt the gradient descent method, according to the first loss value Back propagation to the control point to be trained Treat training control points as The position of The target text is determined by gradually changing the target text so that the outline of the target text is associated with the semantic information of the first prompt text. The contour of the target text can show the semantic information of “surfing”. Accordingly, the contour of the target text determined according to the target position of the control point to be trained after the iterative optimization is completed can still show the semantic information of “surfing”.

[0066] Based on the association between the outline of the target text and the semantic information of the first prompt text, when the corresponding artistic word is determined based on the target text, the outline of the artistic word can also be associated with the semantic information of the first prompt text accordingly, which is conducive to improving the generation effect of the artistic word.

[0067] Exemplarily, when the glyph contour deformation model changes the contour of the preset text according to the semantic information of the first prompt text, if the glyph contour changes to a large extent, it is easy to cause the contour of the target text to be very different from the contour of the original preset text, thereby making it difficult to distinguish the original preset text. Based on this, in order to improve the similarity between the contour of the target text and the contour of the preset text, the glyph contour deformation model can use a second loss function to determine a second loss value, and based on the second loss value, limit the change process of the contour of the preset text. The second loss function can include a structure preservation loss function.

[0068] For example, the glyph outline deformation model can maintain the contour similarity between the target text and the preset text by limiting the difference between the tone of the target text and the tone of the preset text. In an exemplary embodiment, the glyph outline deformation model can obtain a corresponding preset glyph image based on the preset text, and the preset glyph image includes the preset text. In the process of changing the outline of the preset text, such as changing it to the corresponding intermediate text, the preset glyph image will also change accordingly. The glyph outline model can limit the difference between the tone of the intermediate glyph image corresponding to the intermediate text and the tone of the original preset glyph image to maintain the contour similarity between the target text and the preset text. For example, the difference in tone between the intermediate glyph image and the original preset glyph image can be reflected in the proportion of black and white areas in the local image. The glyph outline model can limit the proportion of black and white areas in the corresponding local image in the intermediate glyph image based on the proportion of black and white areas in the local image involved in the original preset glyph image. In this process, the glyph contour deformation model can evaluate the similarity between the contour of the intermediate text and the contour of the preset text through the second loss function, combined with the preset text and the intermediate text, so that the glyph contour deformation model can iteratively optimize the position of the training control point, thereby improving the quality of the subsequently generated preset text to be processed.

[0069] In some embodiments, based on a preset low-pass filter layer, low-pass filtering is performed on the preset text and the intermediate text respectively to obtain a processed preset text and a processed intermediate text; the processed preset text and the processed intermediate text are substituted into a second loss function to obtain a second loss value.

[0070] For example, the glyph contour deformation model can perform low-pass filtering on the preset text through a low-pass filter layer to obtain the processed preset text. For example, the preset text can be represented as l, and the processed preset text can be represented as LPF(l). Correspondingly, the glyph contour deformation model can perform low-pass filtering on the intermediate text through a low-pass filter layer to obtain the processed intermediate text. For example, the intermediate text can be represented as For example, the processed intermediate text can be expressed as

[0071] In an exemplary embodiment, the glyph outline deformation model can perform low-pass filtering on the preset glyph image corresponding to the preset text through a low-pass filtering layer to obtain a processed preset glyph image. Correspondingly, the glyph outline deformation model can perform low-pass filtering on the intermediate glyph image corresponding to the intermediate text through a low-pass filtering layer to obtain a processed intermediate glyph image. The low-pass filtering layer can use a higher standard deviation in the blur kernel to blur some subtle details in the preset text and the intermediate text, which is not limited here.

[0072] When the processed preset text and the processed intermediate text are determined, the glyph outline deformation model can substitute the processed preset text and the processed intermediate text into the second loss function to obtain a second loss value. The second loss function can be used to calculate the Euclidean distance (L2 distance) between the processed preset text and the processed intermediate text.

[0073] For example, the second loss function can be expressed as the function function It can be expressed as:

[0074]

[0075] The glyph outline deformation model substitutes the processed preset text and the processed intermediate text into the second loss function to determine the corresponding second loss value.

[0076] like Figure 2 As shown, the preset text l is "S", the first prompt text is "Surfing", and the control point to be trained is The middle text is For example, the glyph contour deformation model can be based on the low-pass filter layer to respectively perform the pre-set text l and the intermediate text Perform low-pass filtering and combine the second loss function to determine the difference between the processed preset text LPF(l) and the processed intermediate text The corresponding second loss value Accordingly, the glyph outline deformation model can convert the second loss value into Back propagation is performed to the control points to be trained to iteratively optimize the positions of the control points to be trained, thereby changing the intermediate text so that the outline of the intermediate text is similar to the outline of the preset text. The contour can reflect the semantic information of "surfing", and the contour of the middle text can still be seen to be similar to the preset text "S". Accordingly, after completing the iterative optimization of the position of the control point to be trained and obtaining the target position of the control point to be trained, the glyph contour deformation model can determine the target text based on the target position of the training control point, and the contour of the target text still has contour similarity with the contour of the preset text.

[0077] Since the outline of the target text is similar to the outline of the preset text, when the corresponding artistic word is subsequently determined based on the target text, the outline of the artistic word also has similarity with the outline of the preset text, which is conducive to improving the generation effect of the artistic word.

[0078] In each round of iterative optimization of the control points to be trained, the glyph outline deformation model determines the first loss value through the first loss function, and determines the second loss value through the second loss function. The glyph outline deformation model can combine the first loss value and the second loss value to iteratively optimize the position of the control points to be trained until the target text is determined.

[0079] For example, the glyph outline deformation model can determine the iterative optimization value according to the first loss value and the second loss value, which can be expressed as:

[0080]

[0081] Among them, α is used to indicate the second loss value The weight of .

[0082] The glyph outline deformation model can adopt a gradient descent method to back-propagate the gradient of the iterative optimization value and update the iterative optimization of the position of the control point to be trained. In an exemplary embodiment, in the process of iterative optimization of the position of the control point to be trained, the parameters of the rendering layer, the first embedding layer, the diffusion layer, and the low-pass filter layer involved are all frozen to ensure that the position of the control point to be trained is iteratively optimized, so as to determine the final target position of the control point to be trained, and determine the target text according to the target position of the control point to be trained. Among them, the target text can maintain the contour similarity with the preset text, that is, the contour of the target text is similar to the contour of the preset text, and the contour of the target text can show the semantic information of the first prompt text, that is, the contour of the target text is associated with the semantic information of the first prompt text.

[0083] In this way, based on the preset glyph contour deformation model, the contour of the preset text is deformed according to the first prompt text and the preset text to obtain the target text. It can be ensured that the contour of the target text is associated with the semantic information of the first prompt text and the contour similarity between the target text and the preset text is maintained. When the corresponding artistic characters are subsequently generated based on the target text, it is beneficial to improve the generation effect of the artistic characters.

[0084] Step S103: Based on a preset texture rendering model and according to the second prompt text, texture filling processing is performed on the inside of the outline of the target text to obtain a corresponding artistic word; the texture of the artistic word is associated with the semantic information of the second prompt text.

[0085] When the texture rendering model obtains the target text, it can determine the outline of the target text. Accordingly, the texture rendering model can perform texture filling processing on the inside of the outline of the target text based on the outline of the target text and the semantic information of the second prompt text to obtain the corresponding word art. Among them, the texture of the word art is associated with the semantic information of the second prompt text. Based on this, the outline of the word art can be made diverse, and accordingly, the inside of the outline of the word art can also have texture diversity, which is conducive to improving the generation effect of the word art.

[0086] In some implementations, a mask image corresponding to the target text is obtained; and according to the second prompt text, a texture filling process is performed on the mask image to obtain a corresponding artistic word.

[0087] The texture rendering model can determine the outline of the target text according to the mask image corresponding to the target text, and then can perform texture filling processing on the inside of the outline of the target text according to the mask image to obtain the corresponding artistic word.

[0088] For example, the texture rendering model can obtain a target glyph image corresponding to the target text. The target glyph image can include the target text and the target image background. Take the pixel value of the target text as 0, that is, the color of the target text is black, and the pixel value of the target image background is 255, that is, the color of the target image background is white. The texture rendering model can invert the pixel values ​​involved in the target glyph image to obtain a mask image corresponding to the target text. For example, the texture rendering model can invert the pixel value of the target text and the pixel value of the target image background, which is equivalent to changing the pixel value of the target text from 0 to 255, so that the color of the target text is inverted from black to white, and changing the pixel value of the target image background from 255 to 0, so that the color of the target image background is inverted from white to black, so as to obtain a mask image.

[0089] When the mask image is obtained, the texture rendering model can divide the target text and the target image background into texture filling areas and non-texture filling areas according to their respective pixel values. For example, the texture rendering model can determine that the area where the target text is located in the mask image is a texture filling area based on the pixel value of the target text in the mask image being 255. Correspondingly, the texture rendering model can determine that the area where the target image background is located in the mask image is a non-texture filling area based on the pixel value of the target image background in the mask image being 0. Based on this, the texture rendering model can, in the process of texture filling processing on the mask image, obtain a texture filling icon associated with the semantic information of the second prompt text according to the second prompt text, and perform texture filling processing on the texture filling area of ​​the mask image according to the texture filling icon to obtain the corresponding artistic word.

[0090] In some embodiments, a preset generation condition corresponding to the mask image is obtained; based on a preset noise fusion layer, the preset generation condition is fused with a preset noise matrix to obtain a target generation condition; based on a preset second embedding layer, the second prompt text is embedded to obtain a second eigenvector corresponding to the second prompt text; based on a preset cross-attention layer, the mask image is texture-filled according to the target generation condition and the second eigenvector to obtain the corresponding art word.

[0091] For example, the texture rendering model can obtain the preset generation conditions corresponding to the mask image through a tool with a function of identifying conditions for generating artistic characters. For example, the tool with a function of identifying conditions for generating artistic characters may include a control network component (ControlNet), which is not limited here. The architecture of the tool with a function of identifying conditions for generating artistic characters may include a conditional information encoder, a U-Net encoder, and a zero convolution layer. The texture rendering model can input the mask image as a depth map into the tool with a function of identifying conditions for generating artistic characters, and obtain the preset generation conditions after being processed by the conditional information encoder, the U-Net encoder, and the zero convolution layer. The preset generation conditions can be used to indicate restrictions in the process of generating artistic characters.

[0092] The texture rendering model can obtain a preset noise matrix. The noise matrix can be a random noise matrix generated by sampling Gaussian distribution N(0,1). The texture rendering model can input the preset generation conditions and the noise matrix into the noise fusion layer, so as to fuse the preset generation conditions and the noise matrix through the noise fusion layer to obtain the target generation conditions. For example, the texture rendering model can be provided with a Stable Diffusion XL (SDXL) network. The SDXL network can be provided with a noise fusion layer. The noise fusion layer can be provided with an intermediate layer of a U-Net editor, and the SDXL network can perform an addition operation on the preset generation conditions and the noise matrix through the intermediate layer of the U-Net editor to obtain the target generation conditions.

[0093] Accordingly, the texture rendering model can embed the second prompt text through the second embedding layer, extract the semantic information of the second prompt text, and form a second feature vector. The second feature vector can be used as a basis for the texture rendering model to perform texture filling processing on the target text, so that the texture of the obtained artistic word is associated with the semantic information of the second prompt text. For example, the second embedding layer can be provided with a CLIP architecture.

[0094] The second embedding layer can determine the second feature vector corresponding to the second prompt text through the CLIP architecture.

[0095] When the target generation condition and the second feature vector are determined, the texture rendering model can be integrated into the texture generation process of the texture rendering model through a cross attention layer, so that the texture filling diagram generated by the texture rendering model is associated with the semantic information of the second prompt text. In an exemplary embodiment, the texture rendering model can integrate the target generation condition and the second feature vector into the texture generation process of the SDXL network through a cross attention layer to perform texture filling processing on the mask image.

[0096] Accordingly, the texture rendering model can perform texture filling processing on the mask image based on the generated texture filling diagram, such as performing texture filling processing on the texture filling area of ​​the mask image to obtain the corresponding artistic word. For example, the texture rendering model can traverse the texture filling diagram for each pixel of the mask image. When there is a pixel whose pixel value is 0, such as the pixel value of the pixel in the non-filled area of ​​the mask image is 0, the texture rendering model can keep the pixel value of the pixel at 0. When there is a pixel whose pixel value is not 0, such as the pixel value of the pixel in the filled area of ​​the mask image is 255, the texture rendering model can perform texture filling processing on the pixel according to the texture filling diagram. Based on this, the texture rendering model can output the corresponding artistic word, and the artistic word does not carry the image background.

[0097] like Figure 2 As shown, take the second prompt text "sea waves" as an example. The texture rendering model can obtain the mask image corresponding to the target text and the second eigenvector corresponding to the second prompt text. Accordingly, the texture rendering model can perform texture filling processing on the mask image based on the mask image, the preset noise matrix and the second eigenvector, through the noise fusion layer and the cross attention layer, to obtain the corresponding artistic word. Among them, the texture of the artistic word is associated with the semantic information of the second prompt text.

[0098] In this way, based on the preset texture rendering model, according to the second prompt text, the texture filling processing is performed on the inside of the outline of the target text to obtain the corresponding artistic word. It can be ensured that the texture of the artistic word is associated with the semantic information of the second prompt text, which is conducive to improving the generation effect of the artistic word.

[0099] The method for generating artistic characters provided in the above-mentioned embodiment obtains user input information, wherein the user input information includes a preset text, a first prompt text, and a second prompt text; based on a preset glyph outline deformation model, the outline of the preset text is deformed according to the first prompt text and the preset text to obtain a target text; the outline of the target text is associated with the semantic information of the first prompt text, and the outline of the target text is similar to the outline of the preset text; based on a preset texture rendering model, the inside of the outline of the target text is texture-filled according to the second prompt text to obtain the corresponding artistic characters; the texture of the artistic characters is associated with the semantic information of the second prompt text to improve the generation effect of the artistic characters.

[0100] In the case of obtaining the preset text, the glyph contour deformation model can deform the contour of the preset text according to the guidance of the first prompt text, so that the contour of the target text is associated with the contour of the preset text and the semantic information of the first prompt text. Correspondingly, the glyph contour deformation model can restrict the deformation of the contour of the preset text according to the restrictions of the preset text, so that the contour of the target text is similar to the contour of the preset text. In the case of obtaining the target text, the texture rendering model can fill the texture inside the contour of the target text according to the guidance of the second prompt text, so that the texture of the artistic word is associated with the semantic information of the second prompt text. Based on this, when the contour of the generated artistic word is associated with the semantic information of the first prompt text, and is similar to the contour of the preset text, and the texture of the artistic word is associated with the semantic information of the second prompt text, the generated artistic word meets the artistic word generation requirement indicated by the user input information. Correspondingly, the user's artistic word generation requirements for artistic words can be varied and diverse, and the computer device can implement the artistic word generation requirements through the glyph contour deformation model and the texture rendering model, and generate the corresponding artistic word, which is conducive to improving the generation effect of the artistic word.

[0101] See also Figure 3 , Figure 3 This is a schematic block diagram of a device for generating artistic characters provided in an embodiment of the present application. The device can be configured in a server or an electronic device to execute the aforementioned method for generating artistic characters.

[0102] like Figure 3 As shown, the generating device includes: an acquisition module 110 , a contour deformation module 120 and a texture rendering module 130 .

[0103] The acquisition module 110 is used to acquire user input information, where the user input information includes a preset text, a first prompt text, and a second prompt text.

[0104] The contour deformation module 120 is used to deform the contour of the preset text based on the preset glyph contour deformation module, according to the first prompt text and the preset text, to obtain a target text; the contour of the target text is associated with the semantic information of the first prompt text, and the contour of the target text is similar to the contour of the preset text.

[0105] The texture rendering module 130 is used to perform texture filling processing on the inside of the outline of the target text based on a preset texture rendering model and according to the second prompt text to obtain a corresponding artistic word; the texture of the artistic word is associated with the semantic information of the second prompt text.

[0106] It should be noted that technicians in the relevant field can clearly understand that for the convenience and simplicity of description, the specific working processes of the above-described devices and modules and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0107] The method of the present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0108] Exemplarily, the above method and apparatus may be implemented in the form of a computer program, which may be run on a computer device.

[0109] See also Figure 4 , Figure 4 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device may be a server or an electronic device.

[0110] like Figure 4 As shown, the computer device includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a storage medium and an internal memory.

[0111] The storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any method for generating artistic characters.

[0112] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.

[0113] The internal memory provides an environment for the operation of the computer program in the storage medium. When the computer program is executed by the processor, the processor can execute any method for generating artistic characters.

[0114] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0115] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0116] In one embodiment, the processor is used to execute a computer program and implement the following steps when executing the computer program:

[0117] Acquire user input information, where the user input information includes a preset text, a first prompt text, and a second prompt text;

[0118] Based on a preset glyph contour deformation model, according to the first prompt text and the preset text, the contour of the preset text is deformed to obtain a target text; the contour of the target text is associated with the semantic information of the first prompt text, and the contour of the target text is similar to the contour of the preset text;

[0119] Based on a preset texture rendering model, texture filling processing is performed on the inside of the outline of the target text according to the second prompt text to obtain a corresponding artistic word; the texture of the artistic word is associated with the semantic information of the second prompt text.

[0120] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described generation of artistic characters can refer to the corresponding process in the aforementioned embodiment of the method for generating artistic characters, and will not be repeated here.

[0121] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. The method implemented when the computer program is executed by a processor can refer to the various embodiments of the method for generating artistic characters in the present application.

[0122] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.

[0123] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0124] It should also be understood that the term "and / or" used in the specification of this application and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system including the element.

[0125] It should also be understood that the non-Company software tools or components appearing in the embodiments of the present application are merely examples and do not represent actual use.

[0126] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific implementation mode of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A method for generating an artistic word, characterized in that: include: Acquire user input information, where the user input information includes a preset text, a first prompt text, and a second prompt text; Based on a preset glyph contour deformation model, according to the first prompt text and the preset text, the contour of the preset text is deformed to obtain a target text; the contour of the target text is associated with the semantic information of the first prompt text, and the contour of the target text is similar to the contour of the preset text; Based on a preset texture rendering model, texture filling processing is performed on the inside of the outline of the target text according to the second prompt text to obtain a corresponding artistic word; the texture of the artistic word is associated with the semantic information of the second prompt text.

2. The generation method according to claim 1, characterized in that: The step of deforming the outline of the preset text based on the preset glyph outline deformation model according to the first prompt text and the preset text to obtain the target text includes: Obtaining the outline of the preset text; Performing contour discretization processing on the contour of the preset text to obtain control points corresponding to the contour; According to the first prompt text and the preset text, the position of the control point is changed to obtain the target text.

3. The generation method according to claim 2, characterized in that: The step of changing the position of the control point according to the first prompt text and the preset text to obtain the target text includes: Initializing the control points to obtain control points to be trained; Based on a preset rendering layer, rendering the control points to be trained is performed to obtain intermediate text; Based on a preset first loss function, determining a first loss value corresponding to the control point to be trained according to the intermediate text and the first prompt text; Based on a preset second loss function, determining a second loss value corresponding to the control point to be trained according to the preset text and the intermediate text; According to the first loss value and the second loss value, the position of the control point to be trained is iteratively optimized to obtain the target text.

4. The generation method according to claim 3, characterized in that: The determining, based on a preset first loss function and according to the intermediate text and the first prompt text, a first loss value corresponding to the control point to be trained includes: Based on a preset first embedding layer, embedding processing is performed on the first prompt text to obtain a first feature vector corresponding to the first prompt text; Based on a preset diffusion layer, noise prediction information is determined according to the first feature vector and the intermediate text; Substitute the intermediate text, the first feature vector, and the noise prediction information into the first loss function to obtain a first loss value.

5. The generation method according to claim 3, characterized in that: The determining, based on the preset second loss function and according to the preset text and the intermediate text, a second loss value corresponding to the control point to be trained includes: Based on a preset low-pass filter layer, low-pass filtering is performed on the preset text and the intermediate text respectively to obtain a processed preset text and a processed intermediate text; Substitute the processed preset text and the processed intermediate text into the second loss function to obtain a second loss value.

6. The generation method according to any one of claims 1 to 5, characterized in that: The method of performing texture filling processing on the inside of the outline of the target text based on the preset texture rendering model and according to the second prompt text to obtain the corresponding artistic word comprises: Obtaining a mask image corresponding to the target text; According to the second prompt text, texture filling processing is performed on the mask image to obtain corresponding artistic characters.

7. The generation method according to claim 6, characterized in that: The step of performing texture filling processing on the mask image according to the second prompt text to obtain corresponding artistic characters includes: Obtaining a preset generation condition corresponding to the mask image; Based on a preset noise fusion layer, the preset generation condition is fused with a preset noise matrix to obtain a target generation condition; Based on a preset second embedding layer, embedding processing is performed on the second prompt text to obtain a second feature vector corresponding to the second prompt text; Based on a preset cross attention layer, texture filling processing is performed on the mask image according to the target generation condition and the second feature vector to obtain corresponding artistic characters.

8. A device for generating artistic characters, characterized in that: The generating device comprises: An acquisition module, used for acquiring user input information, wherein the user input information includes a preset text, a first prompt text and a second prompt text; A contour deformation module, configured to deform the contour of the preset text based on the preset glyph contour deformation module and the first prompt text and obtain a target text; the contour of the target text is associated with the semantic information of the first prompt text, and the contour of the target text is similar to the contour of the preset text; The texture rendering module is used to perform texture filling processing on the inside of the outline of the target text based on a preset texture rendering model and according to the second prompt text to obtain corresponding artistic characters; the texture of the artistic characters is associated with the semantic information of the second prompt text.

9. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program and implement the method for generating artistic characters according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for generating artistic characters according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Deformed character dynamic typesetting rendering method and system based on parameterized shape

    CN120931477A