Image generation method and device

By providing basic images, text content and layout information to the image generation model, and generating sample images with controllable content information, the problem of insufficient sample images in the prior art is solved, and the training quality of text recognition models is improved.

CN119625133APending Publication Date: 2025-03-14ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The prior art is difficult to generate sample images with controllable and diverse content information for training text recognition models, especially when privacy protection and other conditions are restricted.

Method used

By providing the image generation model with a specific basic image, several text contents and layout information of the text content in the basic image, the pre-trained image generation model processes the input information to generate a sample image with controllable content information.

Benefits of technology

It realizes the generation of sample images with controllable and diverse content information, meets the diverse needs of text recognition models, and improves the quality and controllability of sample images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119625133A_ABST
    Figure CN119625133A_ABST
Patent Text Reader

Abstract

The invention discloses an image generation method and device. The method comprises the following steps: acquiring a plurality of first text contents for generating an image; obtaining first layout information of the plurality of first text contents in the basic image; input information is processed through a pre-trained image generation model, a generated image is obtained, the input information at least comprises the multiple first text contents, the first layout information and the basic image, and the generated image can serve as a sample image used for training a target text recognition model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present specification belong to the field of computer technology, and more particularly, to an image generation method and device. Background Art

[0002] In order to achieve certain business goals, users may expect to obtain a large number of sample images that meet certain conditions. For example, they may expect to obtain a text recognition model applied to a specific technical scenario, which can perform text recognition on relevant target images and extract text content from the target images. In actual technical scenarios, it may be difficult for users to obtain sample images that meet relevant conditions for training text recognition models due to privacy protection or other restrictions.

[0003] You can use image templates or deep learning-based image generation models to generate images that will be used as sample images. The sample images obtained based on image templates have similar styles and cannot meet the diverse needs of text recognition models for sample images; while the sample images obtained through image generation models cannot ensure the controllability of the content information contained in the sample images.

[0004] It is hoped that a new technical solution can be developed to more efficiently obtain sample images with controllable content information. Summary of the invention

[0005] The object of the present invention is to provide an image generating method and device.

[0006] In a first aspect, an image generation method is provided, the method comprising: obtaining a number of first text contents for generating an image; obtaining first layout information of the number of first text contents in a basic image; processing input information using a pre-trained image generation model to obtain a generated image, the input information comprising at least the number of first text contents, the first layout information and the basic image.

[0007] In a second aspect, an image generating device is provided, comprising: a text acquiring unit, used to acquire a number of first text contents for generating an image; a layout acquiring unit, used to acquire first layout information of the number of first text contents in a basic image; and a model calling unit, used to process input information using a pre-trained image generation model to obtain a generated image, wherein the input information includes at least the number of first text contents, the first layout information and the basic image.

[0008] In a third aspect, a computing device is provided, comprising a memory and a processor, wherein the memory stores a computer program / instructions, and when the processor executes the computer program / instructions, the method described in the first aspect is implemented.

[0009] According to a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed in a computing device, the computing device executes the method described in the first aspect.

[0010] In the technical solution provided in the embodiments of this specification, the input information provided to the image generation model includes a specific basic image, a number of text contents expected to be carried in the generated image, and layout information of the several text contents in the basic image, which is conducive to the image generation model to generate images in a more controllable manner according to the content information generated corresponding to the input information, that is, it is possible to more efficiently obtain sample images with controllable content information that can be used to train relevant text recognition models. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0012] Figure 1 A schematic diagram of a technical scenario of the technical solution provided in the embodiments of this specification;

[0013] Figure 2 A flowchart of an image generation method provided in an embodiment of this specification;

[0014] Figure 3 A schematic diagram of a process for generating a certificate image provided exemplarily in an embodiment of this specification;

[0015] Figure 4 A schematic diagram of the process of generating an image for exemplary processing is provided;

[0016] Figure 5 It is a structural schematic diagram of an image generating device provided in an embodiment of this specification. DETAILED DESCRIPTION

[0017] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.

