Image generation method and device, electronic equipment and storage medium

By generating multi-layer image files and determining the editing type according to editing instructions, the image generation method achieves flexibility and editability, solves the problem of poor editability in existing image generation technologies, and improves the accuracy and efficiency of image editing.

CN120953422BActive Publication Date: 2026-02-24THE HONG KONG POLYTECHNIC UNIV SHENZHEN RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511469536.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-15
Publication Date
2026-02-24
Estimated Expiration
2045-10-15

AI Technical Summary

Technical Problem

Existing image generation methods produce images with poor editability. Users find it difficult to edit specific elements independently and need to rely on professional software to separate or redraw complex layers, resulting in low operational efficiency and easy loss of image quality.

Method used

By receiving the target image generation instruction, a first image file containing multiple layers is generated, and editing instructions for the layer images are received. Based on the editing instructions, the target editing type is determined, and the corresponding editing operation is performed, including the first editing type that only applies to the first layer and the second editing type that applies to the first layer and related layers, ensuring the accuracy and efficiency of editing.

Benefits of technology

It enhances the flexibility and editability of image generation methods. Through layered generation and dynamic editing mechanisms, it preserves the layer structure, automatically identifies related layers for coordinated adjustment, solves the problem of difficult image editing, and improves the editability of generated images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120953422B_ABST
    Figure CN120953422B_ABST
Patent Text Reader

Abstract

The application discloses an image generation method and device, electronic equipment and a storage medium, wherein the method comprises: receiving a target image generation instruction; the target image generation instruction is used to instruct to generate a target image of a target style; in response to the target image generation instruction, a first image file is generated; the first image file comprises a plurality of layer images used to generate the target image; an editing instruction for a first layer image in the plurality of layer images is received; in response to the editing instruction, a target editing type corresponding to the editing instruction is determined, and a target editing operation corresponding to the target editing type is performed on a second layer image to obtain a second image file; and the target image is generated according to the second image file, so that the editability of the generated image is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of image processing technology, and in particular relates to an image generation method, apparatus, electronic device and storage medium. Background Technology

[0002] In the field of digital image processing, image generation methods are widely used in scenarios such as graphic design, game development, and advertising production. Users often need to make local modifications, element replacements, or style adjustments to the generated images.

[0003] In related technologies, image generation methods typically output multidimensional single-layer bitmaps. Figure 1 Once generated, each element is fixed in a single pixel layer, making it difficult for users to directly edit specific elements independently. This necessitates relying on specialized software for complex layer separation or redrawing, resulting in low efficiency and potential loss of image quality. Therefore, existing image generation methods suffer from poor editability of the generated images. Summary of the Invention

[0004] This application provides an image generation method, apparatus, electronic device, and storage medium, aiming to solve the problem of poor editability of images generated by existing image generation methods.

[0005] In a first aspect, embodiments of this application provide an image generation method, including:

[0006] Receive a target image generation instruction; the target image generation instruction is used to instruct the generation of a target image of a target style;

[0007] In response to the target image generation instruction, a first image file is generated; the first image file includes multiple layer images for generating the target image;

[0008] Receive editing instructions for the first layer image among the plurality of layer images;

[0009] In response to the editing instruction, a target editing type corresponding to the editing instruction is determined, and a target editing operation corresponding to the target editing type is performed on the second layer image to obtain a second image file; wherein, if the target editing type is a first editing type that only applies to the first layer image, the second layer image is the first layer image; if the target editing type is a second editing type that applies to the first layer image and related layer images of the first layer image, the second layer image includes the first layer image and related layer images of the first layer image;

[0010] The target image is generated based on the second image file.

[0011] In one embodiment of this application, determining the target editing type corresponding to the editing instruction includes:

[0012] Based on the target editing operation on the first layer image indicated by the editing instruction, determine the target editing type corresponding to the editing instruction;

[0013] Wherein, when the target editing operation is used to adjust the content attributes of the first layer image, the target editing type is determined to be the first editing type, and the content attributes include at least one of resolution, color parameters, and sharpness;

[0014] In the case where the target editing operation is used to adjust the spatial attributes of the first layer image and / or the layer stacking order, the target editing type is determined to be the second editing type; the spatial attributes include at least one of position, size, and rotation angle.

[0015] In one embodiment of this application, the target editing operation indicated by the editing instruction is resolution enhancement;

[0016] The step of performing a target editing operation on the second layer image corresponding to the target editing type to obtain a second image file includes:

[0017] The second layer image is input into the target resolution model to obtain the third layer image, which is an image with enhanced resolution of the second layer image;

[0018] The second image file is obtained by replacing the second layer image in the first image file with the third layer image;

[0019] The target resolution model is trained using a target loss function. The target loss function includes at least one of a perceptual loss function, an adversarial loss function, and a style loss function. The perceptual loss function indicates the visual semantic similarity between the output image of the initial resolution model and the high-resolution image. The adversarial loss function indicates the image texture similarity between the output image of the initial resolution model and the high-resolution image. The style loss function indicates the image style similarity between the output image of the initial resolution model and the high-resolution image. The initial resolution model is a denoising diffusion probability model.

[0020] In one embodiment of this application, the target editing type is the second editing type;

[0021] The step of performing a target editing operation on the second layer image corresponding to the target editing type to obtain a second image file includes:

[0022] Feature extraction is performed on the first layer image and the related layer images of the first layer image to obtain the first feature point corresponding to the first layer image and the second feature point corresponding to the related layer image;

[0023] The first feature point and the second feature point are matched to obtain the matching relationship between each feature point between the first feature point and the second feature point;

[0024] Based on the matching relationship, the spatial relationship between the first layer image and the related layer image is obtained. The spatial relationship is used to indicate the position change information of the feature points in the related layer image that match the target feature points when the target feature points in the first layer image change.

[0025] Based on the spatial relationship, target editing operations corresponding to the target editing type are performed on the second layer image.

[0026] In one embodiment of this application, the target image generation instruction includes at least two image generation sub-instructions, each of which is used to instruct the generation of an initial style layer image;

[0027] After receiving the target image generation instruction and before generating the first image file in response to the target image generation instruction, the method further includes:

[0028] Obtain the initial style corresponding to each of the image generation sub-instructions;

[0029] If the initial styles corresponding to each of the image generation sub-instructions are different, the target style is determined from the multiple initial styles according to the preset style priority.

[0030] In one embodiment of this application, generating a first image file in response to the target image generation instruction includes:

[0031] The target image generation instruction is input into the target image generation model to obtain the first image file;

