Lip sound synchronous processing and model training method, electronic equipment and storage medium
By masking facial data and extracting features from audio data, combined with a pre-trained diffusion model to generate lip synchronization videos, the problem of poor lip synchronization processing quality and high training cost in the existing technology is solved, and efficient lip synchronization effects are achieved.
Patent Information
- Application Number
- CN202410797796.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-09-17
AI Technical Summary
When it is difficult to achieve lip synchronization processing with the existing technology, the quality of the generated two-dimensional speaking digits is poor, and the training cost is high, requiring secondary training based on specific face data.
By masking the input face data and extracting speech features from the audio data, various levels of sampling feature maps of the mouth feature video frames are generated and input into the pre-trained diffusion model, combined with the face mask video frames Perform lip sync video generation.
It achieves more synchronized and smooth lip sounds, significantly reduces the workload of manually adjusting lip animations in post-production, improves work efficiency, and reduces training costs.
Smart Images

Figure CN118658100A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of audio processing technology, and in particular to a lip synchronization processing and model training method, an electronic device, and a storage medium. Background Art
[0002] In recent years, with the development of cutting-edge technologies such as virtual reality, virtual worlds and digital spaces represented by the metaverse are ushering in a new era of the Internet. In the fields of film and television production, online education, and live streaming, the technology of two-dimensional digital human speaking has broad application prospects. With the development of deep learning technology, methods for generating a large number of two-dimensional speaking digital humans have emerged.
[0003] In the related art, lip synchronization is achieved based on pixel-based face reconstruction loss, but this method cannot effectively constrain audio-lip synchronization, guide accurate lip shape, or ignore the dynamic changes of lip shape and generate artifacts, resulting in blur, resulting in poor quality of the generated two-dimensional speaking digital human. In addition, in some methods for achieving lip synchronization, secondary training is required for a small data set for a specific person, which increases the training cost. In this case, how to achieve low-cost and high-quality lip synchronization of two-dimensional speaking digital humans has become an urgent problem to be solved. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a lip synchronization processing and model training method, an electronic device and a storage medium to at least partially solve the above problems.
[0005] According to a first aspect of an embodiment of the present application, a lip synchronization processing method is provided, comprising: performing mask processing on input facial data to obtain a face mask video frame; performing speech feature extraction on input audio data to obtain a mouth feature video frame; generating sampling feature maps at various levels of the mouth feature video frame; at least inputting the face mask video frame into a main input side of a pre-trained diffusion model, and inputting the sampling feature maps at various levels of the mouth feature video frame into a first conditional input side of the pre-trained diffusion model to obtain a lip synchronization video.
[0006] According to a second aspect of an embodiment of the present application, there is provided an electronic device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform an operation corresponding to the method described in the first aspect.
[0007] According to a third aspect of an embodiment of the present application, a computer storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in the first aspect is implemented.
[0008] According to the scheme provided in the embodiment of the present application, the input face data is masked to obtain a face mask video frame; the input audio data is subjected to speech feature extraction to obtain a mouth feature video frame; the sampling feature graphs of each level of the mouth feature video frame are generated; at least the face mask video frame is input to the main input side of the pre-trained diffusion model, and the sampling feature graphs of each level of the mouth feature video frame are input to the first conditional input side of the pre-trained diffusion model to obtain a lip-sync video. In this process, the mouth morphology information corresponding to the face is provided by the sampling feature graphs of each level of the mouth feature video frame, and these feature graphs represent different levels of abstraction and representation of the input mouth feature video frame, which can provide rich conditional information for the subsequent lip-sync video. The face mask video frame is used as the main input of the diffusion model, and the sampling feature maps of the mouth feature video frame at various levels are input as conditional constraints to the conditional input side of the diffusion model. The diffusion model has learned the association between speech and human lip shape, and can generate lip-sync video based on the face mask video frame and the sampling feature maps of the mouth feature video frame at various levels, so that the lip sounds of the digital person in the speaking video are more synchronized. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, 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 recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0010] Figure 1 It is a flowchart of a lip synchronization processing method provided in an embodiment of the present application;
[0011] Figure 2 A general architecture diagram of a lip sync processing system is provided for an embodiment of the present application;
[0012] Figure 3 A schematic diagram of a face mask processing effect provided in an embodiment of the present application;
[0013] Figure 4 A speech extraction flow chart provided for an embodiment of the present application;
[0014] Figure 5 A schematic diagram of the effect of the interaction between the mouth control model and the diffusion model provided in an embodiment of the present application;
[0015] Figure 6 A schematic diagram of the interaction effect between a face reference model and a diffusion model provided in an embodiment of the present application;
[0016] Figure 7A schematic diagram of the effect of the interaction among a mouth control model, a face reference model and a diffusion model provided in an embodiment of the present application;
[0017] Figure 8 A flowchart of a lip synchronization model training method provided in an embodiment of the present application;
[0018] Fig. 9 It is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0019] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions 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. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the embodiments of the present application should fall within the scope of protection of the embodiments of the present application.
[0020] The lip sync processing method provided by the embodiment of the present application is described below. Figure 1 As shown, Figure 1 1 is a flow chart of a lip sync processing method provided in an embodiment of the present application. The lip sync processing method provided in an embodiment of the present application can be executed by a lip sync processing device provided in an embodiment of the present application, and the device can be implemented in software and / or hardware. In a specific embodiment, the device can be integrated in an electronic device, and the electronic device can be a computer, a server, etc.
[0021] In order to adapt the lip sync processing method provided in the embodiment of the present application, the embodiment of the present application also provides a general architecture diagram of a lip sync processing system, that is, the lip sync processing method of the embodiment of the present application can be applied to the lip sync processing system provided in the embodiment of the present application. Figure 2 As shown, Figure 2The general architecture diagram of a lip sync processing system provided in an embodiment of the present application. During the training phase, the general architecture diagram forms a lip sync module through a mouth control model, a diffusion model and a face reference model. It includes extracting audio and video frames from the input audio-visual synchronization video (i.e., lip sync video), using a speech feature extraction module to extract mouth key points corresponding to the video frame according to the audio (i.e., mouth feature video frame), using the mouth key points as conditional input of the mouth control model for processing, and generating sampling feature maps of various levels corresponding to the mouth feature video frame, that is, providing morphological information of the mouth. Randomly select any face image (i.e., face data) from the video frame after image processing as a face reference image, input the face reference image into the face reference model for processing, obtain a face reference feature map, input the face reference feature map into the diffusion model, that is, the mouth missing two-dimensional picture generation model, and the face reference feature map provides an appearance reference of the lower half of the face for the subsequently generated lip sync video. In addition, the mouth of the video frame after image processing is removed to obtain a video frame without the mouth (i.e., a face mask video frame), which is then input into the diffusion model. Finally, the diffusion model generates a lip-sync video based on the sampling feature maps at all levels corresponding to the mouth feature video frame, the video frame without the mouth, and the face reference feature map. In the inference stage, a video and an audio clip corresponding to the target user are input. Figure 2 Processing is performed to obtain the lip synchronization video of the target user.
[0022] It should be noted that Figure 2 The overall architecture diagram of the lip sync processing system shown is only an example and does not limit the actual application scenario type, deployment method, etc. In actual applications, the lip sync processing system can be customized according to specific application scenarios and actual needs. Figure 2 The overall architecture diagram of the lip synchronization processing system shown is adaptively adjusted.
[0023] Combine the following Figure 2 The overall architecture diagram shown illustrates the lip synchronization processing method provided by the embodiment of the present application. Figure 1 This embodiment will be specifically described from the following steps.
[0024] S101. Perform mask processing on input face data to obtain a face mask video frame.
[0025] In the embodiment of the present application, masking is performed on the face data, that is, erasing the parts of the lower half of the face, such as erasing the mouth, cheeks, jaw, etc., to obtain a video frame containing only the upper half of the face, that is, a face masked video frame. The face data is a video frame containing a face that has been image preprocessed, and the face data may be multiple.
[0026] In a feasible method, a video and an audio clip obtained when a user speaks are received, and the video frames containing the face are subjected to image preprocessing such as face detection and face alignment in sequence, the face part is cropped, and then the video frame resolution is adjusted to, for example, 512×512 and the frame rate is adjusted to, for example, 25fps, and then further facial key point detection is performed. Finally, a U-shaped mask is used to erase the mouth, cheeks, jaw, etc. of the face according to the detected facial key points to obtain a face mask video frame.
[0027] For example, Figure 3 As shown, Figure 3 A schematic diagram of a face mask processing effect provided in an embodiment of the present application. Figure 3 As shown, mouth mask processing is performed on each frame of input face data to obtain a video frame without the mouth, that is, a face masked video frame.
[0028] S102: extract speech features from the input audio data to obtain a mouth feature video frame.
[0029] In an embodiment of the present application, the mouth features focus on the mouth shape and its dynamic changes when the user pronounces a word, including but not limited to lip shape (the degree of opening and closing of the lips, the rounding state (rounded lips / unrounded lips) and the movement trajectory of the lips), tongue position, jaw position and throat movement, etc., and speech features are extracted from the input audio data to obtain the speech features corresponding to each frame of video, and the mouth feature video frames extracted from the speech fragments are obtained based on the speech features corresponding to each frame of video.
[0030] In one possible approach, Figure 4 As shown, Figure 4 A speech extraction flow chart provided in an embodiment of the present application. Figure 4 In the example, after receiving a segment of audio when the user is speaking, the audio can be processed. Specifically, the audio sampling rate can be set to 16kHz, and then processed into a Mel-spectrogram of a size of 16×80 to obtain a speech feature sequence. L is the total number of frames of the input video. The obtained speech feature sequence Input to the convolutional neural network L a -net, get the corresponding voice segment a i The corresponding frame F is extracted i For example, 20 mouth key points P aud , that is, the mouth feature video frame.
[0031] Before using the convolutional neural network to extract the mouth feature video frame, the convolutional neural network needs to be trained. During the training process, the first mouth key point is obtained by detecting the face key point of the video corresponding to the received user in the image processing stage. When processing the audio corresponding to the received user, the voice feature is input into the convolutional neural network to obtain the second mouth key point. The wing loss can be used to measure the loss. Then the convolutional neural network L a The loss function of -net is as follows:
[0032]
[0033] In the above formula (1), P aud is the second mouth key point, P gt is the first mouth key point. The non-negative w sets the range of the nonlinear part to (-w, w), ∈ limits the nonlinear region of the curve, and C = w-wln(1+w / ∈) is a constant, which smoothly connects the linear region and the nonlinear region. The Adam optimizer can be used for optimization iteration.
[0034] S103: Generate sampling feature maps of each level for the mouth feature video frame.
[0035] In the embodiment of the present application, the sampling feature graphs at each level are outputs generated by different levels of the model. These feature graphs represent different levels of abstraction and representation of the input mouth feature video frames, and can provide rich conditional information for the subsequent lip synchronization video. By introducing a mouth control model, namely a mouth ControlNet model, the mouth feature video frames are input into the mouth ControlNet model, and the sampling feature graphs at each level are obtained through the outputs generated by different levels of the mouth ControlNet model.
[0036] The mouth ControlNet model consists of two parts: a pre-trained variational autoencoder (VAE) and a copy of the trainable diffusion model encoding block and intermediate block, with an additional zero convolution layer. The encoding block and intermediate block of the mouth ControlNet model are added to the decoding block and intermediate block of the diffusion model respectively, and the output of each copy block can be added to the jump connection of the diffusion model U-Net.
[0037] For example, Figure 5 As shown, Figure 5 Schematic diagram of the effect of the mouth control model and the diffusion model interaction provided in the embodiment of the present application, combined with Figure 5 , the sampling feature maps of each level of the mouth feature video frame generated by the mouth ControlNet model are as follows:
[0038] Step 1: Draw the mouth feature video frames extracted in S102 into an image sequence (L is length, H is width, and W is height) is input into the pre-trained VAE encoder ε to obtain the latent space feature map z mouth =ε(F mouth ).
[0039] Step 2: Substitute the z obtained in step 1 mouth Add noise The copies of the encoding block and the intermediate block of the trainable diffusion model are sent to the mouth ControlNet model, and then the output of each copy block is added to the jump connection of the diffusion model U-Net, and finally the sampling feature maps of each level are obtained.
[0040] Among them, Figure 5 In , both the mouth ControlNet model and the diffusion model include spatial attention layer, cross attention layer and temporal attention layer.
[0041] S104: at least input the face mask video frame to the main input side of the pre-trained diffusion model, and input the sampling feature maps of each level of the mouth feature video frame to the first conditional input side of the pre-trained diffusion model to obtain a lip-sync video.
[0042] Pre-trained diffusion models allow the model to generate data based on additional input information (conditions), which can be a category label, a text description, another image, or any form of guiding signal, with the goal of guiding the generation process so that the generated results meet specific conditions or properties.
[0043] In an embodiment of the present application, the face mask video frame is input to the main input side of the pre-trained diffusion model, and the face mask video frame is encoded by the variational autoencoder in the main input side to obtain a latent space feature map. The sampling feature maps of the mouth feature video frame at all levels are input to the first condition input side of the pre-trained diffusion model as additional input conditions of the pre-trained diffusion model, that is, the sampling feature maps of the mouth feature video frame at all levels are input as additional mouth appearance control, combined with the latent space feature map corresponding to the main input side, to obtain a lip synchronization video.
[0044] It can be understood that in the embodiment of the present application, the input face data is masked to obtain a face mask video frame; the input audio data is subjected to speech feature extraction to obtain a mouth feature video frame; the sampling feature graphs of each level of the mouth feature video frame are generated; at least the face mask video frame is input to the main input side of the pre-trained diffusion model, and the sampling feature graphs of each level of the mouth feature video frame are input to the first conditional input side of the pre-trained diffusion model to obtain a lip-sync video. In this process, the mouth morphology information corresponding to the face is provided by the sampling feature graphs of each level of the mouth feature video frame, the face mask video frame is used as the main input of the diffusion model, and the sampling feature graphs of each level of the mouth feature video frame are input as additional input conditions to the conditional input side of the diffusion model. The diffusion model has learned the association between speech and human lip shape. The input face mask video frame and the sampling feature graphs of each level of the mouth feature video frame are processed by the diffusion model, so that the lip sound of the digital person in the speaking video is more synchronized and smooth. And in this way, the workload of manually adjusting the lip shape animation in post-production can be significantly reduced, and work efficiency can be improved.
[0045] In some embodiments of the present application, the lip synchronization processing method further includes S105, which is described by the following steps.
[0046] S105: Perform image preprocessing on the input face data to obtain a face reference feature map.
[0047] In some embodiments of the present application, the facial reference feature map provides an appearance reference of the lower half of the face for subsequent lip-sync video, including but not limited to references to facial contours, facial features, expressions and features.
[0048] Among them, at least one face image can be obtained from the input face data, and image preprocessing operations including but not limited to grayscale, noise removal, edge detection and enhancement can be performed on it to obtain a processed face image. Feature extraction is performed on the processed face image to obtain a face reference feature map.
[0049] In a feasible manner, a pre-trained face reference model may be introduced, and after image pre-processing of the input face data, the processed face image may be input into the pre-trained face reference model to obtain a face reference feature map.
[0050] It can be understood that in some embodiments of the present application, image preprocessing is performed on the input facial data to obtain facial reference feature maps, so that subsequent operations such as lip synchronization can be better performed based on these facial reference feature maps, ensuring that the lip shape in the generated lip-sync video matches the appearance style of the original facial data.
[0051] In some embodiments of the present application, in the above S104, at least the face mask video frame is input into the main input side of the pre-trained diffusion model, and the sampling feature maps of each level of the mouth feature video frame are input into the first conditional input side of the pre-trained diffusion model, and the lip-sync video is obtained by the following S1041, which is explained in the following steps.
[0052] S1041. Input the face mask video frame to the main input side of the pre-trained diffusion model, input the sampling feature maps of each level of the mouth feature video frame to the first conditional input side of the pre-trained diffusion model, and input the face reference feature map to the second conditional input side of the pre-trained diffusion model to obtain a lip-sync video.
[0053] In some embodiments of the present application, the sampling feature maps of each level of the mouth feature video frame are used as the first condition input to provide mouth morphology information, and the face reference feature map is used as the second condition input to provide face appearance reference information. Through these conditional constraints, combined with the face mask video frame on the main input side, a lip-sync video is obtained, so that the guided diffusion model retains the specific structure and details of the face while generating the lip-sync video frame.
[0054] It can be understood that in some embodiments of the present application, in order to retain the specific structure and details of the face while generating lip-sync video, the face mask video frame is input into the main input side of the pre-trained diffusion model, and the face reference feature map and the sampling feature maps of the mouth feature video frame at various levels are input into the pre-trained diffusion model as conditional constraints, thereby improving the generation quality of the lip-sync video.
[0055] In some embodiments of the present application, the above-mentioned S105 performs image preprocessing on the input facial data to obtain a facial reference feature map, which can be implemented by the following S1051, and the above-mentioned S1041 can be implemented by the following S1041A and S1041B, which are specifically explained by the following steps.
[0056] S1041A. Input the face mask video frame into the encoder in the first variational autoencoder to obtain a first latent space feature map corresponding to the main input side.
[0057] Among them, the pre-trained diffusion model includes the first variational autoencoder, which includes an encoder and a decoder. The encoder maps high-dimensional input data to a low-dimensional latent space, and the decoder reconstructs the vector extracted from the latent space back to the high-dimensional representation of the original data space. In short, it attempts to generate data similar to the original input based on the latent variables.
[0058] In some embodiments of the present application, in order to capture the main change patterns and structural information in the data, an encoder in a first variational autoencoder is used to receive an input high-dimensional face mask video frame, and convert it into a low-dimensional feature map through a series of neural network layers to obtain a first latent space feature map. This process involves compressing the data of the input face mask video frame.
[0059] S1041B, determining a lip-sync video frame based on the first latent space feature map, the sampling feature maps at each level, and the face reference feature map.
[0060] In some embodiments of the present application, the first latent space feature map obtained on the main input side, the sampling feature maps at each level on the first conditional input side, and the face reference feature map on the second conditional input side are combined to determine the lip-sync video frame, thereby improving the data processing efficiency of the model. Moreover, through the first latent space feature map, randomness is introduced into the generation process, so that the diffusion model can learn the diversity of the data and generate different but still reasonable outputs during decoding.
[0061] S1051. Obtain preset face data from the input face data; and input the preset face data into a pre-trained face reference model to obtain a face reference feature map.
[0062] In some embodiments of the present application, the input facial data may be a plurality of different facial video frames, and the preset facial data may be at least one facial video frame randomly selected from a plurality of different facial video frames, which may be used as a facial reference image, and the at least one selected facial video frame may be input into a pre-trained facial reference model to provide an appearance reference for the lower half of the face for subsequent lip-sync video, including but not limited to references to facial contours, facial features, expressions and features.
[0063] The face reference model is constructed using the same framework as the diffusion model, but the temporal attention layer is removed from the face reference model. The face reference model inherits the weights of the original Stable Diffusion, and the weights are updated independently. The original self-attention layer is replaced by a spatial attention layer.
[0064] It can be understood that in some embodiments of the present application, the input face mask video frame is encoded by the encoder in the first variational autoencoder in the pre-trained diffusion model to obtain the first latent space feature map, which not only compresses the input data, that is, the input face mask video frame, but also provides the possibility for the generation of new results and the exploration of the latent space. The lip synchronization video is determined based on the first latent space feature map, the sampling feature maps at all levels and the face reference feature map. By taking the sampling feature maps at all levels and the face reference feature map as conditional constraints and combining the first latent space feature map, the generated lip synchronization video has higher quality and fluency. Preset face data is obtained from the input face data; and the preset face data is input into the pre-trained face reference model to obtain the face reference feature map, and the face reference feature map is used to subsequently ensure that the lip shape in the generated lip synchronization video matches the appearance style of the original face image.
[0065] In some embodiments of the present application, in the above S1051, the preset face data is input into the pre-trained face reference model, and obtaining the face reference feature map can be achieved through S1051A and S1051D, which is specifically explained through the following steps.
[0066] S1051A. Input the preset face data into the encoder in the second variational autoencoder to obtain a second latent space feature map.
[0067] In some embodiments of the present application, the face reference model includes a second variational autoencoder, which is composed of an encoder and a decoder. In order to capture the main change patterns and structural information in the face data, the encoder in the second variational autoencoder receives the input high-dimensional face data and converts it into a low-dimensional feature map through a series of neural network layers to obtain a second latent space feature map, which involves data compression of the input face data.
[0068] S1051B, input the second latent space feature map into the second spatial attention layer for copying, to obtain a copied second latent space feature map, and splice the copied second latent space feature map and the first latent space feature map through the second spatial attention layer to obtain a spliced third feature map.
[0069] In some embodiments of the present application, the face reference model also includes a second spatial attention layer. In order to enable the face reference model to capture a wider range of contextual information, the second latent space feature map is input into the second spatial attention layer for replication to obtain a replicated second latent space feature map. In a feasible manner, when replicating the second latent space feature map, more contextual information or data can be introduced as a means of data amplification through spatial replication; or through channel replication, the depth of the feature map can be increased, allowing the model to learn more feature representations, etc.
[0070] In addition, after obtaining the copied second latent space feature map, in order to effectively increase the number of channels of the feature map so that the model can learn richer feature representations, the copied second latent space feature map and the first latent space feature map can be spliced by splicing the channel dimension. Before splicing the two feature maps, ensure that the copied second latent space feature map and the first latent space feature map involved in the splicing match in dimensions other than the splicing dimension (usually height and width). If they do not match, the feature map needs to be adjusted by upsampling (increasing the size) or downsampling (reducing the size) operations to ensure consistency in the spatial dimension.
[0071] S1051C. Input the third feature map into the first spatial attention layer to obtain a fourth feature map.
[0072] In some embodiments of the present application, the pre-trained diffusion model also includes a first spatial attention layer, and the spatial attention layer mainly allows the model to learn to automatically focus on the most critical or most informative areas when processing feature maps, while reducing attention to unimportant or interfering information. After the third feature map is input into the first spatial attention layer, attention weight calculation, weighted fusion and other operations are performed to obtain a weighted feature map, i.e., the fourth feature map, and use it as the output of the first spatial attention layer. The fourth feature map retains the size of the original feature map, but the information therein has been screened and re-weighted to highlight the parts that are more important for subsequent tasks. Through this series of processing, the first spatial attention layer enables the model to dynamically and adaptively focus on the most relevant or most informative parts of the input data, thereby improving the performance and efficiency of the pre-trained diffusion model in complex tasks.
[0073] S1051D. Input the fourth feature map into the second cross-attention layer to obtain a face reference feature map.
[0074] In some embodiments of the present application, the face reference model also includes a second cross-attention layer, which mainly strengthens important information through dynamic attention allocation and ignores irrelevant interference, thereby improving the performance of the face reference model on the target task. After the fourth feature map is input into the second cross-attention layer, it is mapped to the query, key and value matrix, the attention weight is calculated, the context vector is calculated, and the face reference data is decoded according to the obtained context vector. By inputting the fourth feature map into the second cross-attention layer, the decoding process can selectively focus on the most relevant part of the input fourth feature map when generating each output, thereby improving the understanding ability of the face reference model and the quality of the face reference data.
[0075] For example, Figure 6 As shown, Figure 6A schematic diagram of the interaction effect of a face reference model and a diffusion model provided in an embodiment of the present application, according to Figure 6 S1051A and S1051D are described below. Figure 6 In the above example, the face reference model does not include the temporal attention layer. The selected preset face data is processed by the variational autoencoder to obtain z ref =ε(I ref ) is the second latent space feature map, the second latent space feature map is replicated L times in the spatial attention layer of the face reference model, and the corresponding z 1:L , that is, the first latent space feature map is spliced along the w (horizontal) direction, and the spliced feature map is input into the spatial attention layer of the pre-trained diffusion model for processing, and then the feature map obtained by the spatial attention layer of the pre-trained diffusion model is taken along the w direction. The first half is input into the cross attention layer of the face reference model. By using the output of the spatial attention layer of the face reference model as the input of the spatial attention layer in the pre-trained diffusion model, the pre-trained diffusion model can deeply mine the key information of the input feature map.
[0076] It can be understood that in some embodiments of the present application, the encoder in the second variational autoencoder is used to encode the preset face data to obtain the second latent space feature map, which effectively captures the main change patterns and structural information in the face data. By inputting the second latent space feature map into the second spatial attention layer for replication, the replicated second latent space feature map is obtained, and the replicated second latent space feature map and the first latent space feature map are spliced through the second spatial attention layer to obtain the spliced third feature map, which increases the depth of the feature map and enables the model to learn richer feature representations. By inputting the third feature map into the first spatial attention layer to obtain the fourth feature map, the model can dynamically and adaptively focus on the most relevant or most informative part of the input data, thereby improving the performance and efficiency of the model in complex tasks. By inputting the fourth feature map into the second cross attention layer to obtain the face reference data, the decoding process can selectively focus on the most relevant part of the input feature map when generating each output, thereby improving the generation efficiency and quality of the face reference data.
[0077] In some embodiments of the present application, in the above S1041, the face mask video frame is input into the main input side of the pre-trained diffusion model, the sampling feature maps of each level of the mouth feature video frame are input into the first conditional input side of the pre-trained diffusion model, and the face reference feature map is input into the second conditional input side of the pre-trained diffusion model. Obtaining the lip-sync video can be achieved through S1041A to S1041D, which is specifically explained through the following steps.
[0078] S1041A. Input the concatenated third feature map into the first spatial attention layer to obtain a fifth feature map.
[0079] In some embodiments of the present application, the spliced third feature map obtained by processing the second spatial attention layer of the face reference model is input into the first spatial attention layer of the pre-trained diffusion model, and attention weight calculation, weighted fusion and other operations are performed to obtain a weighted feature map, that is, the fifth feature map as the output of the first spatial attention layer.
[0080] S1041B, down-sample the fifth feature map to obtain a sixth feature map; and input the sixth feature map into the first cross attention layer to obtain a seventh feature map;
[0081] In some embodiments of the present application, downsampling is to reduce the dimension of the data to achieve the purpose of reducing the amount of data. The purpose of dimensionality reduction is achieved by downsampling the fifth feature map to obtain a sixth feature map, and after the sixth feature map is input into the first cross attention layer, it is mapped to the query, key and value matrix, calculates the attention weight, calculates the context vector, and other operations to obtain the seventh feature map.
[0082] For example, if the concatenated dimensions are The output is processed by the spatial attention module Then taking the first half dimension along the w direction becomes Where C is the number of channels.
[0083] S1041C. Adjust the dimension of the seventh feature map based on the frame length of the face mask video frame to obtain a feature sequence of a preset dimension.
[0084] In some embodiments of the present application, the purpose of dimensionality adjustment is to preserve the spatial and temporal features of the image and reorganize them into patterns in these sequences that the pre-trained diffusion model can understand and learn. The feature sequence of the preset dimension can be a one-dimensional feature sequence. In a feasible manner, the seventh feature map can be extracted element by element, spatiotemporal serialization, or depth-direction serialization. The one-dimensional feature sequence adjusted to the frame length is as follows
[0085] S1041D. Determine the lip-sync video based on a feature sequence of preset dimensions, a temporal attention layer, sampling feature maps at each level, and a face reference feature map.
[0086] In some embodiments of the present application, a feature sequence of a preset dimension is input into a temporal attention layer, and is combined with the seventh feature map respectively passed through the first spatial attention layer and the first cross attention layer through a residual connection in the temporal attention layer. A processed feature map is obtained through the combined feature map, the sampling feature maps at each level, and the face reference feature map. Finally, the processed feature map is decoded by the decoder in the first variational autoencoder to obtain a lip-sync video.
[0087] For example, Figure 7 As shown, Figure 7 A schematic diagram of the effect of the interaction between a mouth control model, a face reference model and a diffusion model provided in an embodiment of the present application. Figure 7 In the method, the audio and video are extracted from the input audio-visual synchronization video, a video frame is randomly selected as the face data in the video, the face data is input into the variational autoencoder for processing, and the latent space feature map output by the variational autoencoder is input into the face reference model to obtain the face reference feature map. The extracted video is image preprocessed, and the preprocessed face video frame is masked to obtain the face mask video frame. The face mask video frame is processed by the variational autoencoder to obtain the corresponding latent space feature map, and the corresponding latent space feature map is input into the diffusion model after adding noise. The extracted audio is processed according to the speech extraction module to obtain the mouth feature video frame. The processing of the mouth video frame by the variational autoencoder and the mouth control model has been described in detail above, and will not be elaborated here. Finally, the mouth control model inputs the feature sampling maps of each level corresponding to the output mouth feature video frame into the diffusion model, and the diffusion model combines the above input to obtain the lip-sync video.
[0088] It can be understood that in some embodiments of the present invention, the spliced third feature map is input into the first spatial attention layer to obtain the fifth feature map, so that the pre-trained diffusion model can deeply mine the key information of the input third feature map; the sixth feature map is obtained by downsampling the fifth feature map; and the sixth feature map is input into the first cross attention layer to obtain the seventh feature map, and the dimension of the seventh feature map is adjusted based on the frame length of the face mask video frame to obtain a feature sequence of preset dimension, and the lip synchronization video is determined based on the feature sequence of preset dimension, the temporal attention layer, the sampling feature maps at each level and the face reference feature map, and the quality and fluency of the generated lip synchronization video are improved based on the conversion of the feature map dimension and the introduction of the temporal attention layer.
[0089] In the embodiments of the present application, Figure 8 The flowchart of the training method of the lip synchronization model provided in the embodiment of the present application will be specifically described from the following steps.
[0090] S201. Obtain lip-sync video samples, where the lip-sync video samples include time-matched face video frame samples and audio samples.
[0091] In an embodiment of the present application, in the model training stage, the lip-sync video used for training is referred to as a lip-sync video sample, and the lip-sync video sample may be an existing lip-sync video.
[0092] Since a large amount of shooting work is not required to generate sample data, the channels for obtaining lip-sync video samples are wide and easy to obtain, which reduces the difficulty of obtaining training samples, increases the data volume of training samples, and thus improves the training accuracy of the model.
[0093] To reduce the complexity of model training, the lip sync video samples include a lip syncing person.
[0094] To improve the effect of model training, the characters in the lip-sync video samples can have standard or representative lip movements, such as news videos.
[0095] S202: Perform mask processing on the face video frame samples to obtain face mask video frames.
[0096] In an embodiment of the present application, the parts included in the lower half of the face of the face video frame sample are erased, such as the mouth, cheeks, jaw, etc. included in the lower half of the face, to obtain a video frame containing only the upper half of the face, that is, a face mask video frame.
[0097] Among them, before masking the face video frame samples, the video frames can be subjected to image preprocessing such as face detection and face alignment in turn, the face part can be cropped, and then the resolution can be adjusted. Finally, face key point detection can be performed, and mask processing can be performed based on the detected face key points.
[0098] S203: extract speech features from the audio sample to obtain mouth feature time series data.
[0099] In the embodiment of the present application, S203 is similar to the above-mentioned S102 and will not be described in detail here.
[0100] S204: At least use the face mask video frame as the main input, the mouth feature video frame as the conditional input, and the lip synchronization video sample as the output to train the diffusion model to obtain a lip synchronization model.
[0101] In an embodiment of the present application, the mouth feature video frame is input as a conditional constraint and the face mask video frame is input as the main input into the diffusion model respectively, the diffusion model outputs a predicted lip synchronization video, and the loss of the predicted lip synchronization video and the actual lip synchronization video samples are calculated, and the diffusion model is trained according to the loss to obtain a lip synchronization model.
[0102] It can be understood that in the embodiments of the present application, the mouth morphology information corresponding to the face is provided by sampling feature maps at various levels of the mouth feature video frame, the face mask video frame is used as the main input of the diffusion model, and the sampling feature maps at various levels of the mouth feature video frame are input as conditional constraints to the conditional input side of the diffusion model. By training the diffusion model, the lip synchronization model is obtained, thereby improving the training effect of the lip synchronization model.
[0103] In some embodiments of the present application, S204 at least takes the face mask video frame as the main input and the mouth feature video frame as the conditional input, trains the diffusion model, and obtains the lip synchronization model, which can be implemented through S2041 to S2043, and is specifically explained through the following steps.
[0104] S2041. Determine a predicted lip-sync image corresponding to the face based on a single mouth feature video frame in the mouth feature video frame, a preset face video frame in the face video frame, and a face mask video frame; and determine a first loss, a pixel-level loss, and a perceptual loss respectively based on the predicted lip-sync image.
[0105] In some embodiments of the present application, the perceptual loss is mainly to evaluate the similarity between the output predicted lip-sync image and the target lip-sync image in the high-level feature space, and the pixel-level loss is to compare the intensity value difference between the predicted lip-sync image (or output image) and the real lip-sync image (or target image) at each pixel position. A single mouth feature video frame is selected from multiple mouth feature video frames, and a face video frame (face reference video frame) is randomly selected from the face video frame, and the predicted lip-sync image corresponding to the face is determined in combination with the face mask video frame. After obtaining the predicted lip-sync image, a feature extractor can be introduced to further calculate the pixel loss and perceptual loss.
[0106] Exemplarily, a convolutional neural network model is introduced as a feature extractor, as described in the following formula:
[0107] L 1 =||I gt -I gen || 1 (2)
[0108]
[0109] In the above formulas (2) and (3), L 1 and L perceptual They are respectively the real lip synchronization images I gt and predicted lip sync image I gen The pixel level L 1 Loss and L perceptual Perceived loss, is a convolutional neural network, and l is the output of the lth layer of the convolutional neural network.
[0110] In addition, during the training phase, the audio samples in the lip-sync video samples can be processed by the mouth ControlNet model to obtain the mouth feature video frames, and the loss corresponding to the mouth ControlNet model can be determined based on the determined single mouth feature video frame; any face video frame can be selected as the face reference image from the face video frames included in the lip-sync video samples, and any face video frame can be processed by the face reference model to obtain the loss corresponding to the face reference model; the loss corresponding to the mouth ControlNet model, the loss corresponding to the face reference model, and the loss corresponding to the diffusion model are combined to obtain the first loss, that is, the first loss is the loss of the mouth ControlNet model, the face reference model, and the diffusion model. The first loss L d for:
[0111]
[0112] In the above formula (4), μ θ ,τ θ ,∈ θ is the trainable model part, ∈ θ represents the diffusion model, μ θ represents the face reference model, τ θ represents the ControlNet model of the mouth, I ref is the preset face video frame, F mouth Sequence of images drawn for mouth feature video frames.
[0113] Among them, the single mouth feature video frame and the preset face video frame can come from the same video.
[0114] S2042: Determine a predicted lip-sync video corresponding to the face based on a preset face video frame, a mouth feature video frame, and a face mask video frame.
[0115] In some embodiments of the present application, a temporal attention layer is introduced into the diffusion model, and a corresponding predicted lip sync video is generated based on a preset face video frame, a mouth feature video frame, and a face mask video frame. There are multiple mouth feature video frames, and the mouth feature video frame and the preset face video frame can be derived from the same video. The predicted lip sync video corresponding to the face is determined based on the preset face video frame, the mouth feature video frame, and the face mask video frame.
[0116] S2043. Determine a second loss and a lip synchronization loss based on the predicted lip synchronization video.
[0117] In some embodiments of the present application, in order to ensure lip synchronization with higher quality, after obtaining the predicted lip synchronization video, a pre-trained discriminator can be introduced as a discriminator for lip synchronization, and the synchronization loss corresponding to the predicted lip synchronization video can be calculated based on the discriminator.
[0118] In addition, at this stage, the loss corresponding to the mouth ControlNet model, the loss corresponding to the face reference model, and the loss corresponding to the predicted lip synchronization video output by the diffusion model are determined, and the losses of the three models are further combined to obtain the second loss L d :
[0119]
[0120] In the above formula (5), μ θ ,τ θ ,∈ θ is the trainable model part, ∈ θ represents the diffusion model, μ θ represents the face reference model, τ θ Represents the ControlNet model of the mouth.
[0121] S2044. Train the diffusion model based on the first loss, the pixel-level loss, the perceptual loss, the second loss, and the lip synchronization loss to obtain a trained lip synchronization model.
[0122] In some embodiments of the present application, the diffusion model is trained in stages through a first loss, a pixel-level loss, a perceptual loss, a second loss, and a lip synchronization loss to obtain a trained lip synchronization model.
[0123] It can be understood that in some embodiments of the present application, the diffusion model is trained in stages to obtain predicted lip-sync video and predicted lip-sync image, and multiple losses including multiple first losses, pixel-level losses, perceptual losses and lip-sync losses are determined according to the predicted lip-sync video and the predicted lip-sync image, respectively. The diffusion model is trained in stages through multiple losses to obtain a lip-sync model, thereby improving the training effect of the lip-sync model.
[0124] In some embodiments of the present application, the diffusion model is trained in stages based on the first loss, pixel-level loss, perceptual loss, second loss and lip synchronization loss in the above S2044, and the trained lip synchronization model can be implemented through the following S2044A to S2044C, which is explained in the following steps.
[0125] S2044A, training the diffusion model in a first training phase based on the first loss, the pixel-level loss, and the perceptual loss until the training conditions are met, thereby obtaining the diffusion model after the first training phase.
[0126] In some embodiments of the present application, during the first stage of training, the diffusion model does not include a temporal attention layer. The diffusion model that does not include a temporal attention layer is trained in the first training stage by summing the first loss, the pixel-level loss, and the perceptual loss, and using the summed loss until the training conditions are met, thereby obtaining a lip synchronization model after the first training stage.
[0127] In addition, the mouth ControlNet model and the face reference model can be trained in the first stage simultaneously through the first loss, pixel-level loss and perceptual loss. At this time, the mouth ControlNet model does not include the temporal attention layer.
[0128] Exemplarily, the first loss, the pixel-level loss, and the perceptual loss are summed, and the summed loss is as follows.
[0129] L=L d +λ 1 L 1 +λ 2 L perceptual (6)
[0130] In the above formula (6), λ is mainly related to regularization and is an important hyperparameter for controlling the strength of regularization.
[0131] S2044B. Determine the lip synchronization probability according to the predicted lip synchronization video.
[0132] In some embodiments of the present application, a pre-trained discriminator may be introduced to extract video and speech features of the predicted lip synchronization video, and then the lip synchronization probability may be calculated based on the extracted video and speech features.
[0133] For example, the synchronization loss of 5 consecutive frames can be calculated by the pre-trained discriminator:
[0134]
[0135] In the above formula (7), P syncrepresents the synchronization probability of the input speech-video pair, v and a represent the video and speech features extracted by the pre-trained discriminator, respectively.
[0136] S2044C. Determine the lip synchronization loss according to the lip synchronization probability, and perform a second training phase on the diffusion model after the first training phase based on the second loss, pixel loss and lip synchronization loss until the training conditions are met to obtain a lip synchronization model; the second training phase is no earlier than the first training phase.
[0137] In some embodiments of the present application, during the second stage of training, the diffusion model includes a temporal attention layer, and after the first stage of training, the lip synchronization loss is determined based on the lip synchronization probability, the second loss, the pixel loss and the lip synchronization loss are summed, and the diffusion model after the first training stage is trained in the second training stage using the summed loss until the training conditions are met to obtain a lip synchronization model.
[0138] Exemplarily, the synchronization loss is as follows:
[0139]
[0140] In the above formula (8), L sync is the synchronization loss and N is the number of frames.
[0141] Exemplarily, the second loss, the pixel loss, and the lip synchronization loss are summed, and the summed loss is shown below.
[0142] L=L d +λ 1 L 1 +λ 2 L perceptual +λ 3 L sync (9)
[0143] In addition, the second stage training can be performed on the mouth ControlNet model and the face reference model trained in the first stage at the same time by summing the second loss, the pixel-level loss and the lip synchronization loss.
[0144] It can be understood that in some embodiments of the present application, the diffusion model is trained in stages. In the first stage, the diffusion model does not include a temporal attention layer, and a single mouth feature video frame is trained, so that a predicted lip synchronization image is generated based on a preset face video frame and a single mouth feature video frame randomly selected from the same video. In the second stage, the diffusion model includes a temporal attention layer, so that a predicted lip synchronization video is generated based on a preset face video frame and a mouth feature video frame randomly selected from the same video. By training the diffusion model in stages, a lip synchronization model is obtained, which improves the training effect of the lip synchronization model and ensures that the lip sounds in the digital human speaking video are more synchronized.
[0145] Reference Fig. 9 , shows a schematic diagram of the structure of an electronic device according to an embodiment of the present application. The specific embodiment of the present application does not limit the specific implementation of the electronic device.
[0146] like Fig. 9 As shown, the electronic device may include: a processor (processor) 502 , a communication interface (Communications Interface) 504 , a memory (memory) 506 , and a communication bus 508 .
[0147] in:
[0148] The processor 502 , the communication interface 504 , and the memory 506 communicate with each other via a communication bus 508 .
[0149] The communication interface 504 is used to communicate with other electronic devices or servers.
[0150] The processor 502 is used to execute the program 510, and specifically can execute the relevant steps in the above method embodiment.
[0151] Specifically, the program 510 may include program codes, which include computer operation instructions.
[0152] The processor 502 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0153] The memory 506 is used to store the program 510. The memory 506 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0154] The program 510 may be specifically used to enable the processor 502 to execute operations corresponding to the methods described in the above method embodiments.
[0155] The specific implementation of each step in program 510 can refer to the corresponding description of the corresponding steps and units in the above method embodiment, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the above method embodiment, which will not be repeated here.
[0156] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.
[0157] The above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or implemented as software or computer code that can be stored in a recording medium (such as a CD ROM, RAM, floppy disk, hard disk or magneto-optical disk), or implemented as a computer code originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded through a network and to be stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a special-purpose processor or programmable or special-purpose hardware (such as an ASIC or FPGA). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, a processor or hardware, the method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the method shown here, the execution of the code converts the general-purpose computer into a special-purpose computer for executing the method shown here.
[0158] In addition, it should be noted that the user-related information (including but not limited to user device information, user personal information, user images, etc.) and data (including but not limited to sample data used to train the model, data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0159] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.
[0160] The above implementation methods are only used to illustrate the embodiments of the present application, and are not limitations on the embodiments of the present application. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present application. The scope of patent protection of the embodiments of the present application should be limited by the claims.
Claims
1. A lip synchronization processing method, characterized in that: include: Perform mask processing on the input face data to obtain a face mask video frame; Extract speech features from the input audio data to obtain mouth feature video frames; Generate sampling feature maps at various levels of the mouth feature video frame; At least the face mask video frame is input into the main input side of the pre-trained diffusion model, and the sampling feature maps of each level of the mouth feature video frame are input into the first condition input side of the pre-trained diffusion model to obtain the lip synchronization video.
2. The method according to claim 1, characterized in that The method further comprises: Performing image preprocessing on the input face data to obtain a face reference feature map; The step of inputting at least the face mask video frame into the main input side of the pre-trained diffusion model, and inputting the sampling feature maps of each level of the mouth feature video frame into the first condition input side of the pre-trained diffusion model to obtain the lip synchronization video comprises: The face mask video frame is input into the main input side of the pre-trained diffusion model, the sampling feature maps of each level of the mouth feature video frame are input into the first conditional input side of the pre-trained diffusion model, and the face reference feature map is input into the second conditional input side of the pre-trained diffusion model to obtain the lip synchronization video.
3. The method according to claim 2, characterized in that The pre-trained diffusion model includes a first variational autoencoder; the image pre-processing of the input face data to obtain a face reference feature map includes: Acquire preset face data from the input face data; and input the preset face data into a pre-trained face reference model to obtain the face reference feature map; The step of inputting the face mask video frame into the main input side of the pre-trained diffusion model, inputting the sampling feature maps of each level of the mouth feature video frame into the first conditional input side of the pre-trained diffusion model, and inputting the face reference feature map into the second conditional input side of the pre-trained diffusion model to obtain the lip-sync video comprises: Inputting the face mask video frame into the encoder in the first variational autoencoder to obtain a first latent space feature map corresponding to the main input side; The lip-sync video is determined based on the first latent space feature map, the sampling feature maps at each level, and the face reference feature map.
4. The method according to claim 3, characterized in that The face reference model includes a second variational autoencoder, a second spatial attention layer, and a second cross attention layer; the pre-trained diffusion model also includes a first spatial attention layer; The step of inputting the preset face data into a pre-trained face reference model to obtain the face reference feature map comprises: Inputting the preset face data into the encoder in the second variational autoencoder to obtain a second latent space feature map; Inputting the second latent space feature map into the second spatial attention layer for copying to obtain a copied second latent space feature map, and splicing the copied second latent space feature map and the first latent space feature map through the second spatial attention layer to obtain a spliced third feature map; Inputting the third feature map into the first spatial attention layer to obtain a fourth feature map; The fourth feature map is input into the second cross-attention layer to obtain the face reference feature map.
5. The method according to claim 4, characterized in that The pre-trained diffusion model further includes a temporal attention layer; the face mask video frame is input into the main input side of the pre-trained diffusion model, the sampling feature maps of each level of the mouth feature video frame are input into the first conditional input side of the pre-trained diffusion model, and the face reference feature map is input into the second conditional input side of the pre-trained diffusion model to obtain the lip synchronization video, including: Inputting the concatenated third feature map into the first spatial attention layer to obtain a fifth feature map; Downsampling the fifth feature map to obtain a sixth feature map; and inputting the sixth feature map into the first cross attention layer to obtain a seventh feature map; Adjusting the dimension of the seventh feature map based on the frame length of the face mask video frame to obtain a feature sequence of a preset dimension; The lip-sync video is determined based on the feature sequence of the preset dimension, the temporal attention layer, the sampling feature maps at each level and the face reference feature map.
6. A model training method, characterized in that: include: Acquire a lip-sync video sample, wherein the lip-sync video sample includes a face video frame sample and an audio sample with time sequence matching; Performing mask processing on the face video frame sample to obtain a face mask video frame; Extracting speech features from the audio sample to obtain a mouth feature video frame; At least the face mask video frame is used as the main input, and the mouth feature video frame is used as the conditional input to train the diffusion model to obtain a lip synchronization model.
7. The method according to claim 6, characterized in that The step of taking at least the face mask video frame as the main input and the mouth feature video frame as the conditional input, training the diffusion model, and obtaining the lip synchronization model comprises: Determine a predicted lip sync image corresponding to the face based on a single mouth feature video frame in the mouth feature video frame, a preset face video frame in the face video frame, and the face mask video frame; and determine a first loss, a pixel-level loss, and a perceptual loss based on the predicted lip sync image; Determine a predicted lip sync video corresponding to the face based on the preset face video frame, the mouth feature video frame and the face mask video frame; determining a second loss and a lip sync loss based on the predicted lip sync video; The diffusion model is trained in stages based on the first loss, the pixel-level loss, the perceptual loss, the second loss and the lip synchronization loss to obtain a trained lip synchronization model.
8. The method according to claim 7, characterized in that The step of training the diffusion model in stages based on the first loss, the pixel-level loss, the perceptual loss, the second loss, and the lip synchronization loss to obtain a trained lip synchronization model includes: Performing a first training phase of training on the diffusion model based on the first loss, the pixel-level loss, and the perceptual loss until a training condition is met, thereby obtaining a diffusion model after the first training phase; determining a lip sync probability based on the predicted lip sync video; The lip synchronization loss is determined according to the lip synchronization probability, and the diffusion model after the first training stage is trained in a second training stage based on the second loss, the pixel loss and the lip synchronization loss until the training conditions are met to obtain the lip synchronization model; the second training stage is no earlier than the first training stage.
9. An electronic device, comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform an operation corresponding to the method as described in any one of claims 1-8.
10. A computer storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the method according to any one of claims 1 to 18 is implemented.
Citation Information
Cited By
Real-time generation method and device of digital figure
CN119206005A
A real-time generation method and device for digital characters
CN119206005B
Speaking digital human generation method based on large model learnable text latent codes
CN119516054A
A method for generating a talking digital human based on a large model learnable text latent code
CN119516054B
Content generation method, training method of content generation model and corresponding device
CN120434485A