[0018] Figure 1This is a technical scenario diagram of the technical solution provided in the embodiments of this specification. Figure 1 As shown, due to the need to achieve certain specific business purposes, users may expect to obtain a large number of sample images that meet certain conditions. For example, it may be expected to obtain a text recognition model applied to a specific technical scenario, and the text recognition model can perform text recognition on the relevant target image to extract text content from the target image; in this case, it is necessary to obtain a large number of sample images that can train the text recognition model. For example, a user may expect to obtain and use a large number of sample document images related to a certain document (such as an ID card, passport, or driver's license, etc.), and train a text recognition model for text recognition of the target image corresponding to the document; for another example, a user may expect to obtain a large number of sample invoice images related to invoices, and train a text recognition model for text recognition of the target image corresponding to the invoice. In actual technical scenarios, it may be difficult for users to obtain sample images that meet relevant conditions for training text recognition models due to privacy protection or other restrictions.

[0019] With the rapid development of deep learning technology, a variety of image generation models have gradually emerged. The input information of some image generation models, such as Stable Diffusion, may include prompt text and / or prompt image. Users can adjust the prompt text and / or prompt image in the input information so that the image generation model can output a large number of generated images with diverse styles. These generated images can be used as sample images for training related text recognition models. However, when generating generated images to be used as sample images based on image generation models, it is difficult to ensure the controllability of the content information actually contained in the generated images. The generated images often have problems such as distorted results, disordered layouts, and errors in text content. Moreover, due to the low controllability of the content information of the sample images, it may also have a negative impact on the performance of the text recognition model to be trained.

[0020] In the embodiments of this specification, at least one method, apparatus, computing device and computer-readable storage medium for generating an image are provided. The input information provided to the image generation model includes a specific basic image, a number of text contents expected to be carried in the generated image, and layout information of the text contents in the basic image, which is conducive to the image generation model to generate images more controllably according to the content information generated corresponding to the input information, that is, it is possible to more efficiently obtain sample images with controllable content information and capable of being used to train relevant text recognition models, thereby facilitating more efficient training of relevant text recognition models.

[0021] Figure 2 This is a flowchart of an image generation method provided in an embodiment of this specification.

[0022] The method may be executed by any device, platform, equipment or equipment cluster having computing / processing capabilities.

[0023] Reference Figure 2 As shown, the method may include but is not limited to part or all of the following steps S201 to S207.

[0024] Step S201: Acquire a plurality of first text contents for generating an image.

[0025] The aforementioned first text contents may be user-defined, and may generally be determined according to the target object corresponding to the generated image to be obtained. For example, when the target object corresponding to the generated image to be obtained is an invoice, multiple first text contents corresponding to keywords such as "seller", "buyer", "password area", "amount", and "tax rate" may be obtained.

[0026] The following mainly describes illustratively by taking the example that the generated image is a certificate image corresponding to a certain type of certificate.

[0027] Reference Figure 3 As shown, the first text contents may include but are not limited to: the first text content corresponding to the keyword "name", such as "Name Wang XX", the first text content corresponding to the keyword "birth", such as "Birth Year X Month X Day", the first text content corresponding to the keyword "address", such as "Address X Province X City X Town X Village X Group", and the first text content corresponding to the keyword "ID number", such as "ID number XXXXXX23456789".

[0028] Step S203: obtaining first layout information of a plurality of first text contents in a basic image.

[0029] The aforementioned basic image can be determined according to the target object corresponding to the desired generated image. It should be particularly noted that the first layout information can be used to indicate the position information of each of the first text contents in the basic image.

[0030] Continuing with the previous example, the aforementioned basic image may be a background image corresponding to a certain certificate and does not carry any text content.

[0031] A pre-trained text detection model can be used to process a standard image corresponding to a desired generated image to obtain first position information of several text areas in the standard image; based on the first position information, first layout information of several first text contents in a basic image is determined, and the standard image and the basic image have the same image size.

[0032] Continuing with the previous example, please continue to refer to Figure 3As shown, multiple first text contents corresponding to multiple keywords such as "name", "birth", "address" and "document number" should be carried in a certain document, and usually have a relatively fixed position in the document. Therefore, in the specified standard document image, for example, the third text content corresponding to the keyword "name" such as "name Lu XX", the third text content corresponding to the keyword "birth" such as "birth X year X month X day", the third text content corresponding to the keyword "address" such as "address X province X city X town X village X group", and the third text content corresponding to the keyword "document number" such as "document number XXXXXX12345678" can be carried. When the standard document image is processed by the text detection model, the text areas in the standard image corresponding to each third text content can be marked in the standard document image, thereby obtaining the first position information of multiple text areas in the standard document image.

[0033] Referring to the above example, there is a correspondence between a number of first text contents and a number of third text contents carried in the standard image, that is, there are first text contents and third text contents corresponding to the same keyword. Therefore, for any first text content, we expect to determine the third text content corresponding to the same keyword as the first text content, and use the position of the text area corresponding to the third text content in the standard image as the position information of the first text content in the basic image.

[0034] In a possible implementation, the first position information and the plurality of first text contents may be matched to obtain the first layout information based on the pre-known arrangement rules of the plurality of text areas corresponding to the plurality of third text contents in the standard image. Alternatively, in another possible implementation, the first layout information may be obtained by using a pre-trained layout information generation model to process the first position information of the plurality of first text contents and the plurality of text areas in the standard image.

[0035] The target object corresponding to the desired generated image will also carry several text contents corresponding to several keywords, and the text contents corresponding to the aforementioned several keywords will also have relatively fixed positions on the target object; and the subsequent process of obtaining the generated image through the image generation model is essentially a process of simulating the real image captured by the image acquisition unit for the target object. Therefore, it is also possible to predetermine the first layout information of several first text contents in the basic image according to several keywords corresponding to the several first text contents without using a standard image.

[0036] The data form of the first layout information can be text or image. For example, the position information of each of the first text contents in the basic image can be described in the form of text; or according to the position information of each of the first text contents in the basic image, the first texts can be added to a blank image with the same image size as the basic image to obtain a corresponding auxiliary image, and the auxiliary image can indicate the position information of each of the first text contents in the basic image.

[0037] Step S205: obtaining character features of a plurality of first text contents in the basic image.

[0038] In a possible implementation, a pre-trained character feature recognition model can be used to process a standard image corresponding to a desired generated image to obtain character features of the first text content in the base image. Alternatively, the relationship between the image size of the base image and the object size of the target object, as well as the character features of the text content carried by the target object on the target object, can be obtained to determine the character features of the first text content in the base image.

[0039] The aforementioned character features may include but are not limited to font type, character spacing, character size information, and the like.

[0040] Step S207, using a pre-trained image generation model to process input information to obtain a generated image, wherein the input information at least includes a plurality of first text contents, first layout information and a basic image.

[0041] It should be particularly noted that when the generated image involves a person image region, the base image and the generated image may indicate the position of the person image region through corresponding patterns and include the person image region corresponding to the real person.

[0042] In order to obtain sample images of various styles, the input information may also include the environment information corresponding to the desired generated image. The aforementioned environment information may include, but is not limited to, one or more of the following information: lighting angle, lighting intensity, shooting angle, shooting distance, description information of the background image area outside the mother package image area corresponding to the target object, etc.

[0043] Some image generation models including Stable Diffusion can process multimodal input information, that is, the input information may include multiple types of data such as prompt text and prompt image at the same time. The data form of the first layout information in the above example can be text or image. Therefore, in the input information of the input image generation model, the prompt text may include several first text contents, first layout information, and environmental information, etc., and the prompt image includes a basic image; or the prompt text may include several first text contents and environmental information, etc., and the prompt image includes a basic image and a corresponding auxiliary image.

[0044] The generated image output by the image generation model usually contains the target image area corresponding to the target object and the background image area. Figure 3 As shown, when the generated image is a document image corresponding to a certain document, the document image substantially includes a document image area corresponding to the document, and may also include a background image area.

[0045] When the generated image is obtained by processing the input information using the image generation model through the aforementioned steps S201 to S207, the environmental information, the basic image, the first text contents and their layout information in the basic image can constrain the content information contained in the target image area and the background image area corresponding to the target object in the generated image, which is conducive to obtaining a generated image that better meets the user's expectations, that is, a generated image with controllable content information can be obtained more efficiently.

[0046] The generated image obtained by step S207 can be directly used as a sample image for training the relevant text recognition model. Alternatively, in order to ensure the quality of the sample image used to train the target text recognition model, so as to use the high-quality generated image as the sample image for training the target text recognition model, thereby training a target text recognition model with better performance, on the basis of the above steps S201 to S207, refer to Figure 4 As shown, part or all of the following steps S209 to S223 may also be executed.

[0047] Step S209, determining a plurality of second text contents carried by the generated image.

[0048] Various public text recognition models can be used to process the generated image to obtain the second text content carried by the generated image. Public text recognition models include Tesseract, OCRopus, Kraken, Cuneiform, etc. Alternatively, the second text content carried by the generated image can be determined by manual labeling.

[0049] Step S211: determining a first similarity between a plurality of first text contents and a plurality of second text contents.

[0050] The plurality of first text contents may be regarded as a text object, and the plurality of second text contents may be regarded as a text object, and the similarity of the two text objects may be directly calculated and used as the first similarity. Alternatively, for any i-th first text content among the plurality of first text contents, the similarity between the i-th first text content and the i-th second text content may be calculated, and then the first similarity may be determined based on the plurality of calculated similarities, for example, the average value of the plurality of calculated similarities may be determined as the first similarity between the plurality of first text contents and the plurality of second text contents.

[0051] Step S213, determining whether the first similarity is less than a first preset threshold, if so, executing step S223.

[0052] The text recognition accuracy of the disclosed text recognition model may be relatively low in some specific technical scenarios, and the recognized second text contents may not be completely the same as the text contents actually carried by the generated image. However, the similarity between the recognized second text contents and the text contents actually carried by the generated image is still relatively large. Therefore, here, the first similarity between the second text contents and the first text contents can be calculated to approximate the similarity between the first text contents and the text contents actually carried by the generated image; and then the relationship between the first similarity and the first preset value can be used to predict whether the generated image carries the first text contents that the user expects to carry in the generated image. More specifically, if the first similarity is less than the first preset threshold, it means that the generated image may not carry the first text contents that the user expects to carry in the generated image, and the generated image does not meet the user's expectations. The quality may be relatively low, and it may be difficult to meet the training requirements of the target text recognition model in the subsequent process. It cannot be directly used as a sample image for training the relevant text recognition model, and a new generated image that meets the user's expectations needs to be regenerated based on the same input information.

[0053] Step S215, using the pre-trained text detection model to process the generated image, and obtain second position information of several text regions in the generated image.

[0054] Step S217: determining second layout information of a plurality of second text contents in the generated image according to the second position information.

[0055] The process of obtaining the second layout information can refer to the process of obtaining the first layout information, which will not be described in detail here. In addition, similar to the first layout information, the second layout information is used to indicate the position information of the second text content in the generated image.

[0056] Step S219: determining a second similarity between the first layout information and the second layout information.

[0057] The second similarity can be calculated by using a process similar to that of calculating the first similarity, which will not be described in detail here.

[0058] Step S221, determining whether the second similarity is less than a second preset threshold, if so, executing step S223.

[0059] Based on a similar principle, if the second similarity is less than the second preset threshold, it means that the positions of the text contents actually carried by the generated image may not meet the user's expectations, the quality may be relatively low, and it may be difficult to meet the training requirements of the target text recognition model in the subsequent process. It cannot be used as a sample image for training the target text image, and a new generated image that meets the user's expectations needs to be regenerated based on the same input information.

[0060] Step S223, triggering the image generation model to generate a new generated image based on the input information.

[0061] Through the technical solution provided in the embodiments of this specification, by configuring environmental information in the input information of the image generation model, the style diversity of the generated image can be enriched; at the same time, by explicitly introducing the character features and layout information of the text content expected to be carried in the generated image, the controllability of the content information in the generated image can be increased. In addition, a post-processing mechanism is introduced. The generated image will only end the generation process and be used as a sample image if the text content and the layout of the text content meet the requirements, which is conducive to ensuring the quality of the sample images used to train the text recognition model, so as to efficiently train a text recognition model with better performance.

[0062] Based on the same concept as the above method embodiment, this specification also provides an image generating device 500. Figure 5 As shown, the image generating device 500 includes: a text acquiring unit 501, used to acquire a number of first text contents for generating an image; a layout acquiring unit 503, used to acquire first layout information of the number of first text contents in a basic image; a model calling unit 505, used to process input information using a pre-trained image generation model to obtain a generated image, wherein the input information at least includes the number of first text contents, the first layout information and the basic image.

[0063] The embodiments of the present specification also provide a computer-readable storage medium on which a computer program / instruction is stored. When the computer program / instruction is executed in a computer, the computer is caused to execute the methods described in the aforementioned embodiments.

[0064] A computing device is also provided in an embodiment of the present specification, including a memory and a processor, wherein the memory stores a computer program / instruction, and when the processor executes the computer program / instruction, the method described in the above embodiments is implemented.

[0065] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0066] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.