[0032] The target image generation model is trained through the following steps:

[0033] Based on the target style, a style image training set is constructed, which includes several images of the target style;

[0034] Based on the style image training set, the initial image generation model is adjusted using a low-rank adaptive method to obtain the target image generation model, wherein the initial image generation model is a neural network model trained with images of different styles.

[0035] In one embodiment of this application, generating the target image based on the second image file includes:

[0036] Receive a target image output instruction, wherein the target image output instruction is used to indicate the target file format for the target image output;

[0037] In response to the target image output instruction, when the target image output instruction indicates that the target file format is an editable image format, the target image and the second image file are output; the target image is obtained by fusing the images of each layer in the second image file.

[0038] Secondly, embodiments of this application provide an image generation apparatus, comprising:

[0039] The first receiving module is used to receive a target image generation instruction; the target image generation instruction is used to instruct the generation of a target image of a target style.

[0040] A first generation module is configured to generate a first image file in response to the target image generation instruction; the first image file includes multiple layer images used to generate the target image;

[0041] The second receiving module is used to receive editing instructions for the first layer image among the multiple layer images;

[0042] An image editing module is configured to respond to the editing instruction, determine the target editing type corresponding to the editing instruction, and perform a target editing operation corresponding to the target editing type on the second layer image to obtain a second image file; wherein, when the target editing type is a first editing type that only applies to the first layer image, the second layer image is the first layer image; when the target editing type is a second editing type that applies to the first layer image and related layer images of the first layer image, the second layer image includes the first layer image and related layer images of the first layer image;

[0043] An image generation module is used to generate the target image based on the second image file.

[0044] Thirdly, embodiments of this application provide an electronic device, including: a processor and a memory storing computer program instructions;

[0045] When the processor executes the computer program instructions, it implements the image generation method as described in the first aspect.

[0046] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement the image generation method as described in the first aspect.

[0047] Fifthly, embodiments of this application provide a computer program product, wherein instructions in the computer program product, when executed by a processor of an electronic device, cause the electronic device to perform the image generation method as described in the first aspect.

[0048] The image generation method, apparatus, electronic device, and storage medium proposed in this application generate a first image file containing multiple layers by receiving a target image generation instruction. Then, it receives an editing instruction for the first layer, determines the target editing type based on the instruction, and performs the corresponding target editing operation. If it is a first editing type that only affects the first layer, that layer is directly modified to avoid affecting unrelated layers, thus ensuring the accuracy and efficiency of the editing. If it is a second editing type that affects the first layer and related layers, the related layers are edited simultaneously to ensure the correlation and spatial continuity between layers when editing the first layer. Finally, the target image is generated based on the processed second image file. Thus, through layered generation and dynamic editing mechanisms, the layer structure is preserved when generating the first image file, and related layers are automatically identified and adjusted collaboratively according to the editing type. This improves the flexibility of image generation while solving the problem of difficult image editing, thereby enhancing the editability of the images generated by the image generation method. Attached Figure Description

[0049] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0050] Figure 1 This is a schematic flowchart of an image generation method provided in an embodiment of this application;

[0051] Figure 2 This is a schematic diagram of the implementation process of the image generation method provided in this application when applied to an electronic device, wherein (a) is a drawing schematic diagram, (b) is a display schematic diagram after the layer image is generated, (c) is a schematic diagram of the layer image selection and calling, and (d) is a display schematic diagram of the target image;

[0052] Figure 3 This is a schematic diagram of the structure of the image generation apparatus provided in the embodiments of this application;

[0053] Figure 4This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0054] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.

[0055] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.

[0056] In all specific embodiments of this application, when processing data related to user identity or characteristics, such as user information, user behavior data, user historical data, and user location information, user permission or consent is obtained first. Furthermore, the collection, use, and processing of this data comply with relevant laws, regulations, and standards. Additionally, when embodiments of this application require access to sensitive personal information, separate permission or consent from the user is obtained through pop-ups or redirects to confirmation pages. Only after obtaining the user's separate permission or consent is the necessary user-related data required for the proper functioning of these embodiments obtained.

[0057] To address the problems of the prior art, embodiments of this application provide an image generation method, apparatus, electronic device, and storage medium. The image generation method provided in this application embodiment will be described first below.

[0058] Figure 1 A schematic flowchart of an image generation method according to an embodiment of this application is shown. Figure 1As shown, the image generation method provided in this application embodiment can be applied to electronic devices, including the following steps 101-105, wherein:

[0059] Step 101: Receive target image generation instruction; the target image generation instruction is used to instruct the generation of a target image in the target style.

[0060] The target image generation command can be manually entered by the user, remotely entered by the user through an application, or entered by the user's voice; there are no restrictions here.

[0061] The target image generation instruction can contain the specific content of one or more layer images, as well as at least one image style. If the target image generation instruction contains only one image style, then that image style is the target style. If the target image generation instruction contains multiple image styles, the target style can be determined by the preset style priority, or the user can manually specify the main style as the target style. There are no restrictions on this.

[0062] The target style can be one of the preset styles, such as Guangcai porcelain style, cartoon style, realistic style, watercolor style, oil painting style, etc., or it can be a unique style customized by the user according to their own needs. There are no restrictions here.

[0063] For example, the target image generation instruction can be "the main subject is a golden butterfly in the style of Guangcai porcelain with outstretched wings, surrounded by famille rose peony flowers as decoration". According to this target image generation instruction, the target style is Guangcai porcelain style.

[0064] Step 102: In response to the target image generation instruction, a first image file is generated; the first image file includes multiple layer images for generating the target image.

[0065] If the target image generation instruction includes one instruction (i.e. a piece of text), but the target image generation instruction indicates multiple elements, then the target image generation instruction is parsed into multiple image generation sub-instructions. Each image generation sub-instruction corresponds to one element. Each image generation sub-instruction is input into a pre-trained image generation model to obtain the layer image corresponding to each image generation sub-instruction, thereby obtaining the first image file.

[0066] For example, the target image generation instruction can be "the main subject is a golden butterfly in the style of Guangcai porcelain with outstretched wings, decorated with famille rose peonies around it". Natural language processing technology can be used to break down the above instruction into sub-instruction 1 "golden butterfly in the style of Guangcai porcelain with outstretched wings" and sub-instruction 2 "famille rose peony flowers".

[0067] If the target image generation instructions include multiple instructions (i.e., composed of multiple text segments), then multiple instructions can be input into a pre-trained image generation model to obtain the first image file.

