Image generation method and device, equipment and storage medium
By extracting the target object characteristic information and the display area information of the target template image in the image to be processed, the image of the target style characteristics is generated, the problem of how to enrich the image generation function of the image, and realize a richer user experience.
Patent Information
- Application Number
- CN202411355770.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-01-21
AI Technical Summary
How to further enrich the relevant functions of image generation to meet the diverse needs of users.
By determining the image and target template image to be processed, extract the object characteristic information of the target object in the image to be processed, and obtain the display area information of the target object in the target template image. feature.
The image of the characteristic characteristics of the target is realized, and at the same time, it maintains the characteristics of the target object in the image to be processed, enriches the image generation method, and enhances the user experience.
Smart Images

Figure CN119338949A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing, and in particular to an image generation method, device, equipment and storage medium. Background Art
[0002] With the development of computer technology, more and more application software have emerged, such as short video application software, photo editing application software, etc. Users can upload photos and other materials to short video application software, and use the special effects on the short video application software to generate a variety of images. The above-mentioned gameplay based on image generation technology is very popular with users due to its novelty.
[0003] How to further enrich image generation related functions to meet the diverse needs of users is a technical problem that needs to be solved urgently. Summary of the invention
[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides an image generation method, device, equipment and storage medium.
[0005] In a first aspect, an embodiment of the present disclosure provides an image generation method, the method comprising:
[0006] Determine an image to be processed and a target template image; wherein the target template image has a target style feature, and the target template image is used to perform image processing on a target object;
[0007] Extracting object feature information of the target object in the image to be processed;
[0008] Acquire display area information of the target object in the target template image; wherein the display area information is used to represent a display position of the target object in the target template image;
[0009] Based on the object feature information, the display area information and the target template image, a target result image is generated; wherein the target result image has the target style feature, and the object feature information is used to regenerate the content of the display area corresponding to the display area information in the target template image to obtain the target result image.
[0010] In an optional implementation, generating a target result image based on the object feature information, the display area information and the target template image includes:
[0011] The object feature information, the display area information and the target template image are input into an image generation model, and after being processed by the image generation model, a target result image corresponding to the image to be processed is output; wherein the image generation model is trained using sample pairs consisting of image samples having the target style features and style description words of the image samples.
[0012] In an optional implementation manner, before generating the target result image based on the object feature information, the display area information and the target template image, the method further includes:
[0013] Based on the input data format condition of the image generation model, encoding the object feature information to obtain encoded object feature information;
[0014] Correspondingly, the object feature information, the display area information and the target template image are input into the image generation model, and after being processed by the image generation model, a target result image corresponding to the image to be processed is output, including:
[0015] The encoded object feature information, the display area information and the target template image are input into the image generation model, and after being processed by the image generation model, the target result image corresponding to the image to be processed is output; wherein the encoded object feature information is used as an input parameter of each layer of the image generation model.
[0016] In an optional implementation, the image generation model is configured with a target style descriptor, the target style descriptor is used to describe the target style feature, the object feature information, the display area information and the target template image are input into the image generation model, and after being processed by the image generation model, a target result image corresponding to the image to be processed is output, including:
[0017] The target style descriptor, the object feature information, the display area information and the target template image are input into an image generation model, and after being processed by the image generation model, a target result image corresponding to the image to be processed is output; wherein the target style descriptor is used as an input parameter for multiple image processing steps of the image generation model.
[0018] In an optional implementation manner, the acquiring display area information of the target object in the target template image includes:
[0019] The target template image is segmented for the target object to obtain a mask image of the target template image; wherein the mask image is used to identify a display area of the target object in the target template image.
[0020] In an optional implementation manner, after generating the target result image based on the object feature information, the display area information and the target template image, the method further includes:
[0021] The target result image is subjected to light effect processing based on the target light and shadow map to obtain a result image after light effect processing; wherein the target light and shadow map carries light and shadow parameter values.
[0022] In an optional implementation, performing light effect processing on the target result image based on the target light and shadow map to obtain a result image after light effect processing includes:
[0023] The target light and shadow map, the target result image and the target light and shadow description words are input into the light effect processing model, and after being processed by the light effect processing model, the result image after light effect processing corresponding to the target result image is output; wherein the target light and shadow description words are used to describe the light and shadow processing feature information.
[0024] In a second aspect, the present disclosure provides an image generating device, the device comprising:
[0025] A first determination module is used to determine an image to be processed and a target template image; wherein the target template image has a target style feature, and the target template image is used to perform image processing on a target object;
[0026] A first extraction module, used to extract object feature information of the target object in the image to be processed;
[0027] A first acquisition module, configured to acquire display area information of the target object in the target template image; wherein the display area information is used to represent a display position of the target object in the target template image;
[0028] The first generation module is used to generate a target result image based on the object feature information, the display area information and the target template image; wherein the target result image has the target style feature, and the object feature information is used to regenerate the content of the display area corresponding to the display area information in the target template image to obtain the target result image.
[0029] In a third aspect, an embodiment of the present disclosure further provides an electronic device, comprising: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement an image generation method as provided in an embodiment of the present disclosure.
[0030] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the image generation method provided by the embodiment of the present disclosure.
[0031] In a fifth aspect, the present disclosure provides a computer program product, wherein the computer program product comprises a computer program / instructions, and the computer program / instructions implement the above method when executed by a processor.
[0032] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:
[0033] In the image generation method provided by the embodiment of the present disclosure, first, an image to be processed and a target template image are determined, wherein the target template image has a target style feature and the target template image is used to perform image processing on a target object. Then, object feature information of the target object in the image to be processed is extracted, and display area information of the target object in the target template image is obtained, wherein the display area information is used to characterize the display position of the target object in the target template image. Based on the object feature information, the display area information and the target template image, a target result image is generated, wherein the target result image has a target style feature and the object feature information is used to regenerate the content of the display area corresponding to the display area information in the target template image to obtain the target result image.
[0034] The disclosed embodiment uses a template image with target style features to process the image to be processed, and regenerates the content of the corresponding display area in the template image based on the object feature information of the image to be processed to obtain a result image with target style features. It can be seen that the disclosed embodiment not only generates an image with target style, but also maintains the features of the target object in the image to be processed to a large extent, enriches the image generation method, and improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0036] Figure 1 A flowchart of an image generation method provided by an embodiment of the present disclosure;
[0037] Figure 2 A schematic diagram of a process of an image generation method provided by an embodiment of the present disclosure;
[0038] Figure 3 A schematic diagram of the structure of an image generating device provided by an embodiment of the present disclosure;
[0039] Figure 4 A schematic diagram of the structure of an image generating device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0040] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0041] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0042] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0043] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0044] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0045] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0046] To this end, the presently disclosed embodiment provides an image generation method. Specifically, first, an image to be processed and a target template image are determined, wherein the target template image has a target style feature and the target template image is used to perform image processing on a target object. Then, object feature information of the target object in the image to be processed is extracted, and display area information of the target object in the target template image is obtained, wherein the display area information is used to characterize the display position of the target object in the target template image. Based on the object feature information, the display area information and the target template image, a target result image is generated, wherein the target result image has a target style feature and the object feature information is used to regenerate the content of the display area corresponding to the display area information in the target template image to obtain the target result image.
[0047] The disclosed embodiment uses a template image with target style features to process the image to be processed, and regenerates the content of the corresponding display area in the template image based on the object feature information of the image to be processed to obtain a result image with target style features. It can be seen that the disclosed embodiment not only generates an image with target style, but also maintains the features of the target object in the image to be processed to a large extent, enriches the image generation method, and improves the user experience.
[0048] Based on this, an embodiment of the present disclosure provides an image generating method, which is introduced below in conjunction with a specific embodiment.
[0049] Figure 1 The present invention provides a flowchart of an image generation method provided by an embodiment of the present invention. The method can be executed by an image generation device, wherein the device can be implemented by software and / or hardware and can generally be integrated in an electronic device. Figure 1 As shown, the method includes:
[0050] S101: Determine an image to be processed and a target template image.
[0051] The target template image has target style features, and the target template image is used to perform image processing on a target object.
[0052] The image to be processed in the embodiment of the present disclosure may be a picture material uploaded by a user, and the image to be processed contains a target object, which may be a main object in the image to be processed. Specifically, the target object may be the face part of a portrait in the image to be processed, the main product in the image to be processed, etc.
[0053] The target template image in the embodiment of the present disclosure can be a template image selected by a user from multiple template images, and the target template image is used to perform image processing on the target object in the image to be processed. The template image can be generated by a large model and then added to the template image library, or it can be manually selected and added to the template image library.
[0054] In addition, the target template image has a target style feature, which may be a characteristic and visual expression presented by the target template image. For example, the target style feature may be a retro style feature, that is, the target template image is used to generate an image with a retro style.
[0055] S102: Extracting object feature information of the target object in the image to be processed.
[0056] The object feature information of the target object in the image to be processed may include feature data of the target object. For example, if the target object is a face, the object feature information may include feature data of the face part, specifically frontal face data, side face data, etc.
[0057] In an optional implementation, the image to be processed is analyzed using image recognition technology to identify the target object, determine the display area of the target object, and obtain feature data in the display area as object feature information of the target object.
[0058] S103: Acquire display area information of the target object in the target template image; wherein the display area information is used to represent a display position of the target object in the target template image.
[0059] The display area information of the target object in the target template image in the embodiment of the present disclosure is the position information of the display area of the target object in the target template image, that is, the display area information can indicate the display position of the target object in the target template image.
[0060] In an optional implementation, based on the display area information of the target object in the target template image, the target template image is segmented to obtain a mask image of the target template image, and the display area information of the target object in the target template image can be displayed through the mask image.
[0061] Among them, the mask image is used to identify the display area of the target object in the target template image. The mask image is a binary image of the same size as the target template image. In the mask image, the pixel positions with a value of 0 can be used to identify the display area of the target object in the target template image, and the values of other pixel positions are 1, that is, the display area of the target object in the target template image is identified by the binary image.
[0062] S104: Generate a target result image based on the object feature information, the display area information and the target template image.
[0063] The target result image has the target style feature, and the object feature information is used to regenerate the content of the display area corresponding to the display area information in the target template image to obtain the target result image.
[0064] In the disclosed embodiment, the content of the display area corresponding to the display area information in the target template image is regenerated using the object feature information of the target object in the image to be processed to generate a target result image of the image to be processed. In addition, the content of the target template image other than the display area corresponding to the display area information remains unchanged, that is, the content of the target template image other than the display area corresponding to the display area information is retained in the target result image.
[0065] That is to say, the target result image not only generates the object feature information of the target object in the original image to be processed, but also retains the target style features of the target template image. The target result image is an image with target style features generated on the basis of retaining the object feature information of the target object in the image to be processed.
[0066] In an optional embodiment, based on the object feature information of the target object in the image to be processed, the display area information of the target object in the target template image and the target template image, the object feature information, the display area information and the target template image are input into the image generation model, and after being processed by the image generation model, the target result image corresponding to the image to be processed is output.
[0067] The image generation model is trained using sample pairs, which may be composed of image samples with target style features and style description words of the image samples. The image samples may be collected and screened from real pictures, or may be rendered based on virtual technology.
[0068] The input parameters of the image generation model may include object feature information of the target object in the image to be processed, display area information of the target object in the target template image, and the target template image. The output parameters of the image generation model are the target result image corresponding to the image to be processed.
[0069] In order to make the generated target result image more prominent in terms of style features, in the disclosed embodiment, a target style descriptor may be configured for the image generation model. The target style descriptor is used to describe the target style features. Specifically, the target style descriptor may be used as an input parameter for multiple image processing steps of the image generation model, that is, the input parameter of each image processing step in the image generation model includes the target style descriptor.
[0070] In an optional implementation, the target style description words, the object feature information of the target object in the image to be processed, the display area information of the target object on the target template image, and the target template image are input into the image generation model. After being processed by the image generation model, the target result image corresponding to the image to be processed is output.
[0071] In practical applications, since the image generation model has format requirements for input data, in order to ensure that the image generation model and the input parameters can be adapted, the implementation of the present disclosure also needs to encode the input parameters of the image generation model to ensure that the image generation model can accurately receive and identify the input parameters.
[0072] In an optional implementation, based on the input data format condition of the image generation model, the object feature information of the target object in the image to be processed is encoded to obtain the encoded object feature information.
[0073] Based on the encoded object feature information of the target object in the image to be processed, the encoded object feature information, the display area information of the target object on the target template image and the target template image are input into the image generation model. After being processed by the image generation model, the target result image corresponding to the image to be processed is output.
[0074] The encoded object feature information is used as an input parameter of each layer of the image generation model, that is, the encoded object feature information is input into each layer structure of the image generation model, and the input parameter of each layer structure of the image generation model includes the encoded object feature information.
[0075] In another optional implementation, a target style descriptor is configured for the image generation model, and the encoded object feature information of the target object in the image to be processed, the display area information of the target object on the target template image, the target template image and the target style descriptor are input into the image generation model. After being processed by the image generation model, the target result image corresponding to the image to be processed is output.
[0076] The image generation method provided by the embodiment of the present disclosure specifically comprises the following steps: first, determining an image to be processed and a target template image, wherein the target template image has a target style feature and the target template image is used to perform image processing on a target object; then, extracting object feature information of the target object in the image to be processed, obtaining display area information of the target object in the target template image, wherein the display area information is used to characterize the display position of the target object in the target template image; and generating a target result image based on the object feature information, the display area information and the target template image, wherein the target result image has a target style feature and the object feature information is used to regenerate the content of the display area corresponding to the display area information in the target template image to obtain the target result image.
[0077] The disclosed embodiment uses a template image with target style features to process the image to be processed, and regenerates the content of the corresponding display area in the template image based on the object feature information of the image to be processed to obtain a result image with target style features. It can be seen that the disclosed embodiment not only generates an image with target style, but also maintains the features of the target object in the image to be processed to a large extent, enriches the image generation method, and improves the user experience.
[0078] In practical applications, in order to improve the quality of the target result image and enhance the user experience, the embodiment of the present disclosure may also perform light effect processing on the target result image.
[0079] In an optional embodiment, light effect processing can be performed on a target result image corresponding to the processed image based on the target light and shadow map to obtain a result image after light effect processing, wherein the target light and shadow map is an image with light and shadow effects, and the target light and shadow map is a light and shadow map with pre-set light and shadow parameter values, and the light and shadow parameter values may include light and shadow, light and shadow texture, and halo size and shape, etc.
[0080] Specifically, the light effect processing model can be used to input the target light and shadow map, the target result image corresponding to the image to be processed, and the target light and shadow description words into the light effect processing model. After being processed by the light effect processing model, the result image after light effect processing corresponding to the target result image is output.
[0081] The target light and shadow description word is used to describe the light and shadow processing feature information. Specifically, the target light and shadow description word may include light and shadow feature related information, for example, the target light and shadow description word may be cold light, warm light, soft, strong, glaring, etc.
[0082] In order to facilitate understanding of the content of the above embodiment, the present disclosure embodiment will introduce the image processing method provided by the present disclosure embodiment in a specific scenario. Figure 2 , which is a schematic diagram of an image processing process provided by an embodiment of the present disclosure.
[0083] In one application scenario, a picture uploaded by a user is received, the picture is determined as an image to be processed, a target template image is determined based on the user's selection, and then object feature information of the target object is extracted from the image to be processed.
[0084] Based on the object feature information of the target object and the input data format condition of the image generation model, the object feature information is encoded to obtain the encoded object feature information.
[0085] Based on the target object in the image to be processed, the target template image is segmented to obtain a mask image of the target template image, and then the display area information of the target object in the target template image is obtained.
[0086] In addition, the image generation model is configured with target style descriptors, and the encoded object feature information of the target object in the image to be processed, the display area information of the target object in the target template image, the target style descriptors and the target template image are input into the image generation model. After being processed by the image generation model, the target result image corresponding to the image to be processed is output.
[0087] Based on the target result image, the target light and shadow map, the target result image and the target light and shadow description words are input into the light effect processing model. After being processed by the light effect processing model, the light effect processed result image corresponding to the target result image is output.
[0088] In order to implement the above embodiments, the present disclosure also proposes an image generating device. Figure 3 Schematic diagram of the structure of an image generation device provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware and can generally be integrated into an electronic device. Figure 3 As shown, the device comprises:
[0089] A first determination module 301 is used to determine an image to be processed and a target template image; wherein the target template image has a target style feature, and the target template image is used to perform image processing on a target object;
[0090] A first extraction module 302, used to extract object feature information of the target object in the image to be processed;
[0091] A first acquisition module 303 is used to acquire display area information of the target object in the target template image; wherein the display area information is used to represent a display position of the target object in the target template image;
[0092] The first generation module 304 is used to generate a target result image based on the object feature information, the display area information and the target template image; wherein the target result image has the target style feature, and the object feature information is used to regenerate the content of the display area corresponding to the display area information in the target template image to obtain the target result image.
[0093] In an optional implementation manner, the first generating module is specifically configured to:
[0094] The object feature information, the display area information and the target template image are input into an image generation model, and after being processed by the image generation model, a target result image corresponding to the image to be processed is output; wherein the image generation model is trained using sample pairs consisting of image samples having the target style features and style description words of the image samples.
[0095] In an optional implementation, the device further includes:
[0096] An encoding module, used for encoding the object feature information based on the input data format condition of the image generation model to obtain encoded object feature information;
[0097] Accordingly, the first generating module is specifically used for:
[0098] The encoded object feature information, the display area information and the target template image are input into the image generation model, and after being processed by the image generation model, the target result image corresponding to the image to be processed is output; wherein the encoded object feature information is used as an input parameter of each layer of the image generation model.
[0099] In an optional implementation manner, the image generation model is configured with a target style descriptor, and the target style descriptor is used to describe the target style feature, and the first generation module is specifically used to:
[0100] The target style descriptor, the object feature information, the display area information and the target template image are input into an image generation model, and after being processed by the image generation model, a target result image corresponding to the image to be processed is output; wherein the target style descriptor is used as an input parameter for multiple image processing steps of the image generation model.
[0101] In an optional implementation manner, the first acquisition module is specifically configured to:
[0102] The target template image is segmented for the target object to obtain a mask image of the target template image; wherein the mask image is used to identify a display area of the target object in the target template image.
[0103] In an optional implementation, the device further includes:
[0104] The light effect processing module is used to perform light effect processing on the target result image based on the target light and shadow map to obtain a result image after light effect processing; wherein the target light and shadow map carries light and shadow parameter values.
[0105] In an optional implementation manner, the light effect processing module is specifically used to:
[0106] The target light and shadow map, the target result image and the target light and shadow description words are input into the light effect processing model, and after being processed by the light effect processing model, the result image after light effect processing corresponding to the target result image is output; wherein the target light and shadow description words are used to describe the light and shadow processing feature information.
[0107] In the image generating device provided by the embodiment of the present disclosure, specifically, first, an image to be processed and a target template image are determined, wherein the target template image has a target style feature, and the target template image is used to perform image processing on a target object. Then, object feature information of the target object in the image to be processed is extracted, and display area information of the target object in the target template image is obtained, wherein the display area information is used to characterize the display position of the target object in the target template image. Based on the object feature information, the display area information and the target template image, a target result image is generated, wherein the target result image has a target style feature, and the object feature information is used to regenerate the content of the display area corresponding to the display area information in the target template image to obtain the target result image.
[0108] The disclosed embodiment uses a template image with target style features to process the image to be processed, and regenerates the content of the corresponding display area in the template image based on the object feature information of the image to be processed to obtain a result image with target style features. It can be seen that the disclosed embodiment not only generates an image with target style, but also maintains the features of the target object in the image to be processed to a large extent, enriches the image generation method, and improves the user experience.
[0109] The image generating device provided in the embodiments of the present disclosure can execute the image generating method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0110] In order to implement the above embodiments, the present disclosure further proposes a computer program product, including a computer program / instruction, which implements the image generating method in the above embodiments when the computer program / instruction is executed by a processor.
[0111] In addition to the above-mentioned method and apparatus, the embodiments of the present disclosure further provide a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a terminal device, the terminal device implements the image generation method in the embodiments of the present disclosure.
[0112] In addition, the present disclosure also provides an image generating device, see Figure 4 As shown, it may include:
[0113] Processor 401, memory 402, input device 403 and output device 404. The number of processors 401 in the image generation device can be one or more. Figure 4 In some embodiments of the present disclosure, the processor 401, the memory 402, the input device 403 and the output device 404 may be connected via a bus or other means, wherein: Figure 4 The example of connecting through bus is taken in the following.
[0114] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing of the image generation device by running the software programs and modules stored in the memory 402. The memory 402 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc. In addition, the memory 402 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. The input device 403 can be used to receive input digital or character information, and generate signal input related to user settings and function control of the image generation device.
[0115] Specifically in this embodiment, the processor 401 will load the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 401 will run the applications stored in the memory 402, thereby realizing the various functions of the above-mentioned image generation device.
[0116] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0117] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An image generation method, characterized in that: include: Determine an image to be processed and a target template image; wherein the target template image has a target style feature, and the target template image is used to perform image processing on a target object; Extracting object feature information of the target object in the image to be processed; Acquire display area information of the target object in the target template image; wherein the display area information is used to represent a display position of the target object in the target template image; Based on the object feature information, the display area information and the target template image, a target result image is generated; wherein the target result image has the target style feature, and the object feature information is used to regenerate the content of the display area corresponding to the display area information in the target template image to obtain the target result image.
2. The method according to claim 1, characterized in that The generating a target result image based on the object feature information, the display area information and the target template image comprises: The object feature information, the display area information and the target template image are input into an image generation model, and after being processed by the image generation model, a target result image corresponding to the image to be processed is output; wherein the image generation model is trained using sample pairs consisting of image samples having the target style features and style description words of the image samples.
3. The method according to claim 2, characterized in that Before generating a target result image based on the object feature information, the display area information and the target template image, the method further includes: Based on the input data format condition of the image generation model, encoding the object feature information to obtain encoded object feature information; Correspondingly, the object feature information, the display area information and the target template image are input into the image generation model, and after being processed by the image generation model, a target result image corresponding to the image to be processed is output, including: The encoded object feature information, the display area information and the target template image are input into the image generation model, and after being processed by the image generation model, the target result image corresponding to the image to be processed is output; wherein the encoded object feature information is used as an input parameter of each layer of the image generation model.
4. The method according to claim 2, characterized in that: The image generation model is configured with a target style descriptor, and the target style descriptor is used to describe the target style feature. The object feature information, the display area information and the target template image are input into the image generation model, and after being processed by the image generation model, a target result image corresponding to the image to be processed is output, including: The target style descriptor, the object feature information, the display area information and the target template image are input into an image generation model, and after being processed by the image generation model, a target result image corresponding to the image to be processed is output; wherein the target style descriptor is used as an input parameter for multiple image processing steps of the image generation model.
5. The method according to claim 1, characterized in that The acquiring display area information of the target object in the target template image includes: The target template image is segmented for the target object to obtain a mask image of the target template image; wherein the mask image is used to identify a display area of the target object in the target template image.
6. The method according to claim 1, characterized in that After generating the target result image based on the object feature information, the display area information and the target template image, the method further includes: The target result image is subjected to light effect processing based on the target light and shadow map to obtain a result image after light effect processing; wherein the target light and shadow map carries light and shadow parameter values.
7. The method according to claim 6, characterized in that The step of performing light effect processing on the target result image based on the target light and shadow map to obtain a result image after the light effect processing includes: The target light and shadow map, the target result image and the target light and shadow description words are input into the light effect processing model, and after being processed by the light effect processing model, the result image after light effect processing corresponding to the target result image is output; wherein the target light and shadow description words are used to describe the light and shadow processing feature information.
8. An image generating device, characterized in that: The device comprises: A first determination module is used to determine an image to be processed and a target template image; wherein the target template image has a target style feature, and the target template image is used to perform image processing on a target object; A first extraction module, used to extract object feature information of the target object in the image to be processed; A first acquisition module, configured to acquire display area information of the target object in the target template image; wherein the display area information is used to represent a display position of the target object in the target template image; The first generation module is used to generate a target result image based on the object feature information, the display area information and the target template image; wherein the target result image has the target style feature, and the object feature information is used to regenerate the content of the display area corresponding to the display area information in the target template image to obtain the target result image.
9. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the image generation method described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program is used to execute the image generation method described in any one of claims 1 to 7.
11. A computer program product, characterized in that The computer program product comprises a computer program / instruction, and when the computer program / instruction is executed by a processor, the method according to any one of claims 1 to 7 is implemented.