CN112966470A - Character generation method and device, storage medium and electronic equipment - Google Patents
Character generation method and device, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN112966470A CN112966470A CN202110203216.8A CN202110203216A CN112966470A CN 112966470 A CN112966470 A CN 112966470A CN 202110203216 A CN202110203216 A CN 202110203216A CN 112966470 A CN112966470 A CN 112966470A
- Authority
- CN
- China
- Prior art keywords
- character image
- effect
- model
- sub
- character
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/103—Formatting, i.e. changing of presentation of documents
- G06F40/109—Font handling; Temporal or kinetic typography
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/25—Fusion techniques
- G06F18/253—Fusion techniques of extracted features
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- General Engineering & Computer Science (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Evolutionary Computation (AREA)
- Evolutionary Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Bioinformatics & Computational Biology (AREA)
- Life Sciences & Earth Sciences (AREA)
- Multimedia (AREA)
- Health & Medical Sciences (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Image Analysis (AREA)
Abstract
The embodiment of the specification respectively extracts structural features of characters in an original character image and effect features of characters in a specified character image through a pre-trained character generation model. And then, fusing the structural characteristics and the effect characteristics to generate a character image with a specified character effect. In the method, after the effect characteristic in the character image with the specified character effect and the structural characteristic of the specified character are respectively extracted, the effect characteristic and the structural characteristic are fused, so that the problem that the character style in the generated character image is uncertain can be avoided. The text style comprises a text structure and a text effect.
Description
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for generating text, a storage medium, and an electronic device.
Background
Nowadays, as technology develops, more and more characters are applied. The requirements for the text style are different for different application ranges. Therefore, it is important to generate various characters.
In the prior art, after an original character image and a character image of a designated character pattern are input into a Generic Adaptive Network (GAN), the GAN is trained, and then the trained GAN is used to generate a required character image.
However, the character pattern in the character image generated by the trained GAN is uncertain due to the unstable training process of the GAN.
Disclosure of Invention
Embodiments of the present specification provide a method and an apparatus for generating a text, a storage medium, and an electronic device, so as to partially solve the problems in the prior art.
The embodiment of the specification adopts the following technical scheme:
the text generation method provided by the present specification includes:
acquiring an original character image and an appointed character image;
inputting the original character image into a first sub-model in a pre-trained character generation model, and extracting the structural characteristics of characters in the original character image through the first sub-model; inputting the appointed character image into a second sub-model in the character generation model, and extracting the effect characteristics of characters in the appointed character image through the second sub-model;
and inputting the structural characteristics and the effect characteristics into a third sub-model in the character generation model, and fusing the structural characteristics and the effect characteristics through the third sub-model to generate a character image with a specified character effect.
Optionally, the text generation model is an encoding and decoding model structure.
Optionally, the first submodel comprises: a structural feature encoder;
through the first sub-model, extracting the structural features of the characters in the original character image, specifically comprising:
and extracting the structural features of the characters in the original character image through the structural feature encoder to obtain a structural feature map of the characters in the original character image.
Optionally, the second submodel comprises: an effect feature encoder;
through the second sub-model, extracting the effect characteristics of the characters in the specified character image, and specifically comprising the following steps:
and performing effect characteristic extraction on the characters in the appointed character image through the effect characteristic encoder to obtain an effect characteristic value of the characters in the appointed character image.
Optionally, the third submodel comprises: a decoder;
through the third submodel, fusing the structural features and the effect features to generate a text image with a specified text effect, specifically including:
and fusing the structural characteristic graph and the effect characteristic value through the decoder to generate a character image with a specified character effect.
Optionally, the pre-training of the text generation model specifically includes:
acquiring an original sample character image and an appointed sample character image;
extracting the structural features of the characters in the original sample character image as structural features to be optimized through the first sub-model; extracting the effect characteristics of the characters in the appointed sample character image as the effect characteristics to be optimized through the second sub-model;
generating a character image to be optimized through the third sub-model according to the structural feature to be optimized and the effect feature to be optimized;
inputting the character image to be optimized into the first sub-model to obtain the structural characteristics of characters in the character image to be optimized, and using the structural characteristics as comparison structural characteristics; inputting the character image to be optimized into the second sub-model to obtain the effect characteristics of characters in the character image to be optimized as comparison effect characteristics;
and training the character generation model to be trained by taking the minimization of the difference between the comparison structural feature and the structural feature to be optimized and the minimization of the difference between the comparison effect feature and the effect feature to be optimized as training targets.
Optionally, the structural features include: at least one of font features of the text and font features of the text; the effect features include: at least one of color, shading, and brightness.
A character generation device provided in this specification includes:
the acquisition module is used for acquiring an original character image and an appointed character image;
the structural feature extraction module is used for inputting the original character image into a first sub-model in a pre-trained character generation model and extracting the structural features of characters in the original character image through the first sub-model;
the effect characteristic extraction module is used for inputting the specified character image into a second sub-model in the character generation model and extracting the effect characteristic of the characters in the specified character image through the second sub-model;
and the character generation module is used for inputting the structural characteristics and the effect characteristics into a third sub-model in the character generation model, and fusing the structural characteristics and the effect characteristics through the third sub-model to generate a character image with a specified character effect.
A computer-readable storage medium provided in the present specification stores a computer program that, when executed by a processor, implements the above-described character generation method.
The present specification provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the processor implements the above-mentioned character generation method.
The embodiment of the specification adopts at least one technical scheme which can achieve the following beneficial effects:
in the embodiment of the description, through a pre-trained character generation model, the structural features of characters in an original character image and the effect features of characters in a specified character image are respectively extracted. And then, fusing the structural characteristics and the effect characteristics to generate a character image with a specified character effect. In the method, after the effect characteristic in the character image with the specified character effect and the structural characteristic of the specified character are respectively extracted, the effect characteristic and the structural characteristic are fused, so that the problem that the character style in the generated character image is uncertain can be avoided. The text style comprises a text structure and a text effect.
Drawings
The accompanying drawings, which are included to provide a further understanding of the specification and are incorporated in and constitute a part of this specification, illustrate embodiments of the specification and together with the description serve to explain the specification and not to limit the specification in a non-limiting sense. In the drawings:
fig. 1 is a schematic diagram of a text generation flow provided in an embodiment of the present specification;
fig. 2 is a schematic structural diagram of text generation provided in an embodiment of the present specification;
3 a-3 c are schematic diagrams of the generation of the designated text effect provided by the embodiments of the present specification;
fig. 4 is a schematic structural diagram of a text generation apparatus provided in an embodiment of the present specification;
fig. 5 is a schematic structural diagram of an electronic device provided in an embodiment of this specification.
Detailed Description
The text generation method provided by the specification aims to separate the structural features and the effect features of the text in the text image, and then fuse the required structural features and the required effect features according to actual requirements to obtain the required text image.
In order to make the objects, technical solutions and advantages of the present disclosure more clear, the technical solutions of the present disclosure will be clearly and completely described below with reference to the specific embodiments of the present disclosure and the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present disclosure, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present specification without any creative effort belong to the protection scope of the present specification.
The technical solutions provided by the embodiments of the present description are described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic diagram of a text generation flow provided in an embodiment of the present specification, including:
s100: and acquiring an original character image and an appointed character image.
In the embodiments of the present specification, an original character image refers to a character image that needs to be subjected to effect conversion, and a designated character image refers to a character image having a designated character effect. The characters in the character image comprise character structures and character effects. Wherein, the literal structure includes: font types and fonts. The character effect comprises the following steps: color, shading, brightness, etc.
S102: and inputting the original character image into a first sub-model in a pre-trained character generation model, and extracting the structural characteristics of characters in the original character image through the first sub-model.
In the embodiment of the present specification, the character generation model needs to be trained first, and the trained character generation model can generate a character image with a specified character effect. Wherein, the character generation model is a coding and decoding model structure, comprising: a first submodel, a second submodel, and a third submodel. The first submodel and the second submodel are encoders, and the third submodel is a decoder.
In particular, the first submodel includes a structural feature encoder. The structural feature encoder is used for extracting structural features of characters in the original character image. And inputting the original character image into the first sub-model, and extracting the structural features of the characters in the original character image through a structural feature encoder to obtain a structural feature graph of the characters in the original character image. In addition, the first submodel further includes: a first effect feature encoder. The first effect characteristic encoder is used for extracting effect characteristics of characters in the original character image. When there are two encoders in the first submodel, the structural feature encoder is also referred to as a first structural feature encoder.
Further, in order to better extract the structural feature map of the characters in the original character image, binarization processing may be performed on the obtained original character image. And then, inputting the processed original character image into a first sub-model in a pre-trained character generation model, and extracting the structural characteristics of the characters in the processed original character image through the first sub-model.
S104: and inputting the appointed character image into a second sub-model in the character generation model, and extracting the effect characteristics of the characters in the appointed character image through the second sub-model.
In an embodiment of the present specification, the second submodel in the text generation model comprises an effect feature encoder. The effect characteristic encoder is used for extracting the effect characteristics of the characters in the specified character image. Specifically, the specified character image is input into the second submodel, and the effect feature extraction is performed on the characters in the specified character image through the effect feature encoder to obtain the effect feature value of the characters in the specified character image. Wherein the effect feature may be a color feature, a shading feature, or the like.
In addition, the second submodel further includes: and a second structural feature encoder. The second structural feature encoder is used for extracting structural features of characters in the specified character image. When there are two encoders for the second submodel, the effect feature encoder is also called the second effect feature encoder.
It should be noted that the step S102 and the step S104 are not in sequence.
S106: and inputting the structural characteristics and the effect characteristics into a third sub-model in the character generation model, and fusing the structural characteristics and the effect characteristics through the third sub-model to generate a character image with a specified character effect.
In the embodiment of the present specification, the third sub-model in the text generation model is a decoder. And inputting the structural feature map and the effect feature value obtained in the steps S102 to S104 into a third sub-model, fusing the structural feature map and the effect feature value through a decoder, and finally generating a character image with the same character effect as that of the specified character image.
Specifically, the decoder includes: and (5) a normalization layer. And after the structural feature graph is input into the normalization layer, processing the structural feature graph by taking the effect feature value as the normalized mean variance of the normalization layer so as to fuse the structural feature graph and the effect feature value.
As can be seen from the method shown in fig. 1, the present specification extracts the structural features of the characters in the original text image and the effect features of the characters in the designated text image respectively through the pre-trained character generation model. And then, fusing the structural characteristics and the effect characteristics to generate a character image with a specified character effect. In the method, after the effect characteristic in the character image with the specified character effect and the structural characteristic of the specified character are respectively extracted, the effect characteristic and the structural characteristic are fused, so that the problem that the character style in the generated character image is uncertain can be avoided. The text style comprises a text structure and a text effect.
Further, according to the description of the character generation model in steps S100 to S106 shown in fig. 1, the embodiment of the present specification provides a schematic structural diagram of the character generation model, as shown in fig. 2. In fig. 2, the first sub-model includes a first structural feature encoder and a first effect feature encoder, and the second sub-model includes a second structural feature encoder and a second effect feature encoder. The original character image is input into a first structural characteristic encoder to obtain a structural characteristic diagram. And meanwhile, inputting the appointed character image into a second effect characteristic encoder to obtain an effect characteristic value. Then, the structure characteristic diagram and the effect characteristic value are input into a decoder to generate the character image which has the character structure of the original character image and the character effect of the appointed character image.
A character image for generating a specified character effect will be described by way of example based on the character generation model shown in fig. 2 and the character generation method shown in fig. 1. As shown in fig. 3 a-3 c.
In fig. 3a, a "large" digital image of a black chinese amber is used as an original text image, and a "small" digital image of a chinese running script with colors and shadows is used as a designated text image. Inputting the original text image into the first sub-model to obtain the structural feature diagram of the original text image, as shown in fig. 3 b. And inputting the appointed character image into the second submodel to obtain the effect characteristic value of the appointed character image. Then, the effect feature value and the structural feature map are input into the third submodel, so as to obtain a character image with a specified character effect, as shown in fig. 3 c.
The above mainly describes the application process of the character generation model, and the generation of the character generation model cannot be separated from the training of the model. Next, a description will be given mainly of a training process of the character generation model.
Specifically, an original sample text image and a specified sample text image are obtained first. And then, inputting the original sample character image into a first sub-model of the character generation model to be trained, and extracting the structural characteristics of the characters in the original sample character image as the structural characteristics to be optimized through the first sub-model. And simultaneously, inputting the appointed sample character image into a second sub-model of the character generation model to be trained, and extracting the effect characteristics of the characters in the appointed sample character image as the effect characteristics to be optimized through the second sub-model. And then, inputting the structural features to be optimized and the effect features to be optimized into a third submodel of the character generation model to be trained, and generating the character image to be optimized through the third submodel. And then, inputting the character image to be optimized into the first sub-model to obtain the structural characteristics of the characters in the character image to be optimized, and taking the structural characteristics as comparison structural characteristics. And simultaneously, inputting the character image to be optimized into a second sub-model to obtain the effect characteristics of the characters in the character image to be optimized as comparison effect characteristics. And finally, training the character generation model to be trained by taking minimization of the difference between the comparison structural feature and the structural feature to be optimized and minimization of the difference between the comparison effect feature and the effect feature to be optimized as training targets.
In addition to the above method for training a character generation model, the method for training a character generation model further includes: and inputting the acquired original sample character image into a first sub-model of the character generation model to be trained to obtain the structural feature to be optimized. And simultaneously, inputting the acquired appointed original sample character image into a second sub-model of the character generation model to be trained to obtain the effect characteristics to be optimized. And inputting the structural features to be optimized and the effect features to be optimized into a third sub-model of the character generation model to be trained to generate a character image to be optimized. And training the character generation model to be trained by taking the minimum difference between the marked character image and the character image to be optimized as a training target.
Based on the same idea, the present specification further provides a corresponding apparatus, a storage medium, and an electronic device.
Fig. 4 is a schematic structural diagram of a text generation apparatus provided in an embodiment of the present specification, where the apparatus includes:
an obtaining module 401, configured to obtain an original text image and an appointed text image;
a structural feature extraction module 402, configured to input the original text image into a first sub-model in a pre-trained text generation model, and extract structural features of the text in the original text image through the first sub-model;
an effect feature extraction module 403, configured to input the specified text image into a second sub-model in the text generation model, and extract an effect feature of a text in the specified text image through the second sub-model;
and the character generation module 404 is configured to input the structural features and the effect features into a third sub-model in the character generation model, and fuse the structural features and the effect features through the third sub-model to generate a character image with a specified character effect.
Optionally, the text generation model is an encoding and decoding model structure.
Optionally, the first submodel comprises: a structural feature encoder; the structural feature extraction module 402 is specifically configured to perform structural feature extraction on the characters in the original character image through the structural feature encoder to obtain a structural feature map of the characters in the original character image.
Optionally, the second submodel comprises: an effect feature encoder; the effect feature extraction module 403 is specifically configured to perform effect feature extraction on the characters in the designated character image through the effect feature encoder to obtain an effect feature value of the characters in the designated character image.
Optionally, the third submodel comprises: a decoder; the text generating module 404 is specifically configured to fuse the structural feature map and the effect feature value through the decoder to generate a text image with a specified text effect.
In addition to the above-mentioned acquisition module 401, structural feature extraction module 402, effect feature extraction module 403, and text generation module 404, the apparatus further includes:
a training module 405, configured to obtain an original sample text image and an appointed sample text image; extracting the structural features of the characters in the original sample character image as structural features to be optimized through the first sub-model; extracting the effect characteristics of the characters in the appointed sample character image as the effect characteristics to be optimized through the second sub-model; generating a character image to be optimized through the third sub-model according to the structural feature to be optimized and the effect feature to be optimized; inputting the character image to be optimized into the first sub-model to obtain the structural characteristics of characters in the character image to be optimized, and using the structural characteristics as comparison structural characteristics; inputting the character image to be optimized into the second sub-model to obtain the effect characteristics of characters in the character image to be optimized as comparison effect characteristics; and training the character generation model to be trained by taking the minimization of the difference between the comparison structural feature and the structural feature to be optimized and the minimization of the difference between the comparison effect feature and the effect feature to be optimized as training targets.
The present specification also provides a computer-readable storage medium storing a computer program, which when executed by a processor is operable to perform the text generation method provided in fig. 1 above.
Based on the prediction method of the motion trajectory shown in fig. 1, the embodiment of the present specification further provides a schematic structural diagram of the unmanned device shown in fig. 5. As shown in fig. 5, the drone includes, at the hardware level, a processor, an internal bus, a network interface, a memory, and a non-volatile memory, although it may also include hardware required for other services. The processor reads a corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to implement the text generation method described in fig. 1.
Of course, besides the software implementation, the present specification does not exclude other implementations, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may be hardware or logic devices.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Hardware Description Language), traffic, pl (core universal Programming Language), HDCal (jhdware Description Language), lang, Lola, HDL, laspam, hardward Description Language (vhr Description Language), vhal (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the various elements may be implemented in the same one or more software and/or hardware implementations of the present description.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The description has been presented with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the description. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, 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 disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
This description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present specification, and is not intended to limit the present specification. Various modifications and alterations to this description will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification should be included in the scope of the claims of the present specification.
Claims (10)
1. A method for generating a word, comprising:
acquiring an original character image and an appointed character image;
inputting the original character image into a first sub-model in a pre-trained character generation model, and extracting the structural characteristics of characters in the original character image through the first sub-model; inputting the appointed character image into a second sub-model in the character generation model, and extracting the effect characteristics of characters in the appointed character image through the second sub-model;
and inputting the structural characteristics and the effect characteristics into a third sub-model in the character generation model, and fusing the structural characteristics and the effect characteristics through the third sub-model to generate a character image with a specified character effect.
2. The method of claim 1, wherein the text generation model is a codec model structure.
3. The method of claim 2, wherein the first submodel comprises: a structural feature encoder;
through the first sub-model, extracting the structural features of the characters in the original character image, specifically comprising:
and extracting the structural features of the characters in the original character image through the structural feature encoder to obtain a structural feature map of the characters in the original character image.
4. The method of claim 3, wherein the second submodel comprises: an effect feature encoder;
through the second sub-model, extracting the effect characteristics of the characters in the specified character image, and specifically comprising the following steps:
and performing effect characteristic extraction on the characters in the appointed character image through the effect characteristic encoder to obtain an effect characteristic value of the characters in the appointed character image.
5. The method of claim 4, wherein the third submodel comprises: a decoder;
through the third submodel, fusing the structural features and the effect features to generate a text image with a specified text effect, specifically including:
and fusing the structural characteristic graph and the effect characteristic value through the decoder to generate a character image with a specified character effect.
6. The method of any one of claims 1 to 5, wherein pre-training the text generation model specifically comprises:
acquiring an original sample character image and an appointed sample character image;
extracting the structural features of the characters in the original sample character image as structural features to be optimized through the first sub-model; extracting the effect characteristics of the characters in the appointed sample character image as the effect characteristics to be optimized through the second sub-model;
generating a character image to be optimized through the third sub-model according to the structural feature to be optimized and the effect feature to be optimized;
inputting the character image to be optimized into the first sub-model to obtain the structural characteristics of characters in the character image to be optimized, and using the structural characteristics as comparison structural characteristics; inputting the character image to be optimized into the second sub-model to obtain the effect characteristics of characters in the character image to be optimized as comparison effect characteristics;
and training the character generation model to be trained by taking the minimization of the difference between the comparison structural feature and the structural feature to be optimized and the minimization of the difference between the comparison effect feature and the effect feature to be optimized as training targets.
7. The method of claim 1, wherein the structural features comprise: at least one of font features of the text and font features of the text;
the effect features include: at least one of color, shading, and brightness.
8. A character generation apparatus, comprising:
the acquisition module is used for acquiring an original character image and an appointed character image;
the structural feature extraction module is used for inputting the original character image into a first sub-model in a pre-trained character generation model and extracting the structural features of characters in the original character image through the first sub-model;
the effect characteristic extraction module is used for inputting the specified character image into a second sub-model in the character generation model and extracting the effect characteristic of the characters in the specified character image through the second sub-model;
and the character generation module is used for inputting the structural characteristics and the effect characteristics into a third sub-model in the character generation model, and fusing the structural characteristics and the effect characteristics through the third sub-model to generate a character image with a specified character effect.
9. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements the method of any of the preceding claims 1-7.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1-7 when executing the program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110203216.8A CN112966470A (en) | 2021-02-23 | 2021-02-23 | Character generation method and device, storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110203216.8A CN112966470A (en) | 2021-02-23 | 2021-02-23 | Character generation method and device, storage medium and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112966470A true CN112966470A (en) | 2021-06-15 |
Family
ID=76285777
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110203216.8A Pending CN112966470A (en) | 2021-02-23 | 2021-02-23 | Character generation method and device, storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112966470A (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103810739A (en) * | 2014-02-20 | 2014-05-21 | 南京师范大学 | Image character morphing animation generating method |
CN109285111A (en) * | 2018-09-20 | 2019-01-29 | 广东工业大学 | A kind of method, apparatus, equipment and the computer readable storage medium of font conversion |
CN109815448A (en) * | 2019-02-02 | 2019-05-28 | 天津字节跳动科技有限公司 | Lantern slide generation method and device |
CN112307714A (en) * | 2020-11-03 | 2021-02-02 | 武汉理工大学 | Character style migration method based on double-stage deep network |
-
2021
- 2021-02-23 CN CN202110203216.8A patent/CN112966470A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103810739A (en) * | 2014-02-20 | 2014-05-21 | 南京师范大学 | Image character morphing animation generating method |
CN109285111A (en) * | 2018-09-20 | 2019-01-29 | 广东工业大学 | A kind of method, apparatus, equipment and the computer readable storage medium of font conversion |
CN109815448A (en) * | 2019-02-02 | 2019-05-28 | 天津字节跳动科技有限公司 | Lantern slide generation method and device |
CN112307714A (en) * | 2020-11-03 | 2021-02-02 | 武汉理工大学 | Character style migration method based on double-stage deep network |
Non-Patent Citations (1)
Title |
---|
YEXUN ZHANG等: "Separating Style and Content for Generalized Style Transfer", 《2018 IEEE/CVF CONFERENCE ON COMPUTER VISION AND PATTERN RECOGNITION》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN116188632A (en) | Image generation method and device, storage medium and electronic equipment | |
CN114332873A (en) | Training method and device for recognition model | |
CN114861665B (en) | Method and device for training reinforcement learning model and determining data relation | |
CN115600157A (en) | Data processing method and device, storage medium and electronic equipment | |
CN108519986B (en) | Webpage generation method, device and equipment | |
CN112949642B (en) | Character generation method and device, storage medium and electronic equipment | |
CN116863484A (en) | Character recognition method, device, storage medium and electronic equipment | |
CN112966470A (en) | Character generation method and device, storage medium and electronic equipment | |
CN115017915B (en) | Model training and task execution method and device | |
CN116186231A (en) | Method and device for generating reply text, storage medium and electronic equipment | |
CN115130621A (en) | Model training method and device, storage medium and electronic equipment | |
CN111539520A (en) | Method and device for enhancing robustness of deep learning model | |
CN114154579A (en) | Image classification method and device, storage medium and electronic equipment | |
CN113343716B (en) | Multilingual translation method, device, storage medium and equipment | |
CN109325127B (en) | Risk identification method and device | |
CN111539962A (en) | Target image classification method, device and medium | |
CN111898615A (en) | Feature extraction method, device, equipment and medium of object detection model | |
CN113344590A (en) | Method and device for model training and complaint rate estimation | |
CN111899264A (en) | Target image segmentation method, device and medium | |
CN112950732B (en) | Image generation method and device, storage medium and electronic equipment | |
CN111753661B (en) | Target identification method, device and medium based on neural network | |
CN115423485B (en) | Data processing method, device and equipment | |
CN113011424A (en) | Training sample generation method and device | |
CN114283312A (en) | Model training method and device, storage medium and electronic equipment | |
CN107391489B (en) | Text analysis method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20210615 |