[0068] For example, the target image generation instruction could be "the subject is a golden butterfly in the style of Cantonese porcelain with outstretched wings"; "the surrounding area is decorated with famille rose peonies".

[0069] The first image file refers to a file containing multiple independent layers of images, which can be achieved using image layer rendering technology or image compositing algorithms.

[0070] Step 103: Receive editing instructions for the first layer image among the multiple layer images.

[0071] After generating the first image file, the user can edit any layer image within the first image file according to their needs. Specifically, this can be done through the image interaction interface or by issuing editing instructions for the first layer image among the multiple layer images. The first layer image is the layer image selected by the user to be edited.

[0072] Step 104: In response to the editing instruction, determine the target editing type corresponding to the editing instruction, and perform a target editing operation corresponding to the target editing type on the second layer image to obtain a second image file; wherein, if the target editing type is a first editing type that only applies to the first layer image, the second layer image is the first layer image; if the target editing type is a second editing type that applies to the first layer image and related layer images of the first layer image, the second layer image includes the first layer image and related layer images of the first layer image.

[0073] Upon receiving an editing instruction for the first layer image, the target editing type corresponding to the editing instruction is determined based on the editing instruction. Then, the second layer image that needs to be edited is determined based on the target editing type, and the target editing operation corresponding to the target editing type is performed on the second layer image to obtain a second image file. The second image file includes the layer images after the editing operation and the unedited layer images in the first image file.

[0074] Specifically, the target edit type can include, but is not limited to, a first edit type and a second edit type. The first edit type is an edit type that only applies to the first layer image. When the target edit type corresponding to the edit instruction is determined to be the first edit type, the second layer image is the same as the first layer image. For example, if the edit instruction is "adjust the color of the person's hair layer to brown," this instruction only operates on the person's hair layer and does not affect other layer images. Therefore, the target edit type is the first edit type. In this case, only the person's hair layer, which is the first layer image, is subjected to a color adjustment operation, changing its color to brown, while other layer images remain unchanged.

[0075] The second editing type is the editing type applied to the first layer image and related layer images of the first layer image. When the target editing type corresponding to the parsed editing instruction is the second editing type, the second layer image includes the first layer image and related layer images of the first layer image.

[0076] In this context, the related layer images of the first layer image refer to layer images that are associated with the first layer image. These associations can be pre-defined based on layer attribute information, logical relationships between image elements, etc. For example, in a portrait image, the related layer image of the hair layer could be the face layer. Since hair is located on the face, adjusting the position or shape of the hair requires maintaining the relative positions, proportions, and transformation relationships between layers to ensure stylistic consistency and visual harmony throughout the dynamic editing process. For instance, if the user sends an editing command to "extend the hair by one centimeter," this command will affect not only the display effect of the hair layer but also the display effect of the face layer. Therefore, the target editing type is the second editing type, where the second layer image includes both the hair layer and the face layer.

[0077] Step 105: Generate the target image based on the second image file.

[0078] The system can perform layer compositing on all layers in the second image file to obtain the target image. Specifically, it can overlay all layers together according to their position coordinates, transparency, and other attributes to generate the target image.

[0079] The generated target image can be previewed on the display interface of the electronic device. If the user is satisfied with the target image, it can be saved as a common single-layer high-resolution image file, such as Joint Photographic Experts Group (JPEG) format, Portable Network Graphics (PNG) format, etc.; it can also be saved as an image editor file (Photoshop Document, PSD) that retains layer information. The PSD format output allows the user to seamlessly connect to professional image editing software for final fine-tuning or production preparation when the target image needs to be edited later.

[0080] In this embodiment, the image generation method, apparatus, electronic device, and storage medium proposed in this application generate a first image file containing multiple layers by receiving a target image generation instruction. Then, it receives an editing instruction for the first layer, determines the target editing type based on the editing instruction, and performs the corresponding target editing operation according to the target editing type. If it is a first editing type that only affects the first layer, the layer is directly modified to avoid affecting unrelated layers, thereby ensuring the accuracy and efficiency of the editing. If it is a second editing type that affects the first layer and related layers, the related layers are edited simultaneously to ensure the correlation and spatial continuity between layers when editing the first layer. Finally, a target image is generated based on the processed second image file. Thus, through layered generation and dynamic editing mechanisms, the layer structure is preserved when generating the first image file, and related layers are automatically identified and adjusted collaboratively according to the editing type. This improves the flexibility of image generation while solving the problem of difficult image editing, thereby enhancing the editability of the images generated by the image generation method.

[0081] In one embodiment of this application, the target editing type can be determined based on the specific editing operation indicated by the editing instruction. Specifically, determining the target editing type corresponding to the editing instruction in step 104 may include:

[0082] Based on the target editing operation on the first layer image indicated by the editing instruction, determine the target editing type corresponding to the editing instruction;

[0083] Wherein, when the target editing operation is used to adjust the content attributes of the first layer image, the target editing type is determined to be the first editing type, and the content attributes include at least one of resolution, color parameters, and sharpness;

[0084] In the case where the target editing operation is used to adjust the spatial attributes of the first layer image and / or the layer stacking order, the target editing type is determined to be the second editing type; the spatial attributes include at least one of position, size, and rotation angle.

[0085] Content attributes include at least one of resolution, color parameters (such as RGB values, hue, and saturation), and sharpness. For example, adjusting the resolution of a layer image from 1024x1024 to 4096x4096, increasing the saturation of the color parameters by 20%, and enhancing image sharpness to improve detail clarity are all operations that adjust content attributes, and the corresponding target editing type is the first editing type.

[0086] Spatial attributes include at least one of the following: position (such as changes in horizontal / vertical axis coordinates), size (such as scaling proportionally and adjusting to a fixed size), and rotation angle (such as rotating 90° clockwise).

[0087] For example, operations such as moving a layer image from coordinates (100, 200) to (150, 250), scaling a layer image by 120%, rotating a layer image 45° clockwise, and moving a layer image from the 3rd layer to the 1st layer to adjust its stacking order are all operations that adjust spatial attributes or layer stacking order, and the corresponding target editing type is the second editing type.

[0088] For example, when a user is detected adjusting the resolution of an image layer, it is identified as a content attribute operation. The resolution is adjusted only for that image layer, while the pixel data of other layers remains unchanged. When the user drags the image layer to change its position, other layers that have spatial constraints with that image layer, such as related layers of different parts of the same object, are retrieved. The displacement vectors of each layer are calculated synchronously to maintain the spatial continuity of the overall image when the image layer is dragged.

