Training method and device of video generation network, electronic equipment and storage medium
By introducing text features and encoder-decoder iterative processing into the video generation network, combined with mean square error and cross-entropy loss functions, the problem of ignoring perceptual quality and semantic information in video generation in the existing technology is solved, achieving a more natural and high-quality Quality video generation.
Patent Information
- Application Number
- CN202410609789.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-16
- Publication Date
- 2024-09-13
AI Technical Summary
When existing video generation technology processes huge video data, it is easy to over-capture spatial high-frequency details and ignore the perceived quality and semantic information of the video content, resulting in insufficiently natural and high-quality videos.
By obtaining the video picture sequence and the corresponding text description, use the cross-modal model to extract text features, and combine the encoder and decoder to perform image and video generation diffusion iterative processing, and construct the mean square error loss function and cross entropy loss function to train Video generation network, ensuring that the network learns robust and semantically relevant video content.
The accuracy and diversity of video generation are improved, and the generated videos are closer to the real content, with higher fidelity and clarity, which enhances the network's video generation capabilities and understanding of video content.
Smart Images

Figure CN118644582A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer vision technology, and in particular to a training method, device, electronic device and storage medium for a video generation network. Background Art
[0002] The goal of video generation is to create natural and high-quality video content that accurately reflects human intentions. Although some progress has been made in this field, there are still significant challenges to fully achieve this goal.
[0003] Currently, existing video generation techniques mainly rely on directly training deep models to generate pixels for each frame, but this approach faces significant challenges when processing huge amounts of video data. First, the large-scale nature of video data makes it extremely difficult to train deep learning models, which requires a lot of computing resources. During the training process, this approach may over-capture spatial high-frequency details that are not important to human vision, thereby ignoring the perceptual quality and semantic information of the video content. Summary of the invention
[0004] In view of this, the present application provides a training method, device, electronic device and storage medium for a video generation network to solve the problem of ignoring the perceptual quality and semantic information of video content in the prior art.
[0005] In a first aspect of the present application, a method for training a video generation network is provided, comprising: obtaining a video picture sequence of a video picture sequence training set and a text description in a text description training set, wherein the text description corresponds to the video picture sequence; adding noise to the video picture sequence to obtain a video noise image sequence, and obtaining text features characterizing the video picture sequence based on the first picture of the video picture sequence and the text description; using a first type of encoder and a first type of decoder to perform image generation diffusion iterative processing on the first noise image and the text features of the video noise image sequence to obtain image content features and a final predicted image, constructing a first mean square error loss function based on the final predicted image and the true image, and inputting the final predicted image into an image discriminator, and obtaining a text feature characterizing the video picture sequence based on the final predicted image. The first cross entropy loss function is constructed based on the predicted video image and the real video image to distinguish the final predicted image from the real image; the second type of encoder and the second type of decoder are used to perform video generation diffusion iterative processing on the video noise image sequence, the picture content features and the text features to obtain a predicted video image, a second mean square error loss function is constructed based on the predicted video image and the real video image, and the predicted video image is input into a video discriminator, and a second cross entropy loss function is constructed based on the predicted video image and the real video image to distinguish the predicted video image from the real video image; the initial video generation network is trained based on the first mean square error loss function, the first cross entropy loss function, the second mean square error loss function and the second cross entropy loss function to obtain a target video generation network.
[0006] According to a second aspect of the present application, a training device for a video generation network is provided, comprising: an acquisition module, configured to acquire a video picture sequence of a video picture sequence training set and a text description in a text description training set, wherein the text description corresponds to the video picture sequence; a noise adding module, configured to add noise to the video picture sequence to obtain a video noise picture sequence, and obtain text features characterizing the video picture sequence based on the first picture of the video picture sequence and the text description; a first processing module, configured to use a first type of encoder and a first type of decoder to perform picture generation diffusion iterative processing on the first noise picture and the text features of the video noise picture sequence to obtain picture content features and a final predicted picture, construct a first mean square error loss function based on the final predicted picture and the real picture, and input the final predicted picture into a picture discriminator based on The final predicted image and the real image construct a first cross entropy loss function to distinguish the final predicted image from the real image; the second processing module is configured to use the second type of encoder and the second type of decoder to perform video generation diffusion iterative processing on the video noise image sequence, the image content features and the text features to obtain a predicted video image, construct a second mean square error loss function based on the predicted video image and the real video image, and input the predicted video image into the video discriminator, and construct a second cross entropy loss function based on the predicted video image and the real video image to distinguish the predicted video image from the real video image; the training module is configured to train the initial video generation network based on the first mean square error loss function, the first cross entropy loss function, the second mean square error loss function and the second cross entropy loss function to obtain a target video generation network.
[0007] According to a third aspect of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0008] According to a fourth aspect of the present application, a storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0009] At least one of the above technical solutions adopted in this application can achieve the following beneficial effects:
[0010] By obtaining the video picture sequence and text description in the training set, the corresponding video picture sequence and text description are input into the initial video generation network, the first picture in the video picture sequence is processed by the cross-modal model to extract the first text information of the picture, and the text description in the training set is processed by the large language model to obtain richer and more detailed second text information. Based on the first text information and the second text information, the text features representing the video picture sequence are obtained, and each picture in the video picture sequence is denoised to obtain a video noise picture sequence. The first type of encoder and the first type of decoder perform picture generation diffusion processing on the first noise picture and text features to obtain the final predicted picture, wherein the first type of encoder can obtain the picture content features for the subsequent second type of encoder to perform tasks. After obtaining the final predicted picture, the first mean square error loss function can be constructed in combination with the real picture. The first type of encoder can be trained by minimizing the first mean square error loss. At the same time, the final predicted picture is input into the picture discriminator to calculate the first cross entropy loss function between the final predicted picture and the real picture to distinguish the real picture from the final predicted picture, so that the accuracy of picture generation can be improved through the training adversarial process. Afterwards, the video noise map sequence, image content features and text features can be iteratively processed through the second type of encoder and the second type of decoder to obtain a predicted video image. After obtaining the predicted video image, the second mean square error loss function can be constructed in combination with the real video image. The predicted video image is also input into the video discriminator to construct a second cross entropy loss function. The second mean square error loss function and the second cross entropy loss can improve the generation effect and accuracy of the video image. The initial video generation network is trained based on the first mean square error loss function, the first cross entropy loss function, the second mean square error loss function and the second cross entropy loss function to obtain the target video generation network.In this way, by introducing noise into the video image sequence, the network can learn feature representations that are robust to noise during the training process, making the final video generation more robust and diverse. Associating text descriptions with video images can provide supplementary information about the video content from text features to help the network better understand the semantic information of the video image sequence. Using encoders and decoders combined with text features can generate images with real style and rich content from video noise image sequences. Video diffusion iterative processing can help the network learn to capture the dynamic features and semantic information of video image sequences to generate dynamic videos. The network is comprehensively optimized by the mean square error loss function and the cross entropy loss function, which enables the network to generate high-quality, semantically relevant video content. The mean square error loss function can help the network improve the realism and clarity of the image, and the cross entropy loss function can enhance the classification and generation capabilities of the network, making the generated video closer to the real video. In this way, by training the initial video generation network, the target video generation network is obtained to improve the network's video generation capability and the degree of understanding of the video content, so that the generated video is more in line with the expected content and semantics. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0012] Figure 1 It is a flowchart of a training method for a video generation network provided in an embodiment of the present application;
[0013] Figure 2 It is a flowchart of another video generation network training method provided in an embodiment of the present application;
[0014] Figure 3 It is a flowchart of another video generation network training method provided in an embodiment of the present application;
[0015] Figure 4 It is a structural schematic diagram of another video generation network training device provided in an embodiment of the present application;
[0016] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0017] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0018] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0019] In addition, it should be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "includes..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0020] A method and device for training a video generation network according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.
[0021] Figure 1 It is a flowchart of a training method for a video generation network provided in an embodiment of the present application.
[0022] like Figure 1 As shown, the training method of the video generation network includes:
[0023] S101, obtaining a video picture sequence in a video picture sequence training set and a text description in a text description training set, wherein the text description corresponds to the video picture sequence;
[0024] S102, adding noise to the video picture sequence to obtain a video noise picture sequence, and obtaining text features representing the video picture sequence based on the first picture and text description of the video picture sequence;
[0025] S103, using a first type of encoder and a first type of decoder, performing image generation diffusion iterative processing on the first noise image and text features of the video noise image sequence to obtain image content features and a final predicted image, constructing a first mean square error loss function based on the final predicted image and the real image, and inputting the final predicted image into an image discriminator, constructing a first cross entropy loss function based on the final predicted image and the real image to distinguish the final predicted image from the real image;
[0026] S104, using a second type of encoder and a second type of decoder, performing video generation diffusion iterative processing on the video noise image sequence, the picture content features, and the text features to obtain a predicted video image, constructing a second mean square error loss function based on the predicted video image and the real video image, and inputting the predicted video image into a video discriminator, constructing a second cross entropy loss function based on the predicted video image and the real video image to distinguish the predicted video image from the real video image;
[0027] S105, training the initial video generation network based on the first mean square error loss function, the first cross entropy loss function, the second mean square error loss function, and the second cross entropy loss function to obtain a target video generation network.
[0028] Specifically, the initial video generation network can be trained using video picture sequences and text descriptions of the video as training sets to obtain a target video generation network.
[0029] The video image sequence can be a continuous image decomposed into a time sequence in the video, where each frame represents a still image of the video at a certain time point, and the video image sequence can be used as a training set for training.
[0030] In some embodiments, the method of obtaining text features characterizing the video picture sequence based on the first picture and text description of the video picture sequence includes: inputting the first picture into a cross-modal processing model for processing to obtain first text information; using a large language model to expand the text description to obtain second text information; splicing the first text information and the second text information to obtain third text information, and processing the third text information through a text encoder to obtain text features.
[0031] Specifically, before executing the image generation diffusion process and the video generation diffusion process, the video image sequence may be processed to obtain text features.
[0032] First, the first image in the video image sequence can be input into a cross-modal processing model (such as Bidirectional Latent Integration for Generative Pre-training, BLIP model) for processing to obtain first text information, so that the first image can be converted into a text representation. The text description corresponding to the training set is input into a large language model for expansion to obtain second text information, and a semantic expansion of the text description can be obtained.
[0033] Then the first text information and the second text information may be spliced to obtain the third text information, so that the two text information may be combined to obtain more comprehensive and rich text information.
[0034] The third text information is processed by a text encoder (such as Contrastive Language-Image Pre-training, CLIP) to obtain the text features required for video generation, so that the third text information can be converted into a high-dimensional feature representation to capture the semantic information and contextual relationship of the text.
[0035] According to the method of the above embodiment, the first picture and text description can be processed, and the first text information and the second text information obtained after the processing can be spliced to obtain the third text information, and the third text information can be encoded to obtain text features. In this way, the text features containing comprehensive semantic information can be further used to perform video generation tasks, which can help the network generate content-rich pictures and videos, and also help the initial video generation network to train to obtain the target video generation network.
[0036] In some embodiments, a first type of encoder and a first type of decoder are used to perform picture generation diffusion iterative processing on the first noise image and text features of a video noise image sequence to obtain picture content features and a final predicted image, including: inputting the first noise image and text features into the first type of encoder to obtain picture content features after encoding; processing the picture content features through a first type of decoder to obtain an initial predicted image; and performing a first preset number of picture generation diffusion iterative processing on the initial predicted image based on the first type of encoder and the first type of decoder to obtain a final predicted image.
[0037] Specifically, the first type of encoder can be used to process the first noise image and text features in the video noise image sequence, and the first noise image and text features can be combined for abstract representation to generate image content features, and then the image content features are processed by the first type of decoder to obtain an initial prediction image. After obtaining the initial prediction image, the first type of encoder and the first type of decoder can be used to perform image generation diffusion iteration processing on the initial prediction image, that is, the first type of encoder and the first type of decoder are repeatedly used to adjust and improve the final prediction image result so that it is more in line with the expected goal until the final prediction image is obtained, and then the network is further trained based on the final prediction image and the real image, and the real image can be the corresponding image before noise addition. It should be understood that the number of times the diffusion iteration is performed, that is, the first preset number of times, can be a pre-set number, such as outputting the final prediction image after a T-word diffusion iteration process, or it can be obtained by the network based on specific task training, which is not limited here.
[0038] Among them, the first type of encoder can be a UNet encoder, and the UNet encoder can use the UNet encoder structure pre-trained by Stable Diffusion 2.1. The first noise image can be passed through the UNet encoder to obtain the image content features. The first type of decoder can be a UNet decoder, and the UNet decoder can use the UNet decoder structure pre-trained by Stable Diffusion 2.1. The image content features can be decoded through the UNet decoder to obtain the initial prediction image, and the final prediction image can be obtained after the last iteration.
[0039] It should also be understood that the first noise map and text feature input are processed to obtain the first final prediction picture in the generated video, that is, in the process of generating the final prediction picture, the corresponding final prediction picture can be generated once based on the timing of the video picture sequence.
[0040] According to the method of the above embodiment, the first noise image and text features can be processed by the first type of encoder and the first type of decoder to obtain the required final prediction image, and then the final prediction image can be used for network training.
[0041] In some embodiments, a second type of encoder and a second type of decoder are used to perform video generation diffusion iterative processing on a video noise map sequence, picture content features, and text features, including: processing the video noise map sequence, picture content features, and text features through the second type of encoder to obtain an encoding result; processing the encoding result through the second type of decoder to obtain an initial predicted video image; based on the second type of encoder and the second type of decoder, performing a second preset number of video generation diffusion iterative processing on the initial predicted video image to obtain a predicted video image.
[0042] Specifically, the video noise image sequence, picture content features and text features can be processed by the second type of encoder to obtain an encoding result. The second type of encoder can capture the abstract representation of the video noise image sequence, picture content and text, so that the network can capture key information in the video generation process.
[0043] The encoding result is processed by the second type of decoder to obtain an initial predicted video image to generate a higher quality and realistic predicted video image, thereby improving the visual effect of the network-generated video.
[0044] The second type of encoder and the second type of decoder are used to perform a second prediction number of video generation diffusion iteration processing on the initial predicted video image, which means that the second type of encoder and the second type of decoder can be repeatedly used to adjust and improve the predicted video image to make it more in line with the expected goal. The diffusion iteration may include adjusting the relationship between frames, optimizing image quality, adding details and other operations until the predicted number of iterations is reached. Similarly, there is no limit on the second preset number, which is consistent with the method for determining the first preset number.
[0045] The second type of encoder may be a Transformer encoder, which may adopt the structure of a Diffusion Transformers encoder and be composed of N Transformer submodules. The second type of decoder may be a Transformer decoder, which may adopt the structure of a Diffusion Transformers encoder.
[0046] According to the method of the above embodiment, the video noise map sequence, image content features and text features can be comprehensively encoded into an abstract representation through the second encoder and the second decoder, capturing the key information in the video generation process to help the network generate higher quality and realistic predicted video images, thereby improving the visual effect of the video, and promoting network training to obtain an efficient target video generation network.
[0047] In other embodiments, the second-category encoder includes multiple second-category encoding modules, and the video noise image sequence, picture content features, and text features are processed by the second-category encoder to obtain an encoding result, including: inputting the video noise image sequence into the first second-category encoding module, fusing it with the text features and the picture content features to obtain the output result of the first second-category encoding module; inputting the output result, text features, and picture content features into the next second-category encoding module for processing, until the last second-category encoding module outputs the encoding result.
[0048] Specifically, the second-category encoder may include multiple second-category encoding modules, that is, each transformer encoder includes multiple transformer encoding modules, so that the video noise image sequence can be input into the first transformer encoding module, and fused with the text features and the image content features to obtain the result of the first transformer encoding module, that is, the output result of the first second-category encoding module. Further, the output result of the first second-category encoding module can be input into the next transformer encoding module for processing, and this is repeated until the last transformer encoding module outputs the encoding result.
[0049] In other embodiments, the video noise image sequence is input into the first second-category encoding module and fused with the text features and the image content features to obtain the output result of the first second-category encoding module, including: subjecting the video noise image sequence to layer normalization and multi-head self-attention processing in turn to obtain a self-attention output; performing a residual connection between the self-attention output and the video noise image sequence to obtain a first addition result; using a multi-head cross-attention mechanism to fuse the text features with the first addition result to obtain a fusion result; performing a residual connection between the fusion result and the first addition result to obtain a second addition result; performing a residual connection between the second addition result and the image content features with the same dimension as the text features to obtain a third addition result; performing layer normalization and position-by-position element-by-element feedforward network processing on the third addition result in turn to obtain a feedforward network output; performing a residual connection between the feedforward network output and the third addition result to obtain the output result of the first second-category encoding module.
[0050] Specifically, Figure 2 is a flow chart of another video generation network training method provided in an embodiment of the present application. When the second type of encoding module is a transformer encoding module, it can be combined with Figure 2 The embodiments of the present application are described in detail.
[0051] Assuming that the transformer encoding module is the first transformer encoding module, the video noise map sequence can be subjected to layer normalization and multi-head self-attention in sequence to capture the dependencies between different positions in the sequence, improve the network's ability to understand the video content, and obtain the self-attention output. The self-attention output is residually connected with the video noise map sequence input by the module to obtain the first addition result. The use of residual connection helps to alleviate the problem of gradient disappearance, making the network easier to train and facilitating message transmission. Adding the self-attention output to the video noise map sequence can increase the expression ability of the self-attention mechanism while retaining the original video information. The first addition result can be further layer normalized, and then the layer normalization result is fused with the text feature by multi-head cross attention to obtain a fusion result. In this way, the text feature can be integrated into the first addition result to provide additional semantic information, so that the transformer encoding module can combine the semantic information in the text description with the image feature, thereby improving the accuracy and semantic consistency of the network-generated predicted video.
[0052] Furthermore, the fusion result can be residually connected with the first addition result to obtain a second addition result. Performing residual connection again here helps maintain the stability of information and can prevent feature loss or excessive blurring, thereby maintaining the richness of video content. After obtaining the second addition result, a residual connection can be performed with the image content feature to obtain a third addition result. The third addition result can then be processed by layer normalization and position-wise feed-forward network (Position-wise Feed-Forward Network) in sequence to obtain a feed-forward network output. A higher-level feature representation can be learned to improve the network's ability to abstract and understand video content. It should be understood that the position-wise feed-forward network can include two linear transformations, and an activation function can be included therein to learn more complex feature representations.
[0053] Finally, the feedforward network output and the third addition result are residually connected to retain the details and features of the original video content, making the network output smoother and more coherent, so as to obtain the output result of the first second-category encoding module. The output result of the first second-category encoding module can be further passed to the next transformer encoding module, and this is repeated until all transformer encoding modules are processed to obtain a predicted video image.
[0054] It should be noted that in order to integrate the image content features into the transformer encoding module, the image content features output by the UNet encoder can be first processed by maximum pooling and multi-layer perceptron, and the image content features can be mapped to the same dimensional space as the second type of encoder input to obtain a dimension that is compatible with the transformer encoding module.
[0055] According to the method of the above embodiment, the video noise map sequence, text features and image content features can be fused by combining multi-head self-attention, multi-head cross-attention and position-by-element feedforward network, which can help the network better understand and generate video content and improve the quality and realism of the generated video.
[0056] In some embodiments, before performing residual connection between the second addition result and the image content feature with the same dimension as the text feature to obtain the third addition result, it also includes: subjecting the image content feature to maximum pooling to obtain a maximum pooling result; subjecting the maximum pooling result to a multi-layer perceptron processing to map the image content feature to the same dimensional space as the second type of encoder input to obtain an image content feature with the same dimension as the text feature.
[0057] Specifically, by performing the maximum pooling operation on the image content features, the maximum value of each area of the image content features can be obtained, so that the feature dimension can be reduced. By performing the maximum pooling operation on the image content features, the most significant features in the feature map can be retained, while the feature dimension is reduced and the computational efficiency is improved.
[0058] Processing the pooling results through a multi-layer perceptron can map the image content features to the same dimensional space as the second type of encoder input, making the dimension of the image content features the same as the text feature dimension. In this way, the image content features can be fused with the input dimension of the transformer encoding module, making it easier to perform subsequent feature fusion operations and improving the network's processing and expression capabilities for different modal information.
[0059] Figure 3 This is a flow chart of another video generation network training method provided in an embodiment of the present application. Figure 3 The embodiments of the present application are further described.
[0060] This process can be regarded as the training process of the initial video generation network, so firstly, the video picture sequences and the corresponding text descriptions in the training set can be obtained.
[0061] The first picture of the video picture sequence can be input into the BLIP model to obtain the text description information of the image, i.e., the first text information. Similarly, the text description is input into the large language model to generate a richer and more detailed text description, i.e., the second text information.
[0062] Then, the first text information and the second text information are input into the CLIP encoder to obtain text features, so as to obtain deep text features and provide rich semantic information for subsequent image generation.
[0063] Noise each picture in the video picture sequence, and then the first noise map and text features can be input into the UNet encoder as conditions to obtain the picture content features, and the picture content features are input into the UNet decoder for processing. After T diffusion iterations, the final predicted picture can be obtained, and then the difference between the final predicted picture and the real picture, that is, the first mean square error loss function, can be calculated. It should be noted that the real picture here can be the first picture before noise addition. Of course, if the encoder inputs the second noise map, then the real picture can be the second picture before noise addition.
[0064] After that, the final predicted image can be input into the image discriminator to determine whether the generated image is a real image, and then the cross entropy loss of the real label (such as the first image) and the predicted label (the label of the final predicted image) is calculated, that is, the first cross entropy loss, to train the discriminator to distinguish between real images and generated images. In this way, the UNet encoder, UNet decoder, and image discriminator can be trained to accurately understand the input and generate accurate prediction images.
[0065] Furthermore, the text encoding, video noise map sequence and image content features can be input into the transformer encoder for processing to obtain the corresponding encoding results. Similarly, after T diffusion iterations, the final predicted video image can be obtained. The difference between each video image and each real video image can be calculated through the mean square error loss, that is, the second mean square error loss function. After that, the predicted video image can also be input into the video discriminator to determine whether the generated video is a real video, and then the cross entropy loss of the real label and the predicted label is calculated, that is, the second cross entropy loss function. In this way, the image and text features can be fully utilized, and these features can be gradually integrated, processed and optimized through multiple steps, so as to realize the understanding and generation of video content. In the network training process, the initial video generation network can be trained by combining the above-mentioned mean square error loss function and cross entropy loss function to obtain the target video generation network, so as to realize the efficient generation of video content.
[0066] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.
[0067] The following are device embodiments of the present application, which can be used to execute the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
[0068] Figure 4 Schematic diagram of a video generation network training device provided in an embodiment of the present application. Figure 4 As shown, the training device of the video generation network includes:
[0069] An acquisition module 401 is configured to acquire a video picture sequence of a video picture sequence training set and a text description of a text description training set, wherein the text description corresponds to the video picture sequence;
[0070] The noise adding module 402 is configured to add noise to the video picture sequence to obtain a video noise picture sequence, and obtain text features representing the video picture sequence based on the first picture and the text description of the video picture sequence;
[0071] The first processing module 403 is configured to use a first type of encoder and a first type of decoder to perform image generation diffusion iterative processing on the first noise image and text features of the video noise image sequence to obtain image content features and a final predicted image, construct a first mean square error loss function based on the final predicted image and the real image, input the final predicted image into an image discriminator, and construct a first cross entropy loss function based on the final predicted image and the real image to distinguish the final predicted image from the real image;
[0072] The second processing module 404 is configured to use a second type of encoder and a second type of decoder to perform video generation diffusion iterative processing on the video noise image sequence, the picture content features, and the text features to obtain a predicted video image, construct a second mean square error loss function based on the predicted video image and the real video image, and input the predicted video image to a video discriminator, and construct a second cross entropy loss function based on the predicted video image and the real video image to distinguish the predicted video image from the real video image;
[0073] The training module 405 is configured to train the initial video generation network based on the first mean square error loss function, the first cross entropy loss function, the second mean square error loss function and the second cross entropy loss function to obtain a target video generation network.
[0074] In some embodiments, the noise adding module 402 is specifically used to input the first picture into the cross-modal processing model for processing to obtain first text information; use the large language model to expand the text description to obtain second text information; splice the first text information and the second text information to obtain third text information, and process the third text information through a text encoder to obtain text features.
[0075] In some embodiments, the first processing module 403 is specifically used to input the first noise map and text features into the first type of encoder, and obtain the image content features through encoding; process the image content features through the first type of decoder to obtain an initial predicted image; and perform a first preset number of image generation diffusion iterative processing on the initial predicted image based on the first type of encoder and the first type of decoder to obtain a final predicted image.
[0076] In some embodiments, the second processing module 404 is specifically used to process the video noise image sequence, picture content features and text features through a second type of encoder to obtain an encoding result; process the encoding result through a second type of decoder to obtain an initial predicted video image; based on the second type of encoder and the second type of decoder, perform a second preset number of video generation diffusion iterative processing on the initial predicted video image to obtain a predicted video image.
[0077] In some embodiments, the second processing module 404 is specifically used to input the video noise image sequence into the first second-category encoding module, and perform fusion processing with the text features and the image content features to obtain the output result of the first second-category encoding module; the output result, the text features and the image content features are input into the next second-category encoding module for processing until the last second-category encoding module outputs the encoding result.
[0078] In some embodiments, the second processing module 404 is specifically used to subject the video noise image sequence to layer normalization and multi-head self-attention processing in sequence to obtain a self-attention output; perform a residual connection between the self-attention output and the video noise image sequence to obtain a first addition result; use a multi-head cross-attention mechanism to fuse the text feature with the first addition result to obtain a fusion result; perform a residual connection between the fusion result and the first addition result to obtain a second addition result; perform a residual connection between the second addition result and the image content feature with the same dimension as the text feature to obtain a third addition result; perform layer normalization and position-by-position element-by-element feedforward network processing on the third addition result to obtain a feedforward network output; perform a residual connection between the feedforward network output and the third addition result to obtain the output result of the first second-category encoding module.
[0079] In some embodiments, the second processing module 404 is specifically used to perform maximum pooling on the image content features to obtain a maximum pooling result; the maximum pooling result is processed by a multi-layer perceptron to map the image content features to the same dimensional space as the second type of encoder input to obtain image content features with the same dimension as the text feature.
[0080] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0081] Figure 5 Schematic diagram of an electronic device 5 provided in an embodiment of the present application. Figure 5 As shown, the electronic device 5 of this embodiment includes: a processor 501, a memory 502, and a computer program 503 stored in the memory 502 and executable on the processor 501. When the processor 501 executes the computer program 503, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 501 executes the computer program 503, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0082] The electronic device 5 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 5 may include, but is not limited to, a processor 501 and a memory 502. Those skilled in the art will appreciate that Figure 5 The electronic device 5 is merely an example and does not limit the electronic device 5 , and may include more or less components than those shown in the figure, or different components.
[0083] The processor 501 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0084] The memory 502 may be an internal storage unit of the electronic device 5, for example, a hard disk or memory of the electronic device 5. The memory 502 may also be an external storage device of the electronic device 5, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 5. The memory 502 may also include both an internal storage unit of the electronic device 5 and an external storage device. The memory 502 is used to store computer programs and other programs and data required by the electronic device.
[0085] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0086] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the present application implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, which may be in source code form, object code form, executable file or some intermediate form. Computer-readable media may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0087] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A training method for a video generation network, It is characterized in that include: Obtain a video picture sequence from a video picture sequence training set and a text description from a text description training set, wherein the text description corresponds to the video picture sequence; Noising the video picture sequence to obtain a video noise image sequence, and obtaining text features characterizing the video picture sequence based on the first picture of the video picture sequence and the text description; Using a first type of encoder and a first type of decoder, performing image generation diffusion iterative processing on the first noise image of the video noise image sequence and the text feature to obtain image content features and a final predicted image, constructing a first mean square error loss function based on the final predicted image and the real image, and inputting the final predicted image into an image discriminator, constructing a first cross entropy loss function based on the final predicted image and the real image to distinguish the final predicted image from the real image; Using a second type of encoder and a second type of decoder, performing video generation diffusion iterative processing on the video noise image sequence, the picture content features, and the text features to obtain a predicted video image, constructing a second mean square error loss function based on the predicted video image and the real video image, and inputting the predicted video image into a video discriminator, constructing a second cross entropy loss function based on the predicted video image and the real video image to distinguish the predicted video image from the real video image; The initial video generation network is trained based on the first mean square error loss function, the first cross entropy loss function, the second mean square error loss function, and the second cross entropy loss function to obtain a target video generation network.
2. The method according to claim 1, It is characterized in that The obtaining, based on the first picture of the video picture sequence and the text description, a text feature characterizing the video picture sequence includes: Inputting the first picture into the cross-modal processing model for processing to obtain first text information; Expanding the text description using a large language model to obtain second text information; The first text information and the second text information are concatenated to obtain third text information, and the third text information is processed by a text encoder to obtain the text feature.
3. The method according to claim 1, It is characterized in that The method uses the first type of encoder and the first type of decoder to perform image generation diffusion iterative processing on the first noise image of the video noise image sequence and the text feature to obtain image content features and a final predicted image, including: Inputting the first noise image and the text feature into the first type of encoder, and obtaining the image content feature through encoding; Processing the picture content features through the first type of decoder to obtain an initial predicted picture; Based on the first type of encoder and the first type of decoder, a first preset number of picture generation diffusion iterative processes are performed on the initial prediction picture to obtain the final prediction picture.
4. The method according to claim 1, It is characterized in that The method of using the second type encoder and the second type decoder to perform video generation diffusion iterative processing on the video noise image sequence, the picture content features, and the text features to obtain a predicted video image includes: Processing the video noise image sequence, the picture content features, and the text features through the second type of encoder to obtain an encoding result; Processing the encoding result through the second type of decoder to obtain an initial predicted video image; Based on the second type of encoder and the second type of decoder, a second preset number of video generation diffusion iterations are performed on the initial predicted video image to obtain the predicted video image.
5. The method according to claim 4, It is characterized in that The second type encoder includes a plurality of second type encoding modules, and the video noise image sequence, the picture content features, and the text features are processed by the second type encoder to obtain an encoding result, including: Inputting the video noise image sequence into a first second-category encoding module, fusing it with the text features and the image content features, and obtaining an output result of the first second-category encoding module; The output result, the text feature and the image content feature are input to the next second-category encoding module for processing until the last second-category encoding module outputs the encoding result.
6. The method according to claim 5, It is characterized in that The step of inputting the video noise image sequence into a first second-category encoding module, fusing it with the text features and the image content features, and obtaining an output result of the first second-category encoding module includes: The video noise image sequence is subjected to layer normalization and multi-head self-attention processing in sequence to obtain a self-attention output; Performing a residual connection between the self-attention output and the video noise map sequence to obtain a first addition result; Using a multi-head cross attention mechanism to fuse the text feature with the first addition result to obtain a fusion result; Performing a residual connection on the fusion result and the first addition result to obtain a second addition result; Performing a residual connection on the second addition result and the picture content feature having the same dimension as the text feature to obtain a third addition result; The third addition result is sequentially subjected to layer normalization and position element-by-element feedforward network processing to obtain a feedforward network output; The feedforward network output and the third addition result are residually connected to obtain the output result.
7. The method according to claim 6, It is characterized in that Before performing residual connection on the second addition result and the picture content feature with the same dimension as the text feature to obtain the third addition result, the method further includes: The image content features are subjected to maximum pooling to obtain a maximum pooling result; The maximum pooling result is processed by a multi-layer perceptron, and the image content features are mapped to the same dimensional space as the second type of encoder input to obtain the image content features with the same dimension as the text features.
8. A training device for a video generation network, It is characterized in that include: An acquisition module is configured to acquire a video picture sequence of a video picture sequence training set and a text description in a text description training set, wherein the text description corresponds to the video picture sequence; a noise adding module configured to add noise to the video picture sequence to obtain a video noise picture sequence, and obtain text features characterizing the video picture sequence based on the first picture of the video picture sequence and the text description; A first processing module is configured to use a first type of encoder and a first type of decoder to perform image generation diffusion iterative processing on the first noise image of the video noise image sequence and the text feature to obtain image content features and a final predicted image, construct a first mean square error loss function based on the final predicted image and the real image, input the final predicted image into an image discriminator, and construct a first cross entropy loss function based on the final predicted image and the real image to distinguish the final predicted image from the real image; A second processing module is configured to use a second type of encoder and a second type of decoder to perform video generation diffusion iterative processing on the video noise image sequence, the picture content features and the text features to obtain a predicted video image, construct a second mean square error loss function based on the predicted video image and the real video image, and input the predicted video image into a video discriminator, and construct a second cross entropy loss function based on the predicted video image and the real video image to distinguish the predicted video image from the real video image; A training module is configured to train an initial video generation network based on the first mean square error loss function, the first cross entropy loss function, the second mean square error loss function and the second cross entropy loss function to obtain a target video generation network.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A storage medium storing a computer program. It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Method and device for generating video by using image, equipment and medium
CN119364135A
Multi-modal image sample generation method for intelligent operation of high-speed railway
CN119919757A
Video text method and device based on time sequence motion perception and electronic equipment
CN120853083A