[0067] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a server system. Of course, the present application does not exclude that with the development of computer technology in the future, the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular phone, a camera phone, a smart phone, 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.

[0068] Although one or more embodiments of the present specification provide method operation steps as described in the embodiments or flow charts, more or less operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps, and does not represent the only execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or equipment including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such a process, method, product or equipment. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or equipment including the elements. For example, if the words first, second, etc. are used to represent the name, they do not represent any specific order.

[0069] For the convenience of description, the above devices are described in various modules according to their functions. Of course, when implementing one or more of the present specification, the functions of each module can be implemented in the same or more software and / or hardware, or the module implementing the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0070] The present invention is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0071] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0072] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

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

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

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

[0076] It should be understood by those skilled in the art that one or more embodiments of the present specification may be provided as a method, system or computer program product. Therefore, one or more embodiments of the present specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, one or more embodiments of the present specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0077] One or more embodiments of the present specification may 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. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0078] Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. In the description of this specification, the description of the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representation of the above terms does not necessarily target the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, in the absence of mutual contradiction, a person skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.

[0079] The above description is only an example of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. For those skilled in the art, one or more embodiments of the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims.

Claims

1. A method for generating an image, the method comprising: Acquire a plurality of first text contents for generating an image; Acquire first layout information of the plurality of first text contents in the basic image; The input information is processed using a pre-trained image generation model to obtain a generated image, wherein the input information at least includes the plurality of first text contents, the first layout information, and the basic image. 2 . The method according to claim 1 , wherein the input information further comprises environment information corresponding to the generated image.