[0089] In this embodiment, the range of layers to be edited is determined based on the user's editing operation type, thereby enabling precise editing of multi-layered images. For editing operations involving only a single layer, the editing range can be limited to that layer to improve editing efficiency. For editing operations involving the spatial relationships of multiple layers, the relevant layers can be adjusted synchronously to ensure the overall harmony of the image. This ensures both editing flexibility and improved accuracy and efficiency, effectively solving the problem of image editing difficulties in related technologies.

[0090] In one embodiment of this application, the target editing operation indicated by the editing instruction is resolution enhancement. Specifically, step 104, which involves performing a target editing operation corresponding to the target editing type on the second layer image to obtain a second image file, may include:

[0091] The second layer image is input into the target resolution model to obtain the third layer image, which is an image with enhanced resolution of the second layer image;

[0092] The second image file is obtained by replacing the second layer image in the first image file with the third layer image;

[0093] The target resolution model is trained using a target loss function. The target loss function includes at least one of a perceptual loss function, an adversarial loss function, and a style loss function. The perceptual loss function indicates the visual semantic similarity between the output image of the initial resolution model and the high-resolution image. The adversarial loss function indicates the image texture similarity between the output image of the initial resolution model and the high-resolution image. The style loss function indicates the image style similarity between the output image of the initial resolution model and the high-resolution image. The initial resolution model is a denoising diffusion probability model.

[0094] The target resolution model is jointly trained using multi-dimensional loss functions to ensure that the resolution-enhanced layer image remains consistent with the original layer image in terms of semantics, texture, and style.

[0095] Specifically, the perceptual loss function can constrain the visual semantic consistency of the enhancement result by comparing the difference between the initial resolution model output and the high-resolution image in the deep feature space. For example, the Euclidean distance between the initial resolution model output image and the high-resolution image in the deep feature space can be calculated to ensure that the enhanced image is consistent with the high-resolution image in terms of content semantics, thus avoiding semantic distortion problems (such as deformation of facial features or blurring of object outlines).

[0096] Adversarial loss functions can improve the realism of details by evaluating the similarity of generated images and high-resolution images in local texture through a discriminator. For example, adversarial loss functions can be implemented by constructing an adversarial training framework between the generator (i.e., the initial resolution model) and the discriminator. The discriminator is responsible for distinguishing between the enhanced image output by the initial resolution model and the real high-resolution image, while the generator continuously optimizes its parameters through adversarial training, making the texture details (such as hair texture, fabric texture, skin texture, etc.) of the output image infinitely close to the real high-resolution image, thus improving the realism of the image.

[0097] Style loss functions can calculate differences in the stylistic features of an image (such as color distribution, texture patterns, and brushstroke style) to ensure that the enhanced image maintains stylistic consistency with the original layer image or the target style. For example, for a cartoon-style layer image, a style loss function can ensure that after resolution enhancement, the image still retains the characteristics of a cartoon style, such as simple lines and bright colors, avoiding style shift.

[0098] The initial resolution model can be, but is not limited to, using a denoising diffusion probability model. High-quality images are generated through a stepwise denoising process, and the model parameters are further optimized by combining the aforementioned loss function.

[0099] It should be noted that the initial resolution model is a denoising diffusion probability model trained using a pixel-level loss function. The pixel-level loss function is used to indicate the pixel-level similarity between the image output by the untrained neural network model and the high-resolution image, and can be implemented using a mean squared error loss function. Specifically, the denoising diffusion probability model is a backbone network based on the U-Net architecture. In this embodiment, multiple residual connections are added to the basic backbone network, an attention mechanism is added to capture long-range dependencies, and a conditional control mechanism is introduced to allow the generation process to be adjusted according to the characteristics of the input image.

[0100] Furthermore, the target resolution model can be trained through the following steps:

[0101] Construct a resolution training set, which includes multiple low-resolution images and the corresponding high-resolution images for each low-resolution image;

[0102] Based on the pixel-level loss function, the first resolution model (i.e., the untrained denoising and diffusion probability model) is trained using a resolution training set to obtain the second resolution model (i.e., the initial resolution model). The first resolution model is the denoising and diffusion probability model, and the pixel-level loss function is used to indicate the pixel-level similarity between the output image of the first resolution model and the high-resolution image. The pixel-level loss function can be implemented using the mean squared error loss function.

[0103] Based on the target loss function, the second resolution model is trained using the resolution training set to obtain the target resolution model.

[0104] In this embodiment, the second layer image (i.e., the first layer image to be enhanced) is input into the trained target resolution model. The model, through an internal denoising diffusion process, supplements details and enhances the resolution of the low-resolution second layer image, outputting a third layer image. The third layer image is an image with enhanced resolution of the second layer image (e.g., enhancing a layer image with an initial resolution of 1024x1024 to 4096x4096, while maintaining high quality in image details, texture, and style). Then, this high-resolution third layer image replaces the corresponding second layer image in the original first image file, thereby obtaining a second image file containing a high-resolution layer.

[0105] In this embodiment, by employing a target resolution model trained with a multidimensional loss function, the enhanced image maintains a high degree of consistency in visual semantics, texture details, and stylistic features. Furthermore, by replacing layers to obtain a new image file, the image's editability is preserved, facilitating further adjustments.

[0106] In one embodiment of this application, the target editing type is a second editing type. Specifically, step 104, which involves performing a target editing operation on the second layer image corresponding to the target editing type to obtain a second image file, may include:

[0107] Feature extraction is performed on the first layer image and the related layer images of the first layer image to obtain the first feature point corresponding to the first layer image and the second feature point corresponding to the related layer image;

[0108] The first feature point and the second feature point are matched to obtain the matching relationship between each feature point between the first feature point and the second feature point;

[0109] Based on the matching relationship, the spatial relationship between the first layer image and the related layer image is obtained. The spatial relationship is used to indicate the position change information of the feature points in the related layer image that match the target feature points when the target feature points in the first layer image change.

[0110] Based on the spatial relationship, target editing operations corresponding to the target editing type are performed on the second layer image.

[0111] Feature extraction can employ algorithms such as Scale-Invariant Feature Transform (SIFT) or an efficient Oriented Fast and Rotated BRIEF (ORB) algorithm to extract the coordinate information of image edges, corners, or texture regions as feature points.

