Image generation method, device and electronic equipment
By extracting high-level semantic feature vectors of the reference image and denoising the noise image, a target image similar in style to the reference image is generated, which solves the problem of difficulty in generating images according to user needs with existing technology and improves the effect and richness of image generation. sex.
Patent Information
- Application Number
- CN202211633511.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-19
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2042-12-19
AI Technical Summary
Existing image generation technologies, such as GAN and VAE, are difficult to generate images according to user needs, and are especially difficult to meet the needs of some special scenarios. For example, generating a series of images with similar content, theme, and style does not work well.
By obtaining the reference image provided by the user, extracting its high-level semantic feature vectors, and performing multi-step denoising processing on the noise image based on these feature vectors, a target image with part of the same high-level semantic information as the reference image is generated.
It improves the effect of image generation and provides users with richer ways to generate images. It can generate a series of images with a similar style based on the reference image input by the user.
Smart Images

Figure CN115965791B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to an image generating method, device and electronic device. Background Art
[0002] With the application and development of artificial intelligence technology in the field of images, image generation technology has emerged. At present, there is a large demand for purposeful image generation according to user needs. In related technologies, images are generally generated based on technologies such as GAN and VAE, but it is difficult to generate images according to user needs, and it is difficult to meet the needs of some special scenes, which has great limitations. Therefore, there is a need for a solution that can generate images according to user needs. Summary of the invention
[0003] The present disclosure provides an image generating method, an apparatus and an electronic device.
[0004] According to a first aspect, there is provided an image generation method, the method comprising:
[0005] Acquire a reference image and a first noise image;
[0006] Obtaining a reference feature vector corresponding to the reference image;
[0007] The first noisy image is denoised based on the reference feature vector to obtain a target image that is a variant of the reference image; the target image and the reference image have partially the same high-level semantic information.
[0008] According to a second aspect, there is provided an image generating device, the device comprising:
[0009] An acquisition module, used for acquiring a reference image and a first noise image;
[0010] An extraction module, used for obtaining a reference feature vector corresponding to the reference image;
[0011] A processing module is used to perform denoising on the first noisy image based on the reference feature vector to obtain a target image that is a variant of the reference image; the target image and the reference image have part of the same high-level semantic information.
[0012] According to a third aspect, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of the above-mentioned first aspects is implemented.
[0013] According to a fourth aspect, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in any one of the first aspects is implemented.
[0014] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0015] The embodiments of the present disclosure provide an image generation method and device, which obtains a reference image and a first noise image, obtains a reference feature vector corresponding to the reference image, and performs denoising on the first noise image based on the reference feature vector to obtain a target image after the reference image is modified, and the target image and the reference image have some of the same high-level semantic information. Since the embodiment uses the reference image input by the user as a condition for image generation, guides the generation of the image, and obtains a target image with some of the same high-level semantic information as the reference image, the image generation effect is improved, and a richer image generation path is provided for the user.
[0016] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0018] Figure 1 is a schematic diagram of a scene of image generation according to an exemplary embodiment of the present disclosure;
[0019] Figure 2 is a flowchart of an image generating method according to an exemplary embodiment of the present disclosure;
[0020] Figure 3 is a schematic diagram of an example of image generation according to an exemplary embodiment of the present disclosure;
[0021] Figure 4 is a block diagram of a generating method device according to an exemplary embodiment of the present disclosure;
[0022] Figure 5 is a schematic block diagram of an electronic device provided by some embodiments of the present disclosure;
[0023] Figure 6 is a schematic block diagram of another electronic device provided by some embodiments of the present disclosure;
[0024] Figure 7 is a schematic diagram of a storage medium provided in some embodiments of the present disclosure. DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
[0026] When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are only examples of devices and methods consistent with some aspects of the present disclosure as detailed in the attached claims.
[0027] The terms used in this disclosure are only for the purpose of describing specific embodiments and are not intended to limit the disclosure. The singular forms of "a", "the" and "the" used in this disclosure are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0028] It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0029] With the application and development of artificial intelligence technology in the field of images, image generation technology has emerged. At present, there are a large number of needs for purposeful image generation based on user needs. In related technologies, images are generally generated based on technologies such as GAN and VAE, but it is difficult to generate images according to user needs and it is difficult to meet the needs of some special scenes, which has great limitations. For example, when a designer creates an image work with his own style, he wants to get a series of images with similar content, theme, and style. It is impossible to generate an ideal series of images based on technologies such as GAN and VAE.
[0030] The present disclosure provides an image generation method, which can use a reference image input by a user as a condition for image generation, guide image generation, and obtain a target image having part of the same high-level semantic information as the reference image, thereby improving the image generation effect and providing users with a richer image generation path.
[0031] See also Figure 1 , is a schematic diagram of a scene of image generation according to an exemplary embodiment. Figure 1 , the scheme of the present disclosure is schematically illustrated.
[0032] like Figure 1 As shown, first, the user can provide a reference image P as a condition for guiding image generation. The reference image P is input into the model M11, model M12...model M1n respectively to extract multiple different high-level semantic feature vectors corresponding to the reference image P. The multiple high-level semantic feature vectors may include vector Rp1, vector Rp2...vector Rpn. The multiple high-level semantic feature vectors may be stacked to obtain a reference vector Rp. It should be noted that the model M11, model M12...model M1n are models of the same type but with different parameters. These models can extract corresponding feature vectors for different high-level semantics in the image.
[0033] In addition, a noise image S is obtained, which can be a randomly generated Gaussian white noise image. The reference vector Rp and the noise image S are input into the model M2 together. The model M2 can be a pre-trained diffusion model. The model M2 can perform a one-step denoising operation on the noise image S according to the reference vector Rp to obtain an image S1. Image S1 is an image obtained by removing a small part of the noise from the noise image S. Therefore, image S1 still includes a large amount of noise. Image S1 and the reference vector Rp are input into the model M2 again. The model M2 can perform a one-step denoising operation on the image S1 according to the reference vector Rp to obtain an image S2. The subsequent similar process is analogous and will not be repeated here. Finally, after denoising processing by multiple models M2, the initial image A can be obtained. The initial image A can be an image with a lower resolution, for example, an image with a resolution of 64*64.
[0034] Next, obtain a noise image B, which can also be a randomly generated Gaussian white noise image. The initial image A can be upsampled first to obtain an image with a higher resolution than the initial image A, and then the image obtained after upsampling is stacked with the noise image B to obtain the image A1 to be processed. The image A1 to be processed is input into the model M31, which can be a diffusion model for super-resolution processing of images. The model M31 can perform a one-step denoising operation on the image A1 to be processed to obtain image A2. Image A2 is then input into the model M31, which can perform a one-step denoising operation on image A2 to obtain image A3. Similar processes are followed and are not repeated here. Finally, after denoising processing by multiple models M31, an intermediate image C can be obtained. The resolution of the intermediate image C is higher than that of the initial image A. For example, the intermediate image C can be an image with a resolution of 256*256.
[0035] Finally, a noise image D of randomly generated Gaussian white noise is obtained. The intermediate image C can be upsampled first to obtain an image with a higher resolution than the intermediate image C, and then the image obtained after upsampling is stacked with the noise image D to obtain the image to be processed C1. The image to be processed C1 is input into the model M32. The model M32 can also be a diffusion model for super-resolution processing of the image. The model M32 can perform a one-step denoising operation on the image to be processed C1 to obtain the image C2. The image C2 is then input into the model M32. The model M32 can perform a one-step denoising operation on the image C2 to obtain the image C3. The subsequent similar process is analogous and will not be repeated here. Finally, after denoising processing by multiple models M32, the target image can be obtained. The resolution of the target image is higher than that of the intermediate image C. For example, the target image can be an image with a resolution of 1024*1024.
[0036] It should be noted that the model M11, model M12 ... model M1n, model M2, model M31 and model M32 can be trained separately, or they can be trained together, or they can be roughly trained separately and then put together for training. Specifically, a sample image can be obtained first, and then a matching image corresponding to the sample image can be obtained. For example, the matching image corresponding to the sample image can be drawn manually or using P-picture software. For another example, a preset image processing algorithm can be used to draw the matching image corresponding to the sample image. For another example, a series of image materials can be searched to select sample images and matching images from them. It can be understood that the matching image corresponding to the sample image can also be obtained by any other reasonable method, and this embodiment is not limited to this aspect.
[0037] Then, follow Figure 1The information flow shown in the figure is reversed to perform multiple steps of noise addition operations on the sample image, then downsampling, and then multiple steps of noise addition operations after downsampling. A small amount of Gaussian white noise is added to each step of noise addition operation, and finally a sample noise image is obtained. Then the sample noise image and the sample image are processed according to Figure 1 The information flows shown are respectively input into the corresponding models to be trained, and the prediction loss is calculated based on the output results. The model parameters of the model to be trained are adjusted according to the prediction loss, thereby completing the training of the model.
[0038] The present disclosure will be described in detail below in conjunction with specific embodiments.
[0039] Figure 2 The flowchart of an image generation method according to an exemplary embodiment is shown. The execution subject of the method can be implemented as any device, platform, server or device cluster with computing and processing capabilities. The method includes the following steps:
[0040] like Figure 2 As shown, in step 201, a reference image and a first noise image are acquired.
[0041] In this embodiment, the first noise image may be an image randomly generated using Gaussian white noise, and this embodiment does not limit the specific generation method of the first noise image. The reference image may be a comparison image provided by a user, and the target image may be generated by comparing some high-level semantic information of the reference image. For example, a user may pre-create an image of a cat playing with a ball, and use the image as a reference image to generate a series of variant images related to the cat playing with a ball, and the posture of the cat playing with the ball in the variant images may be different.
[0042] In step 202, a reference feature vector corresponding to a reference image is obtained.
[0043] In one implementation, a pre-trained first model can be used to extract a high-level semantic feature vector corresponding to a reference image as a reference feature vector. The first model may be a model capable of extracting features for high-level semantics in an image, for example, the first model may be a clip model. In another implementation, multiple different first models may be used to extract multiple different high-level semantic feature vectors corresponding to a reference image, and the multiple different high-level semantic feature vectors are stacked (concat) to obtain a reference feature vector. The multiple different first models can extract corresponding feature vectors for different high-level semantics in an image. In this implementation, multiple different first models are used to extract multiple different high-level semantic feature vectors corresponding to a reference image, and the multiple different high-level semantic feature vectors are stacked, thereby improving the effect of extracting the style content of the reference image, so that the generated target image and the high-level semantics of the reference image are more closely related.
[0044] In step 203, the first noisy image is denoised based on the reference feature vector to obtain a target image that is a variant of the reference image. The target image and the reference image have part of the same high-level semantic information.
[0045] In this embodiment, based on the above reference feature vector, the noise image can be denoised according to the high-level semantic features of the reference image to obtain the target image. Figure 3 As shown, reference image 301 may be a material image provided by a user, and the image content is specifically a bridge on a river. By denoising different noise images according to reference image 301, different target images may be obtained. For example, by denoising noise image 302 according to reference image 301, target image 303 may be obtained. By denoising noise image 304 according to reference image 301, target image 305 may be obtained. Wherein, noise image 302 and noise image 304 are both randomly generated Gaussian white noise.
[0046] Specifically, in one implementation, a machine learning model or a preset algorithm may be used to perform one-step denoising on the first noise image based on the reference feature vector to obtain a target image. In another implementation, the first noise image may be denoised based on the reference feature vector using a pre-trained second model through a multi-step denoising operation to obtain a target image, and the second model may be a diffusion model.
[0047] In another implementation, the second model may be used to perform a multi-step denoising operation based on the reference feature vector to denoise the first noisy image to obtain an initial image with a lower resolution, and then at least one third model may be used to perform super-resolution processing on the initial image to obtain a target image with a higher resolution, and the third model may also be a diffusion model.
[0048] Specifically, on the one hand, using the second model to perform any denoising operation in the multiple operations may include the following operations: first, determining the image to be denoised, wherein if the denoising operation is the first denoising operation, the image to be denoised is the first noise image. If the denoising operation is not the first denoising operation, the image to be denoised is the processing result of the previous denoising operation.
[0049] Then, the time series vector corresponding to the denoising operation is determined, and the denoising image is denoised based on the reference feature vector and the time series vector using the second model. The time series vector (such as time embedding) can be a vector that can characterize the timing of the denoising operation in the above-mentioned multi-step denoising operation. For example, if the denoising operation is the nth step operation in the above-mentioned multi-step denoising operation, then the time series vector corresponding to the denoising operation is a vector that can characterize the nth step.
[0050] Specifically, the reference feature vector and the time series vector can be merged (for example, added) to obtain a conditional vector, and the second model is used to denoise the denoised image according to the conditional vector. It should be noted that in addition to the reference feature vector, other feature vectors and the reference feature vector can also be merged with the time series vector to obtain a conditional vector, and this embodiment is not limited to this aspect. Among them, the second model may include multiple network layers, and the multiple network layers include at least one first network layer. A cross-attention mechanism can be used to fuse the conditional vector with the hidden variables output by each first network layer, and the fused vector obtained after the fusion is input into the network layer after the first network layer. Among them, the first network layer can be any one or more network layers among the multiple network layers. Since the cross-attention mechanism is used in this embodiment to fuse the conditional vector with the hidden variables output by the network layer, it not only improves the ability of the second model to generate images, but also reduces the consumption of computing resources and improves the efficiency of image generation.
[0051] On the other hand, the initial image can be super-resolved using at least one third model in the following manner: first, a second noise image can be obtained, the initial image can be upsampled, and the image obtained after the upsampling process and the second noise image can be stacked (concat) to obtain an image to be processed. The number of channels of the image to be processed is the sum of the number of channels of the image obtained after the upsampling process and the second noise image. For example, if the number of channels of the image obtained after the upsampling process is three, and the number of channels of the second noise image is three, then the number of channels of the image to be processed is 6.
[0052] Then, at least one third model is used to perform denoising on the image to be processed to obtain a target image. Specifically, a third model can be used to perform multi-step denoising on the image to be processed to obtain an intermediate image, and the resolution of the intermediate image is higher than the resolution of the initial image. The intermediate image is then upsampled, and the image obtained after the upsampling process and the third noise image are stacked (concat). Another third model is used to perform multi-step denoising on the image obtained after the stacking process, so as to obtain a target image with a higher resolution than the intermediate image.
[0053] It should be noted that any third model may include an encoder and a decoder, and each of the encoder and the decoder includes multiple convolutional layers. In the process of denoising using the third model, it is necessary to use the encoder to perform a downsampling operation on the feature image, and use the convolutional layer included in the encoder to perform a convolutional operation on the feature image, and use the decoder to perform an upsampling operation on the feature image, and use the convolutional layer included in the decoder to perform a convolutional operation on the feature image. Among them, in the process of processing the feature image using the encoder, the downsampling operation can be performed first, and then the convolution operation can be performed. In the process of processing the feature image using the decoder, the convolution operation can be performed first, and then the upsampling operation can be performed. In this way, the amount of calculation in the convolution operation process can be reduced, the consumption of computing resources can be reduced, and the efficiency of image generation can be improved.
[0054] In addition, any third model may include multiple residual blocks, and a smaller number of residual blocks may be used to process feature images with higher resolution, and a larger number of residual blocks may be used to process feature images with lower resolution, thereby reducing the consumption of computing resources.
[0055] For this embodiment, a specific application scenario may be that a large number of image materials need to be referenced in graphic design or advertisement placement. The user can provide a reference image that is pre-selected or created, and then generate a series of material images with similar content, theme, and style around the reference image, making the material images richer.
[0056] Another specific application scenario is that a creator can first create an image work, and then use the solution provided by the present disclosure to generate a series of related images with similar content, theme, and style to the original creation. The creator can select some images from them for re-creation to obtain a better work.
[0057] This embodiment is not limited to the above-mentioned application scenarios, and can also be applied to other scenarios. The present disclosure provides an image generation method, which obtains a reference image and a first noise image, obtains a reference feature vector corresponding to the reference image, and generates a target image based on the reference feature vector and the first noise image, and the target image has some of the same high-level features as the reference image. Since this embodiment uses the reference image input by the user as a condition for image generation and guides the generation of the image, a target image having some of the same high-level semantic information as the reference image is obtained, thereby improving the image generation effect and providing users with a richer image generation approach.
[0058] It should be noted that although the operations of the method of the disclosed embodiment are described in a specific order in the above embodiments, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted in the flowchart can change the order of execution. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step for execution, and / or one step can be decomposed into multiple steps for execution.
[0059] Corresponding to the aforementioned image generating method embodiment, the present disclosure also provides an embodiment of an image generating device.
[0060] like Figure 4 As shown, Figure 4 4 is a block diagram of an image generating device according to an exemplary embodiment of the present disclosure. The device may include: an acquisition module 401, an extraction module 402 and a processing module 403.
[0061] The acquisition module 401 is used to acquire a reference image and a first noise image.
[0062] The extraction module 402 is used to obtain a reference feature vector corresponding to the reference image.
[0063] The processing module 403 is used to perform denoising on the first noisy image based on the reference feature vector to obtain a target image after the reference image is modified. The target image and the reference image have part of the same high-level semantic information.
[0064] In some implementations, the extraction module 402 may include: an extraction submodule and a stacking submodule (not shown in the figure).
[0065] The extraction submodule is used to obtain a plurality of different high-level semantic feature vectors corresponding to the reference image using a plurality of different first models.
[0066] The stacking submodule is used to stack multiple different high-level semantic feature vectors to obtain a reference feature vector.
[0067] In other embodiments, the processing module 403 may include: a processing submodule and a supramolecular module (not shown in the figure).
[0068] The processing submodule is used to perform a multi-step denoising operation using the second model based on the reference feature vector and the first noisy image to denoise the first noisy image and obtain an initial image.
[0069] The super-molecule module is used to perform super-resolution processing on the initial image using at least one third model to obtain a target image, wherein the resolution of the target image is higher than the resolution of the initial image.
[0070] In other embodiments, the processing submodule can use the second model to perform any denoising operation in the multiple-step operation in the following manner: determine the image to be denoised, if the denoising operation is the first denoising operation, then the image to be denoised is the first noise image, if the denoising operation is not the first denoising operation, then the image to be denoised is the processing result of the previous denoising operation. Determine the time series vector corresponding to the denoising operation, and use the second model to denoise the image to be denoised based on the reference feature vector and the time series vector.
[0071] In other embodiments, the processing submodule utilizes the second model to denoise the denoised image based on the reference feature vector and the time series vector in the following manner: a conditional vector is obtained based at least on the reference feature vector and the time series vector, and the second model is used to denoise the denoised image according to the conditional vector.
[0072] In some other embodiments, the second model includes multiple network layers, and the multiple network layers include at least one first network layer. The processing submodule uses the second model to denoise the denoised image according to the conditional vector in the following manner: the conditional vector is fused with the hidden variables output by each first network layer using a cross attention mechanism, and the fused vector obtained after the fusion is input into the network layer after the first network layer.
[0073] In some other embodiments, the supramolecular module is configured to: acquire a second noisy image, upsample the initial image, and stack it with the second noisy image to obtain a to-be-processed image, and perform denoising on the to-be-processed image using at least one third model to obtain a target image.
[0074] In some other embodiments, any third model includes an encoder and a decoder, and each of the encoder and the decoder includes a plurality of convolutional layers. The process of performing denoising using the third model includes performing a downsampling operation before performing a convolution operation using the convolutional layer included in the encoder, and performing an upsampling operation after performing a convolution operation using the convolutional layer included in the decoder.
[0075] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiment scheme of the present disclosure. A person of ordinary skill in the art can understand and implement it without paying creative labor.
[0076] Figure 5A schematic block diagram of an electronic device provided in some embodiments of the present disclosure. Figure 5 As shown, the electronic device 910 includes a processor 911 and a memory 912, which can be used to implement a client or a server. The memory 912 is used to store computer executable instructions (e.g., one or more computer program modules) non-transiently. The processor 911 is used to run the computer executable instructions, and when the computer executable instructions are run by the processor 911, one or more steps in the image generation method described above can be executed, thereby implementing the image generation method described above. The memory 912 and the processor 911 can be interconnected through a bus system and / or other forms of connection mechanisms (not shown).
[0077] For example, the processor 911 may be a central processing unit (CPU), a graphics processing unit (GPU), or other forms of processing units having data processing capabilities and / or program execution capabilities. For example, the central processing unit (CPU) may be an X86 or ARM architecture, etc. The processor 911 may be a general-purpose processor or a dedicated processor, and may control other components in the electronic device 910 to perform desired functions.
[0078] For example, the memory 912 may include any combination of one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, erasable programmable read-only memory (EPROM), portable compact disk read-only memory (CD-ROM), USB memory, flash memory, etc. One or more computer program modules may be stored on the computer-readable storage medium, and the processor 911 may run one or more computer program modules to implement various functions of the electronic device 910. Various applications and various data, as well as various data used and / or generated by the application, etc. may also be stored in the computer-readable storage medium.
[0079] It should be noted that, in the embodiments of the present disclosure, the specific functions and technical effects of the electronic device 910 can refer to the above description of the image generation method, which will not be repeated here.
[0080] Figure 6A schematic block diagram of another electronic device provided for some embodiments of the present disclosure. The electronic device 920 is, for example, suitable for implementing the image generation method provided in the embodiments of the present disclosure. The electronic device 920 may be a terminal device, etc., and may be used to implement a client or a server. The electronic device 920 may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), wearable electronic devices, etc., and fixed terminals such as digital TVs, desktop computers, smart home devices, etc. It should be noted that Figure 6 The electronic device 920 shown is only an example and does not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0081] like Figure 6 As shown, the electronic device 920 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 921, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 922 or a program loaded from a storage device 928 into a random access memory (RAM) 923. In the RAM 923, various programs and data required for the operation of the electronic device 920 are also stored. The processing device 921, the ROM 922, and the RAM 923 are connected to each other via a bus 924. An input / output (I / O) interface 925 is also connected to the bus 924.
[0082] Typically, the following devices may be connected to the I / O interface 925: an input device 926 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 927 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 928 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 929. The communication device 929 may allow the electronic device 920 to communicate with other electronic devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 920 is shown to have various devices, but it should be understood that it is not required to implement or possess all of the devices shown, and the electronic device 920 may alternatively implement or possess more or fewer devices.
[0083] For example, according to an embodiment of the present disclosure, the above-mentioned image generation method can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the above-mentioned image generation method. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 929, or installed from the storage device 928, or installed from the ROM 922. When the computer program is executed by the processing device 921, the functions defined in the image generation method provided by the embodiment of the present disclosure can be implemented.
[0084] Figure 7 A schematic diagram of a storage medium provided in some embodiments of the present disclosure. Figure 7 As shown, the storage medium 930 may be a non-transitory computer-readable storage medium for storing non-transitory computer-executable instructions 931. When the non-transitory computer-executable instructions 931 are executed by a processor, the image generation method described in the embodiment of the present disclosure may be implemented. For example, when the non-transitory computer-executable instructions 931 are executed by a processor, one or more steps in the image generation method described above may be executed.
[0085] For example, the storage medium 930 may be applied to the above-mentioned electronic device. For example, the storage medium 930 may include a memory in the electronic device.
[0086] For example, the storage medium may include a memory card of a smart phone, a storage component of a tablet computer, a hard disk of a personal computer, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory (CD-ROM), flash memory, or any combination of the above storage media, or other applicable storage media.
[0087] For example, the description of the storage medium 930 can refer to the description of the memory in the embodiment of the electronic device, and the repeated parts are not repeated. The specific functions and technical effects of the storage medium 930 can refer to the description of the image generation method above, and are not repeated here.
[0088] It should be noted that in the context of the present disclosure, a computer-readable medium may be a tangible medium that may contain or store a program for use by an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. A computer-readable storage medium may be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that may be used by an instruction execution system, device or device or used in combination with it. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0089] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0090] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for generating an image, the method comprising: Acquire a reference image and a first noise image; Obtaining a reference feature vector corresponding to the reference image; Performing denoising on the first noisy image based on the reference feature vector to obtain a target image that is a variant of the reference image; The target image and the reference image have part of the same high-level semantic information; Wherein, the obtaining of a reference feature vector corresponding to the reference image includes: Acquire a plurality of different high-level semantic feature vectors corresponding to the reference image using a plurality of different first models; The plurality of different high-level semantic feature vectors are stacked to obtain the reference feature vector; The denoising process is performed on the first noise image based on the reference feature vector to obtain a target image after the reference image is modified, including: Based on the reference feature vector, a second model is used to perform a multi-step denoising operation to obtain an initial image; The initial image is super-resolved using at least one third model to obtain the target image; the resolution of the target image is higher than the resolution of the initial image.
2. The method according to claim 1, wherein: The performing of any one of the multiple denoising operations by using the second model comprises: Determine an image to be denoised; if the denoising operation is a first denoising operation, the image to be denoised is the first noisy image; if the denoising operation is not a first denoising operation, the image to be denoised is the processing result of the previous denoising operation; Determine the time series vector corresponding to the denoising operation; The image to be denoised is denoised using the second model based on the reference feature vector and the time series vector.
3. The method according to claim 2, wherein: The step of utilizing the second model to denoise the image to be denoised based on the reference feature vector and the time series vector comprises: Obtaining a condition vector based at least on the reference feature vector and the time series vector; The second model is used to denoise the image to be denoised according to the condition vector.
4. The method according to claim 3, wherein: The second model includes a plurality of network layers, the plurality of network layers including at least one first network layer; The adopting the second model to denoise the image to be denoised according to the condition vector includes: The conditional vector is fused with the hidden variables output by each first network layer by using a cross attention mechanism, and the fused vector obtained after the fusion is input into the network layer after the first network layer.
5. The method according to claim 1, wherein: The step of using at least one third model to perform super-resolution processing on the initial image to obtain the target image includes: Acquire a second noise image; Upsampling the initial image and stacking it with the second noise image to obtain an image to be processed; The image to be processed is denoised using at least one third model to obtain the target image.
6. The method according to claim 5, wherein: Any third model includes an encoder and a decoder; the encoder and the decoder each include multiple convolutional layers; wherein, the process of denoising using the third model includes performing a downsampling operation before performing a convolution operation using the convolutional layer included in the encoder; and performing an upsampling operation after performing a convolution operation using the convolutional layer included in the decoder.
7. An image generating device, comprising: An acquisition module, used for acquiring a reference image and a first noise image; An extraction module, used to obtain a reference feature vector corresponding to the reference image; A processing module, configured to perform denoising on the first noisy image based on the reference feature vector to obtain a target image after the reference image is modified; The target image and the reference image have part of the same high-level semantic information; Wherein, the extraction module comprises: An extraction submodule, configured to obtain a plurality of different high-level semantic feature vectors corresponding to the reference image using a plurality of different first models; A stacking submodule, used for stacking the multiple different high-level semantic feature vectors to obtain the reference feature vector; Wherein, the processing module includes: A processing submodule, configured to perform a multi-step denoising operation using a second model based on the reference feature vector to obtain an initial image; The super-molecule module is used to perform super-resolution processing on the initial image using at least one third model to obtain the target image; the resolution of the target image is higher than the resolution of the initial image.
8. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 6.
9. An electronic device, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 6 is implemented.
