Image processing method and device, electronic equipment and storage medium
By using the latent space motion transformation mapping module and the diffusion model in the image generation model, setting the frame number and encoding, it solves the problems of high cost and high computing power requirements for generating coherent and consistent continuous images in the existing technology, and achieves Low-cost, efficient continuous image generation.
Patent Information
- Application Number
- CN202410974741.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-07-19
AI Technical Summary
Existing technologies face high costs and high computing power requirements when generating continuous images with coherence and consistency, and the video generation length is limited.
By setting the frame number and encoding it, using the latent space noise map and the latent space motion transformation mapping module and diffusion model in the image generation model, a set of consistent continuous images is generated, which reduces the cost and improves the generation capability. .
It achieves the generation of a consistent set of continuous images at very low cost, reduces the cost of video generation and improves the generation capability, and avoids the problems of high computing power and high cost in the existing technology.
Smart Images

Figure CN118537416A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to an image processing method and device, electronic equipment and storage medium. Background Art
[0002] In recent years, with the rapid development of artificial intelligence and deep learning technologies, AIGC (artificial intelligence generated content) has made significant progress in the field of image generation. The explosive growth of computing power has made it possible to efficiently generate high-quality and highly realistic static images. However, there are still many challenges in generating continuous images with coherence and consistency. Consistent image generation technology not only needs to have the ability to generate a single image, but also must ensure the consistency of the image in time and space. This is especially important for animation, movies, and other applications that require dynamic visual effects. Consistent image generation involves smooth transitions of image content, consistency of style, and continuity of details, which places higher requirements on the model's understanding and processing capabilities.
[0003] There are currently two main ways to meet the demand for consistent image generation: 1. Train the video generation model; 2. Insert the action modeling module into the image diffusion model. For the first method, it is very difficult to train the video model, and it has high requirements for computing power / training sets, and is very costly. For the second method, although the trained image diffusion model can be reused, the initialization and denoising of multiple frames of images involved in the image generation process are performed simultaneously. This feature determines that the length of the video generation is limited, which limits its generation capacity. Summary of the invention
[0004] In view of this, the embodiments of the present application provide an image processing method and device, an electronic device and a storage medium, which can generate a set of consistent continuous images at an extremely low cost using a latent space noise map.
[0005] In a first aspect, an embodiment of the present application provides an image processing method, comprising: Set a frame number t, and encode the frame number t to obtain an encoded frame number t; A latent space noise map p and an encoded frame number t are input into an image generation model to generate a target image, wherein the image generation model includes a latent space motion transform mapping module and a latent space diffusion model, the output of the latent space motion transform mapping module is input into the latent space diffusion model, the latent space motion transform mapping module includes a first module, a second module and a third module, the output of the first module and the output of the second module are summed and input into the third module, the input of the first module is the latent space noise map, the input of the second module is the encoded frame number, the first module includes a first group of normalized layers, a first activation function layer, a first Dropout layer and a first convolutional layer connected in sequence, the second module includes a second activation function layer and a fully connected layer connected in sequence, and the third module includes a second group of normalized layers, a third activation function layer, a second Dropout layer and a second convolutional layer connected in sequence.
[0006] In a second aspect, an embodiment of the present application further provides an image processing device, including: The encoding unit is used to set the frame sequence number t, and encode the frame sequence number t to obtain the encoded frame sequence number t; A generation unit is used to input a latent space noise map p and an encoded frame number t into an image generation model to generate a target image, wherein the image generation model includes a latent space motion transformation mapping module and a latent space diffusion model, the output of the latent space motion transformation mapping module is input into the latent space diffusion model, the latent space motion transformation mapping module includes a first module, a second module and a third module, the output of the first module and the output of the second module are summed and input into the third module, the input of the first module is the latent space noise map, the input of the second module is the encoded frame number, the first module includes a first group of normalization layers, a first activation function layer, a first Dropout layer and a first convolutional layer connected in sequence, the second module includes a second activation function layer and a fully connected layer connected in sequence, and the third module includes a second group of normalization layers, a third activation function layer, a second Dropout layer and a second convolutional layer connected in sequence.
[0007] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the image processing method described in the first aspect are executed.
[0008] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the image processing method described in the first aspect.
[0009] In summary, the image processing method and device, electronic device and storage medium provided by the embodiments of the present application set a frame number t, encode the frame number t to obtain the encoded frame number t, and input a latent space noise map p and the encoded frame number t into an image generation model including a latent space motion transformation mapping module to generate a target image. In the entire scheme, by using the latent space motion transformation mapping module and setting the frame number t, a group of consistent continuous images can be generated at an extremely low cost using a latent space noise map. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 A schematic diagram of a flow chart of an embodiment of an image processing method provided in an embodiment of the present application; Figure 2 for Figure 1 The network architecture diagram of the latent space motion transform mapping module used in; Figure 3 A schematic diagram of the structure of an image processing device according to an embodiment of the present application; Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0011] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.
[0012] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0013] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0014] Reference Figure 1 FIG. 1 is a flow chart of an image processing method provided in an embodiment of the present application, wherein the image processing method comprises: S10, setting a frame sequence number t, and encoding the frame sequence number t to obtain an encoded frame sequence number t; In this embodiment, it should be noted that the frame number t may include at least one frame number, and the frame number t may be encoded using an existing encoding method, such as sin encoding, cos encoding, and the like.
[0015] S11. Input a latent space noise map p and the encoded frame number t into an image generation model to generate a target image, wherein the image generation model includes a latent space motion transform mapping module and a latent space diffusion model, the output of the latent space motion transform mapping module is input into the latent space diffusion model, the latent space motion transform mapping module includes a first module, a second module and a third module, the output of the first module and the output of the second module are summed and input into the third module, the input of the first module is the latent space noise map, the input of the second module is the encoded frame number, the first module includes a first group of normalization layers, a first activation function layer, a first Dropout layer and a first convolutional layer connected in sequence, the second module includes a second activation function layer and a fully connected layer connected in sequence, and the third module includes a second group of normalization layers, a third activation function layer, a second Dropout layer and a second convolutional layer connected in sequence.
[0016] In this embodiment, it should be noted that if the frame number t is 1 frame number, the frame number t can be set to a different value each time, and different target images can be obtained through step S10 and step S11, and these target images form a group of consistent continuous images; or an additional processing module can be added inside the image generation model to process the encoded frame number t into multiple values (such as encoded frame numbers corresponding to multiple different frame numbers), so that multiple target images can be obtained through step S11 processing, and these multiple target images form a group of consistent continuous images. If the frame number t is at least two frame numbers, a latent space noise map p and the encoded frame number t are input into the image generation model to generate multiple target images, and these multiple target images form a group of consistent continuous images.
[0017] The image processing method provided in the embodiment of the present application sets a frame number t, encodes the frame number t to obtain the encoded frame number t, and inputs a latent space noise map p and the encoded frame number t into an image generation model including a latent space motion transformation mapping module to generate a target image. In the entire scheme, by using the latent space motion transformation mapping module and setting the frame number t, a group of consistent continuous images can be generated at an extremely low cost using a latent space noise map.
[0018] like Figure 2 Shown Figure 1 The network architecture diagram of another latent space motion transform mapping module used in, Figure 2 In the embodiment, the latent space motion transform mapping module may further include: a fourth module, wherein the fourth module includes a third convolutional layer, the input of the fourth module is a latent space noise map, and the output of the third module and the output of the fourth module are summed to obtain the output of the latent space motion transform mapping module.
[0019] Based on the above method embodiment, before inputting a latent space noise map p and the encoded frame sequence number t into the image generation model, the following method may be further included: Divide a specified video into multiple images, input the multiple images into a latent space diffusion model to obtain multiple new images, and generate a training set based on the multiple new images, wherein the training set includes multiple training sample pairs, each training sample pair includes an input image, an encoded frame sequence number, and an output image; The image generation model is trained using the training set, wherein during the training of the image generation model, the parameters of the latent space diffusion model are frozen.
[0020] In this embodiment, it should be noted that when the specified video is divided into multiple images, the images can be divided according to a fixed frame rate. Assuming that the multiple new images obtained by inputting the multiple images divided into the specified video into the latent space diffusion model include img(0) and img(2), then the training set generated based on the multiple new images can include a training sample pair (img(0), Encoder(2), img(2)), where img(0) represents the first frame image, img(2) represents the third frame image, Encoder(2) represents the result of encoding frame number 2 (2 is the difference between frame number 2 corresponding to img(2) and frame number 0 corresponding to img(0)), img(0) and Encoder(2) can be used as input data of the image generation model, and img(2) can be used as output data of the image generation model. It should be noted that the input data of the image generation model in the training sample pair may include the result of encoding at least two frame numbers, and the output data of the image generation model in the training sample pair may include at least two new images. In this case, each of the at least two frame numbers is the difference between the frame number corresponding to a new image in the training sample pair as the output data of the image generation model and the frame number corresponding to the new image in the training sample pair as the input data of the image generation model. During the training of the image generation model, the parameters of the latent space diffusion model are frozen, that is, the parameters of the latent space diffusion model always keep the initial values unchanged.
[0021] On the basis of the aforementioned method embodiment, when generating a target image, the first Dropout layer and the second Dropout layer in the latent space motion transform mapping module are zero.
[0022] In this embodiment, it should be noted that when generating the target image, the first Dropout layer and the second Dropout layer in the latent space motion transform mapping module need to be turned off, that is, the first Dropout layer and the second Dropout layer in the latent space motion transform mapping module are set to 0.
[0023] Reference Figure 3 FIG. 1 is a schematic diagram of the structure of an image processing device provided in an embodiment of the present application, the device comprising: The encoding unit 30 is used to set a frame sequence number t, and encode the frame sequence number t to obtain an encoded frame sequence number t; The generation unit 31 is used to input a latent space noise map p and an encoded frame number t into an image generation model to generate a target image, wherein the image generation model includes a latent space motion transformation mapping module and a latent space diffusion model, the output of the latent space motion transformation mapping module is input into the latent space diffusion model, the latent space motion transformation mapping module includes a first module, a second module and a third module, the output of the first module and the output of the second module are summed and input into the third module, the input of the first module is the latent space noise map, the input of the second module is the encoded frame number, the first module includes a first group of normalization layers, a first activation function layer, a first Dropout layer and a first convolutional layer connected in sequence, the second module includes a second activation function layer and a fully connected layer connected in sequence, and the third module includes a second group of normalization layers, a third activation function layer, a second Dropout layer and a second convolutional layer connected in sequence.
[0024] The image processing device provided in the embodiment of the present application sets a frame number t, encodes the frame number t to obtain the encoded frame number t, and inputs a latent space noise map p and the encoded frame number t into an image generation model including a latent space motion transformation mapping module to generate a target image. In the entire scheme, by using the latent space motion transformation mapping module and setting the frame number t, a group of consistent continuous images can be generated at an extremely low cost using a latent space noise map.
[0025] Based on the aforementioned device embodiment, the latent space motion transform mapping module may further include: a fourth module, wherein the fourth module includes a third convolutional layer, the input of the fourth module is a latent space noise map, and the output of the third module and the output of the fourth module are summed to obtain the output of the latent space motion transform mapping module.
[0026] Based on the above device embodiment, the device may further include: A training unit is used to, before the generation unit works, divide a specified video into multiple images, input the multiple images into a latent space diffusion model to obtain multiple new images, and generate a training set based on the multiple new images, wherein the training set contains multiple training sample pairs, each training sample pair contains an input image, an encoded frame number and an output image; and use the training set to train the image generation model, wherein during the training of the image generation model, the parameters of the latent space diffusion model are frozen.
[0027] Based on the aforementioned device embodiment, when generating a target image, the first Dropout layer and the second Dropout layer in the latent space motion transform mapping module are zero.
[0028] The image processing device provided in the embodiment of the present application has an implementation process that is consistent with the image processing method provided in the embodiment of the present application, and the effect that can be achieved is also the same as the image processing method provided in the embodiment of the present application, which will not be repeated here.
[0029] Through the above solution, while the existing cloud application terminal's video frame network reception + decoding + rendering mode remains unchanged, a dynamic delay is added between network reception and decoding to smooth the decoding interval between the previous and next frames. This can optimize the decoding jams caused by the instantaneous reception of a large number of video frames due to network jitter and the decoding jams caused by insufficient terminal performance in a certain period of time, thereby optimizing the cloud application screen playback jams.
[0030] like Figure 4 As shown, an electronic device provided by an embodiment of the present application includes: a processor 40, a memory 41 and a bus 42, wherein the memory 41 stores machine-readable instructions executable by the processor 40, and when the electronic device is running, the processor 40 communicates with the memory 41 through the bus 42, and the processor 40 executes the machine-readable instructions to perform the steps of the above-mentioned image processing method.
[0031] Specifically, the memory 41 and the processor 40 can be general-purpose memories and processors, which are not specifically limited here. When the processor 40 runs the computer program stored in the memory 41, the image processing method can be executed.
[0032] Corresponding to the above-mentioned image processing method, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned image processing method are executed.
[0033] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. An image processing method, characterized in that: include: Set a frame number t, and encode the frame number t to obtain an encoded frame number t; A latent space noise map p and an encoded frame number t are input into an image generation model to generate a target image, wherein the image generation model includes a latent space motion transform mapping module and a latent space diffusion model, the output of the latent space motion transform mapping module is input into the latent space diffusion model, the latent space motion transform mapping module includes a first module, a second module and a third module, the output of the first module and the output of the second module are summed and input into the third module, the input of the first module is the latent space noise map, the input of the second module is the encoded frame number, the first module includes a first group of normalized layers, a first activation function layer, a first Dropout layer and a first convolutional layer connected in sequence, the second module includes a second activation function layer and a fully connected layer connected in sequence, and the third module includes a second group of normalized layers, a third activation function layer, a second Dropout layer and a second convolutional layer connected in sequence.
2. The method according to claim 1, characterized in that The latent space motion transformation mapping module also includes: a fourth module, wherein the fourth module includes a third convolutional layer, the input of the fourth module is a latent space noise map, and the output of the third module and the output of the fourth module are summed to obtain the output of the latent space motion transformation mapping module.
3. The method according to claim 1 or 2, characterized in that Before inputting a latent space noise map p and the encoded frame sequence number t into the image generation model, the method further includes: Divide a specified video into multiple images, input the multiple images into a latent space diffusion model to obtain multiple new images, and generate a training set based on the multiple new images, wherein the training set includes multiple training sample pairs, each training sample pair includes an input image, an encoded frame sequence number, and an output image; The image generation model is trained using the training set, wherein during the training of the image generation model, the parameters of the latent space diffusion model are frozen.
4. The method according to claim 1, characterized in that When generating the target image, the first Dropout layer and the second Dropout layer in the latent space motion transform mapping module are 0.
5. An image processing device, characterized in that: include: The encoding unit is used to set the frame sequence number t, and encode the frame sequence number t to obtain the encoded frame sequence number t; A generation unit is used to input a latent space noise map p and an encoded frame number t into an image generation model to generate a target image, wherein the image generation model includes a latent space motion transformation mapping module and a latent space diffusion model, the output of the latent space motion transformation mapping module is input into the latent space diffusion model, the latent space motion transformation mapping module includes a first module, a second module and a third module, the output of the first module and the output of the second module are summed and input into the third module, the input of the first module is the latent space noise map, the input of the second module is the encoded frame number, the first module includes a first group of normalization layers, a first activation function layer, a first Dropout layer and a first convolutional layer connected in sequence, the second module includes a second activation function layer and a fully connected layer connected in sequence, and the third module includes a second group of normalization layers, a third activation function layer, a second Dropout layer and a second convolutional layer connected in sequence.
6. The device according to claim 5, characterized in that The latent space motion transformation mapping module also includes: a fourth module, wherein the fourth module includes a third convolutional layer, the input of the fourth module is a latent space noise map, and the output of the third module and the output of the fourth module are summed to obtain the output of the latent space motion transformation mapping module.
7. The device according to claim 5 or 6, characterized in that Also includes: A training unit is used to, before the generation unit works, divide a specified video into multiple images, input the multiple images into a latent space diffusion model to obtain multiple new images, and generate a training set based on the multiple new images, wherein the training set contains multiple training sample pairs, each training sample pair contains an input image, an encoded frame number and an output image; and use the training set to train the image generation model, wherein during the training of the image generation model, the parameters of the latent space diffusion model are frozen.
8. The device according to claim 5, characterized in that When generating the target image, the first Dropout layer and the second Dropout layer in the latent space motion transform mapping module are 0.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the image processing method according to any one of claims 1 to 4 are executed.
10. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the storage medium communicate via the bus, and the processor executes the machine-readable instructions to perform the steps of the image processing method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Animation generation method based on control information and optical flow information, medium and equipment
CN117315096A
Music conditional dance animation generation method based on diffusion model
CN117710533A
Video deblurring method based on latent variable prior knowledge guidance, computer equipment, readable storage medium and program product
CN117830154A
Human body video generation method based on time sequence consistent hidden space guide diffusion model
CN117994708A
Generating video using potential diffusion model
CN118053090A