[0112] Feature point matching can employ a Fast Library for Approximate Nearest Neighbors (FLANN) or a Brute-Force Matcher (BFMatcher), combined with the Random Sample Consensus (RANSAC) algorithm, to filter and establish a high-confidence feature point matching relationship. Specifically, firstly, the FLANN algorithm or BFMatcher is used to quickly find all possible feature point matching pairs between the layers of images. Then, the RANSAC algorithm is used to automatically identify and eliminate erroneous matches from a large number of preliminary matches, while simultaneously finding the mathematical model that best describes the geometric transformation relationships (such as rotation, translation, and scaling) between the layers. Finally, high-confidence feature point matching pairs are obtained.

[0113] Spatial relationships can be achieved by calculating the affine transformation matrix of high-confidence feature point matching pairs or using a thin-plate spline model. Spatial relationships are used to indicate the positional changes of feature points matching the target feature points in related layer images when the target feature points in the first layer image change.

[0114] Subsequently, based on the established spatial relationships, positional transformation information is automatically propagated, maintaining global spatial consistency when performing local editing on the second layer image. This ensures the structural integrity and visual harmony of the overall image when layers are operated independently.

[0115] Specifically, when a user rotates the first layer image, the feature points in that layer are first extracted as the first feature points. Simultaneously, related layers with overlapping or connected areas are identified, and the second feature points of their corresponding areas are extracted. The first and second feature points are then matched to establish a mapping relationship, for example, determining the coordinates of a corner point in the first layer and its corresponding corner point in a related layer. Subsequently, based on all matching point pairs, the spatial relationships of the first layer image are obtained. During the editing phase, not only is the rotation angle of the first layer image adjusted, but related layer images are also synchronously rotated and translated according to the spatial relationships, ensuring alignment at the connection points of the two layers.

[0116] In this embodiment, collaborative editing of multiple related layers ensures spatial consistency between layers, improves the accuracy and efficiency of image editing, and avoids inconsistencies caused by manually adjusting multiple layers. Furthermore, the feature point matching-based method is applicable to various complex layer relationships, enhancing the flexibility and applicability of editing operations.

[0117] In one embodiment of this application, when the target image generation instruction includes multiple image generation sub-instructions, each sub-instruction may correspond to a different initial style, leading to style conflicts during the generation process and making it difficult to form a unified target style image. Specifically, after receiving the target image generation instruction in step 101 and before generating the first image file in response to the target image generation instruction in step 102, the image generation method provided in this application embodiment may further include:

[0118] Obtain the initial style corresponding to each of the image generation sub-instructions;

[0119] If the initial styles corresponding to each of the image generation sub-instructions are different, the target style is determined from the multiple initial styles according to the preset style priority.

[0120] Image generation sub-instructions can be obtained through user input, and each sub-instruction carries independent initial style information. It is determined whether the initial styles corresponding to each image generation sub-instruction are different. If all initial styles are identical (e.g., all image generation sub-instructions correspond to the initial style of "Guangzhou porcelain style"), then that initial style is directly determined as the target style; if the initial styles are different (e.g., some sub-instructions correspond to "Guangzhou porcelain style" and some correspond to "realistic style"), then the target style is determined from multiple initial styles according to a preset style priority.

[0121] The preset style priority can be set in advance according to user habits, image application scenarios, or default rules, and is not limited here.

[0122] For example, the user-input target image generation instruction includes three image generation sub-instructions, used to generate layer images in the styles of Guangcai porcelain, oil painting, and sketch, respectively. The initial styles corresponding to these three sub-instructions are obtained as Guangcai porcelain, oil painting, and sketch, respectively. Since the three initial styles are different, according to a pre-defined style priority table, the Guangcai porcelain style is determined to have the highest priority, and therefore, the Guangcai porcelain style is determined as the final target style.

[0123] In this embodiment, upon receiving a target image generation instruction containing multiple sub-instructions of different styles, the final target style is automatically determined based on a preset style priority, thereby avoiding style conflicts and improving the consistency and aesthetics of the generated image. Simultaneously, it preserves the user's need for multiple styles, ensuring overall style consistency while still allowing different artistic style elements to be reflected in different layers, enhancing the richness and editability of the generated image.

[0124] In one embodiment of this application, when it is necessary to generate an image of a specific target style, directly using an unadjusted initial image generation model may lead to a deviation between the generated result and the target style, and retraining the entire model for different styles will consume a lot of computing resources. Therefore, in step 102, in response to the target image generation instruction, generating a first image file includes:

[0125] The target image generation instruction is input into the target image generation model to obtain the first image file;

[0126] The target image generation model is trained through the following steps:

[0127] Based on the target style, a style image training set is constructed, which includes several images of the target style;

[0128] Based on the style image training set, the initial image generation model is adjusted using a low-rank adaptive method to obtain the target image generation model, wherein the initial image generation model is a neural network model trained with images of different styles.

[0129] The style image training set is a small dataset containing 15 to 50 high-resolution target style images.

[0130] The low-rank adaptive approach introduces a low-rank decomposition matrix into the weight matrix of the initial image generation model, and fine-tunes the model by adjusting the parameters of the decomposition matrix.

[0131] The initial image generation model can be a pre-trained model based on a diffusion probability framework, which already has the ability to generate multiple styles.

[0132] Specifically, the main weights of the initial image generation model are frozen using a low-rank adaptive approach, with only small trainable matrices added next to key linear layers to form a low-rank decomposition structure. During training, only these small matrix parameters, which account for a very small proportion of the original model, are updated, and training is completed using 15-50 high-quality style-specific images. The resulting adapter file is small in size and can be combined with the base model at any time, allowing the final target image generation model to maintain the initial image generation model's responsiveness to text commands while efficiently acquiring style-specific generation capabilities.

[0133] In practical applications, when a user inputs a target image generation instruction, the instruction is fed into the trained target image generation model. The model generates an independent layer image that conforms to the target style and contains content information and an alpha channel, thus obtaining the first image file.

[0134] In other implementations, if the target image generation instruction contains multiple generation sub-instructions, these sub-instructions are executed sequentially through a queue processing method to avoid interference or overwriting between multiple sub-instructions. At the same time, independent computing resources are allocated to each sub-instruction, and the responsiveness of the front-end interface is ensured through an asynchronous processing mechanism, and real-time task status feedback is provided.

[0135] Furthermore, the queue manager can dynamically adjust the execution order based on the priority of sub-instructions and the load of electronic devices to optimize overall processing efficiency while maintaining the integrity and independence of the execution of each generated sub-instruction.

[0136] The priority of sub-instructions can be set according to the layer level, for example, the priority of the first layer is higher than the priority of the second layer. It can also be determined according to the content contained in the instruction, for example, the priority of background element instructions is higher than the priority of a single specific item. It can also be set according to the actual situation, without specific limitations here.