3. According to the method of claim 1, the generated image will be used as a sample image for training a text recognition model. The method according to claim 1 , wherein the generated image is a document image.

5. According to the method of claim 1, the step of obtaining first layout information of the plurality of first text contents in the basic image comprises: Processing a standard image corresponding to the generated image using a pre-trained text detection model to obtain first position information of a plurality of text regions in the standard image in the standard image; First layout information of the plurality of first text contents in the basic image is determined according to the first position information, wherein the standard image and the basic image have the same image size.

6. The method according to claim 5, wherein determining first layout information of the plurality of first text contents in the basic image according to the first position information comprises: The first position information and the plurality of first text contents are processed by using a pre-trained layout information generation model to obtain the first layout information.

7. The method according to claim 1, further comprising: Obtaining character features of the plurality of first text contents in the basic image; wherein the input information also includes the character features.

8. The method according to claim 7, wherein obtaining character features of the plurality of first text contents in the base image comprises: The character features of the plurality of first text contents in the basic image are obtained by processing a standard image corresponding to the generated image through a pre-trained character feature recognition model. 9 . The method according to claim 1 , wherein the first layout information comprises position information of each of the plurality of first text contents in the base image.

10. The method according to any one of claims 1 to 9, further comprising: Determining a plurality of second text contents carried by the generated image; Determining a first similarity between the plurality of first text contents and the plurality of second text contents; When the first similarity is less than a first preset threshold, the image generation model is triggered to generate a new generated image based on the input information.

11. The method according to claim 10, further comprising: Processing the generated image using a pre-trained text detection model to obtain second position information of a plurality of text regions in the generated image in the generated image; Determining second layout information of the plurality of second text contents in the generated image according to the second position information; determining a second similarity between the first layout information and the second layout information; When the second similarity is less than a second preset threshold, the image generation model is triggered to generate a new generated image based on the input information.

12. An image generating device, the device comprising: A text acquisition unit, used to acquire a plurality of first text contents used to generate an image; A layout acquisition unit, used to acquire first layout information of the plurality of first text contents in the basic image; A model calling unit is used to process input information using a pre-trained image generation model to obtain a generated image, wherein the input information at least includes the first text content, the first layout information and the basic image.

13. A computing device, comprising a memory and a processor, wherein the memory stores a computer program / instruction, and when the processor executes the computer program / instruction, the method according to any one of claims 1 to 11 is implemented.

14. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed in a computing device, the computing device executes the method according to any one of claims 1 to 11.