[0137] In this embodiment, the model pre-trained on a large general dataset is further trained on a small dataset in the specific domain to achieve knowledge transfer, thereby improving the generation quality and generalization ability of the model on the specific task.

[0138] In one embodiment of this application, when generating a target image, the user may need to output the image in different file formats for different application scenarios. Specifically, generating the target image based on the second image file in step 105 includes:

[0139] Receive a target image output instruction, wherein the target image output instruction is used to indicate the target file format for the target image output;

[0140] In response to the target image output instruction, when the target image output instruction indicates that the target file format is an editable image format, the target image and the second image file are output; the target image is obtained by fusing the images of each layer in the second image file.

[0141] The target file formats include editable image formats and non-editable image formats. Editable image formats are those that support layer separation and independent modification, such as PSD or Scalable Vector Graphics (SVG) formats; non-editable image formats are bitmap formats with merged layers, such as JPEG or PNG formats.

[0142] The target image output command includes identification information for the target file format.

[0143] The second image file is an editable file containing multiple layers of images, each layer retaining its original generation parameters and spatial relationships.

[0144] When the target file format is an editable image format, the output is the fused target image and the unfused second image file, ensuring that the user can directly perform subsequent editing based on the second image file.

[0145] Specifically, after generating the target image, the system receives the target file format selected by the user. If the user selects an editable image format, the layers in the second image file are merged into the target image according to a preset overlay order, and the target image is then stored in association with the second image file. For example, if the user selects the PSD format, a PSD file containing information about all layers and a corresponding JPEG preview image are generated. The user can open the PSD file with professional software and independently adjust the resolution, position, or content of any layer without regenerating the entire image.

[0146] In other implementations, when the target file format is non-editable, the images of each layer in the second image file are merged to obtain the target image. Specifically, the layers in the second image file can be merged into the target image according to a preset stacking order.

[0147] In this embodiment, by preserving the layer structure and editing parameters, the problem of difficulty in modifying the generated image after it has been solidified is solved. At the same time, it is compatible with the needs of different output scenarios, improving the practicality and flexibility of the image generation method.

[0148] The following provides an example of the image generation method provided in the embodiments of this application.

[0149] When the image generation method provided in this application is applied to an electronic device, the electronic device can be used as an interactive auxiliary design platform, such as... Figure 2 As shown, Figure 2 This is a schematic diagram of the implementation process when the image generation method is applied to an electronic device, where (a) is a drawing diagram, (b) is a display diagram after the layer image is generated, (c) is a diagram of the layer image selection and calling, and (d) is a display diagram of the target image.

[0150] The implementation process of this invention will be illustrated by taking as an example a designer uses the aforementioned electronic device (interactive assisted design platform) to create a "Guangcai porcelain" pattern that can be used for product design.

[0151] The first step, model preparation and retrieval: The model fine-tuning and management module in the interactive assisted design platform has pre-trained a "Guangcai Porcelain Model" (target image generation model) through the aforementioned training steps for the target image model. The specific training process is as follows: A small dataset containing approximately 30 high-resolution Guangcai porcelain images is collected, and a general pre-trained text-to-image diffusion model (such as Stable Diffusion) is fine-tuned using low-rank adaptation (LoRA). By making small-scale parameter adjustments and training to the Cross-Attention layer in the model's weight matrix, it accurately grasps the unique "woven gold porcelain" color system, delicate brushstrokes, and traditional composition style of Guangcai porcelain. This fine-tuned "Guangcai Porcelain Model" is stored in the module for later retrieval.

[0152] The second step involves user-issued instructions and multi-level generation: Designers input multi-level instructions into the text input boxes of the platform's interactive canvas and output module, such as: "The main subject is a pastel peony, which can be decorated with one or two birds." The platform's instruction parsing module receives this instruction, or the designer can pre-draw an image, such as... Figure 2 As shown in (a), the multi-level instructions are broken down into two independent layer generation tasks:

[0153] Task 1 (Layer 1): Generate "Pastel Peony";

[0154] Task 2 (Layer 2): Generate "one or two birds".

[0155] Subsequently, the multi-layer generation and editing engine calls the prepared "Guangcai porcelain model" in parallel to perform these two tasks. An independent layer image with an alpha channel is generated for each task. That is, a "peony flower layer" and a "bird layer" are generated, both of which present a unified Guangcai porcelain style. Furthermore, in this embodiment, to provide users with multiple options, such as... Figure 2 As shown in (b), both tasks generated a variety of layer images for the user to choose from.

[0156] The third step, interactive editing and refinement: First, a blank canvas (plate) can be provided for the designer to design the pattern, such as outlining elements like flowers and leaves. Then, the multiple image layers generated in the second step are presented below for the designer to choose from. The designer can apply these image layers to the plate for decorative drawing, such as... Figure 2 As shown in (c), finished porcelain plates with exquisite floral and bird patterns are gradually presented, demonstrating the digital creation process from design conception to pattern application, and finally to the completion of porcelain decoration.

[0157] Step 4: Super-Resolution Enhancement and Final Output: After evaluating the composition, the designer determined that the bird's feather details needed to be clearer to meet the requirements of high-definition printing on the silk scarf. The "Bird Layer" was selected, and then the "Super-Resolution" button on the front-end interface was clicked. The platform's super-resolution module was activated, calling the built-in diffusion model algorithm (i.e., the target resolution model) to specifically process the selected "Bird Layer." Through iterative denoising, the model intelligently generated rich high-frequency details, such as the filamentous texture of the feathers and image shadows, while maintaining the original shape and style of the bird. This process increased the resolution of the bird image from, for example, 1024x1024 to 4096x4096 without affecting the clarity of other layers (such as the peony flower layer).

[0158] Step 5: After completing all adjustments, the final styles of multiple images designed by the designer will be displayed on the canvas interface, such as... Figure 2 As shown in (d), the designer clicks the "Export" button: Designers can select export options in the interactive canvas and output module, choosing "Export as PSD file." This completely packages all layers on the canvas (one high-resolution butterfly layer and two standard-resolution peony flower layers) along with their positions, sizes, rotations, and other information into a single PSD file. This file can be directly opened in professional image editing software, and all layers remain independently editable, making it ready for subsequent production plate making. Through this example, the designer efficiently completed a complex, high-precision, stylistically consistent, and fully editable Guangcai porcelain pattern in just a few minutes, seamlessly transforming personalized model generation content into digital assets directly usable for commercial production, greatly improving design efficiency and innovation capabilities.

[0159] Figure 3 A structural diagram of the image generation apparatus provided in an embodiment of this application is shown. Figure 3 As shown, the image generating apparatus 300 includes:

[0160] The first receiving module 301 is used to receive a target image generation instruction; the target image generation instruction is used to instruct the generation of a target image of a target style.

[0161] The first generation module 302 is configured to generate a first image file in response to the target image generation instruction; the first image file includes multiple layer images for generating the target image;

[0162] The second receiving module 303 is used to receive editing instructions for the first layer image among the plurality of layer images;

[0163] Image editing module 304 is configured to respond to the editing instruction, determine the target editing type corresponding to the editing instruction, and perform a target editing operation corresponding to the target editing type on the second layer image to obtain a second image file; wherein, when the target editing type is a first editing type that only applies to the first layer image, the second layer image is the first layer image; when the target editing type is a second editing type that applies to the first layer image and related layer images of the first layer image, the second layer image includes the first layer image and related layer images of the first layer image;

[0164] The image generation module 305 is used to generate the target image based on the second image file.

[0165] In one embodiment of this application, the image editing module 304 includes:

[0166] The type determination submodule is used to determine the target editing type corresponding to the editing instruction based on the target editing operation on the first layer image indicated by the editing instruction;

[0167] Wherein, when the target editing operation is used to adjust the content attributes of the first layer image, the target editing type is determined to be the first editing type, and the content attributes include at least one of resolution, color parameters, and sharpness;

[0168] In the case where the target editing operation is used to adjust the spatial attributes of the first layer image and / or the layer stacking order, the target editing type is determined to be the second editing type; the spatial attributes include at least one of position, size, and rotation angle.

[0169] In one embodiment of this application, the target editing operation indicated by the editing instruction is resolution enhancement;

[0170] Image editing module 304 includes:

[0171] The image generation submodule is used to input the second layer image into the target resolution model to obtain the third layer image, which is an image with enhanced resolution of the second layer image;

[0172] The image replacement submodule is used to replace the second layer image in the first image file with the third layer image to obtain the second image file;

[0173] The target resolution model is trained using a target loss function. The target loss function includes at least one of a perceptual loss function, an adversarial loss function, and a style loss function. The perceptual loss function indicates the visual semantic similarity between the output image of the initial resolution model and the high-resolution image. The adversarial loss function indicates the image texture similarity between the output image of the initial resolution model and the high-resolution image. The style loss function indicates the image style similarity between the output image of the initial resolution model and the high-resolution image. The initial resolution model is a denoising diffusion probability model.

[0174] In one embodiment of this application, the target editing type is the second editing type;

[0175] Image editing module 304 includes:

[0176] The feature extraction submodule is used to extract features from the first layer image and the related layer images of the first layer image respectively, to obtain the first feature point corresponding to the first layer image and the second feature point corresponding to the related layer image;

[0177] The feature matching submodule is used to match the first feature point and the second feature point to obtain the matching relationship between each feature point between the first feature point and the second feature point;

[0178] The relationship determination submodule is used to obtain the spatial relationship between the first layer image and the related layer image based on the matching relationship. The spatial relationship is used to indicate the position change information of the feature points in the related layer image that match the target feature points when the target feature points in the first layer image change.

[0179] The image editing submodule is used to perform target editing operations on the second layer image based on the spatial relationship, corresponding to the target editing type.

[0180] In one embodiment of this application, the target image generation instruction includes at least two image generation sub-instructions, each of which is used to instruct the generation of an initial style layer image;

[0181] The image generating apparatus 300 also includes:

[0182] The style acquisition module is used to acquire the initial style corresponding to each of the image generation sub-instructions;

[0183] The style determination module is used to determine the target style from multiple initial styles according to a preset style priority if the initial styles corresponding to each of the image generation sub-instructions are different.

[0184] In one embodiment of this application, the first generation module 302 includes:

[0185] The image generation submodule is used to input the target image generation instruction into the target image generation model to obtain the first image file;

[0186] The target image generation model is trained through the following steps:

[0187] Based on the target style, a style image training set is constructed, which includes several images of the target style;

[0188] Based on the style image training set, the initial image generation model is adjusted using a low-rank adaptive method to obtain the target image generation model, wherein the initial image generation model is a neural network model trained with images of different styles.

[0189] In one embodiment of this application, the image generation module 305 includes:

[0190] The instruction receiving submodule is used to receive a target image output instruction, which indicates the target file format for the output target image.

[0191] An image output submodule is configured to respond to the target image output instruction and, when the target image output instruction indicates that the target file format is an editable image format, output the target image and the second image file; the target image is obtained by fusing the images of each layer in the second image file.

[0192] The image generation apparatus 300 provided in this application embodiment can implement the various processes implemented in the aforementioned image generation method embodiment and achieve the same technical effect. To avoid repetition, it will not be described again here.

[0193] Figure 4 A schematic diagram of the hardware structure of the electronic device provided in an embodiment of this application is shown.

[0194] The electronic device may include a processor 401 and a memory 402 storing computer program instructions.

[0195] Specifically, the processor 401 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.

[0196] Memory 402 may include mass storage for data or instructions. For example, and not limitingly, memory 402 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 402 may include removable or non-removable (or fixed) media. Where appropriate, memory 402 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 402 is non-volatile solid-state memory.

[0197] Memory may include read-only memory (ROM), random access memory (RAM), disk storage media devices, optical storage media devices, flash memory devices, and electrical, optical, or other physical / tangible memory storage devices. Therefore, typically, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the methods according to the first or second aspect of this disclosure.

[0198] The processor 401 implements any of the information auditing methods described in the above embodiments by reading and executing computer program instructions stored in the memory 402.

[0199] In one example, the electronic device may also include a communication interface 403 and a bus 410. For example, Figure 4 As shown, the processor 401, memory 402, and communication interface 403 are connected through bus 410 and complete communication with each other.

[0200] The communication interface 403 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.

[0201] Bus 410 includes hardware, software, or both, that couples components of an information auditing method or verification device together. For example, and not as a limitation, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 410 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, any suitable bus or interconnect is contemplated herein.

[0202] Furthermore, in conjunction with the image generation methods described in the above embodiments, this application embodiment can provide a computer storage medium for implementation. This computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the image generation methods described in the above embodiments.

[0203] Alternatively, this application embodiment can provide a computer program product for implementation, wherein the instructions in the computer program product, when executed by the processor of an electronic device, cause the electronic device to implement any of the image generation methods in the above embodiments.

[0204] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described as examples. However, the method process of this application is not limited to the specific steps described. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.

[0205] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0206] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0207] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, 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, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0208] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.

Claims

1. An image generation method, characterized in that, include: Receive the target image generation instruction; The target image generation instruction is used to instruct the generation of a target image in a target style; In response to the target image generation instruction, a first image file is generated; the first image file includes multiple layer images for generating the target image; Receive editing instructions for the first layer image among the plurality of layer images; In response to the editing instruction, a target editing type corresponding to the editing instruction is determined, and a target editing operation corresponding to the target editing type is performed on the second layer image to obtain a second image file; wherein, if the target editing type is a first editing type that only applies to the first layer image, the second layer image is the first layer image; if the target editing type is a second editing type that applies to the first layer image and related layer images of the first layer image, the second layer image includes the first layer image and related layer images of the first layer image; The target image is generated based on the second image file; The target editing type is the second editing type; The step of performing a target editing operation on the second layer image corresponding to the target editing type to obtain a second image file includes: Feature extraction is performed on the first layer image and the related layer images of the first layer image to obtain the first feature point corresponding to the first layer image and the second feature point corresponding to the related layer image; The first feature point and the second feature point are matched to obtain the matching relationship between each feature point between the first feature point and the second feature point; Based on the matching relationship, the spatial relationship between the first layer image and the related layer image is obtained. The spatial relationship is used to indicate the position change information of the feature points in the related layer image that match the target feature points when the target feature points in the first layer image change. Based on the spatial relationship, perform target editing operations on the second layer image that correspond to the target editing type; The target image generation instruction includes at least two image generation sub-instructions, each of which is used to instruct the generation of an initial style layer image; After receiving the target image generation instruction and before generating the first image file in response to the target image generation instruction, the method further includes: Obtain the initial style corresponding to each of the image generation sub-instructions; If the initial styles corresponding to each of the image generation sub-instructions are different, the target style is determined from the multiple initial styles according to the preset style priority.

2. The method according to claim 1, characterized in that, Determining the target editing type corresponding to the editing instruction includes: Based on the target editing operation on the first layer image indicated by the editing instruction, determine the target editing type corresponding to the editing instruction; Wherein, when the target editing operation is used to adjust the content attributes of the first layer image, the target editing type is determined to be the first editing type, and the content attributes include at least one of resolution, color parameters, and sharpness; In the case where the target editing operation is used to adjust the spatial attributes of the first layer image and / or the layer stacking order, the target editing type is determined to be the second editing type; the spatial attributes include at least one of position, size, and rotation angle.

3. The method according to claim 1, characterized in that, The editing instruction indicates that the target editing operation is resolution enhancement; The step of performing a target editing operation on the second layer image corresponding to the target editing type to obtain a second image file includes: The second layer image is input into the target resolution model to obtain the third layer image, which is an image with enhanced resolution of the second layer image; The second image file is obtained by replacing the second layer image in the first image file with the third layer image; The target resolution model is trained using a target loss function. The target loss function includes at least one of a perceptual loss function, an adversarial loss function, and a style loss function. The perceptual loss function indicates the visual semantic similarity between the output image of the initial resolution model and the high-resolution image. The adversarial loss function indicates the image texture similarity between the output image of the initial resolution model and the high-resolution image. The style loss function indicates the image style similarity between the output image of the initial resolution model and the high-resolution image. The initial resolution model is a denoising diffusion probability model.

4. The method according to claim 1, characterized in that, The step of generating a first image file in response to the target image generation instruction includes: The target image generation instruction is input into the target image generation model to obtain the first image file; The target image generation model is trained through the following steps: Based on the target style, a style image training set is constructed, which includes several images of the target style; Based on the style image training set, the initial image generation model is adjusted using a low-rank adaptive method to obtain the target image generation model, wherein the initial image generation model is a neural network model trained with images of different styles.

5. The method according to claim 1, characterized in that, The step of generating the target image based on the second image file includes: Receive a target image output instruction, wherein the target image output instruction is used to indicate the target file format for the target image output; In response to the target image output instruction, when the target image output instruction indicates that the target file format is an editable image format, the target image and the second image file are output; the target image is obtained by fusing the images of each layer in the second image file.

6. An image generation apparatus, characterized in that, include: The first receiving module is used to receive the target image generation instruction; The target image generation instruction is used to instruct the generation of a target image in a target style; A first generation module is configured to generate a first image file in response to the target image generation instruction; the first image file includes multiple layer images used to generate the target image; The second receiving module is used to receive editing instructions for the first layer image among the multiple layer images; An image editing module is configured to respond to the editing instruction, determine the target editing type corresponding to the editing instruction, and perform a target editing operation corresponding to the target editing type on the second layer image to obtain a second image file; wherein, when the target editing type is a first editing type that only applies to the first layer image, the second layer image is the first layer image; when the target editing type is a second editing type that applies to the first layer image and related layer images of the first layer image, the second layer image includes the first layer image and related layer images of the first layer image; An image generation module is used to generate the target image based on the second image file; The target editing type is the second editing type; The image editing module further includes: The feature extraction submodule is used to extract features from the first layer image and the related layer images of the first layer image respectively, to obtain the first feature point corresponding to the first layer image and the second feature point corresponding to the related layer image; The feature matching submodule is used to match the first feature point and the second feature point to obtain the matching relationship between each feature point between the first feature point and the second feature point; The relationship determination submodule is used to obtain the spatial relationship between the first layer image and the related layer image based on the matching relationship. The spatial relationship is used to indicate the position change information of the feature points in the related layer image that match the target feature points when the target feature points in the first layer image change. The image editing submodule is used to perform target editing operations on the second layer image based on the spatial relationship, corresponding to the target editing type. The target image generation instruction includes at least two image generation sub-instructions, each of which is used to instruct the generation of an initial style layer image; The image generating apparatus further includes: The style acquisition module is used to acquire the initial style corresponding to each of the image generation sub-instructions; The style determination module is used to determine the target style from multiple initial styles according to a preset style priority if the initial styles corresponding to each of the image generation sub-instructions are different.

7. An electronic device, characterized in that, include: Processor and memory storing computer program instructions; When the processor executes the computer program instructions, it implements the image generation method as described in any one of claims 1-5.

8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the image generation method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Image generation method and terminal device

    CN110136216A

  • Multi-layer image generation method and device and storage medium

    CN120388087A