Digital face video generation method based on audio driving

By optimizing the training process of the Wav2Lip model, using Mel spectrum and MFCC to fuse feature extraction and generator and discriminator networks, the problem of low high-resolution video generation quality and poor Chinese speech inference effect is solved, and high-quality digital Face video generation and audio and video synchronization effects.

CN118864665APending Publication Date: 2024-10-29GUILIN UNIV OF ELECTRONIC TECH
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410852086.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-10-29

AI Technical Summary

Technical Problem

The digital face video generated by the existing Wav2Lip model when inputting high-resolution video is of low quality, especially the lower part of the face and the teeth, and has poor performance in Chinese speech inference.

Method used

By optimizing the training process of the Wav2Lip model, using the audio feature extraction method fused with Mel spectrum and MFCC, combined with the generator and discriminator network, iterative training is performed to improve the quality of video generation and audio and video synchronization, especially for Chinese data sets. Training to improve model applicability.

Benefits of technology

The quality of the generated video is significantly improved, the labial synchrony and naturalness are improved, especially when processing complex sentences and multi-syllabic vocabulary, it shows higher accuracy, improving the user experience and the practicality of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118864665A_ABST
    Figure CN118864665A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of computer vision and voice processing, and relates to a Wav2Lip model, an adversarial generative network and other model architectures, in particular to a digital face video generation method based on audio driving, which comprises the process of optimizing the Wav2Lip model and generating a video by using the optimized Wav2Lip model, and is characterized in that the process of optimizing the Wav2Lip model obtains a weight file after model optimization, and the weight file is used for generating the video by using the optimized Wav2Lip model. According to the method, audio features are extracted in a Mel spectrum and MFCC fusion mode, generated video frames are not changed, then a GAN network is used for learning the mapping relation between audio-image pairs, a generator network in a Wav2Lip model is responsible for generating vivid lip actions, an obtained weight file is stored as a final training result, and the training result is used for training the lips. And taking the result as a final result after the Wav2Lip model is optimized. The video finally generated by the method not only has higher visual quality, but also improves the user experience, so that the model has higher practicability and wide applicability in practical application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer vision and speech processing, and relates to model architectures such as Wav2Lip model and adversarial generative network, and specifically refers to a method for generating digital face videos based on audio drive. Background Art

[0002] Digital face generation technology has a wide range of application scenarios in daily life, such as movie dubbing, game production, virtual anchors, distance education, etc. Audio-driven digital face video only needs a new audio clip to render a new video, which can save a lot of manpower and material resources. Therefore, audio-driven digital human video generation is a task with practical application value. At present, the Wav2Lip model performs well in lip synchronization generation. It uses a deep learning architecture to combine facial features extracted from video frames with audio features of corresponding speech signals, and generates lip movements that match the audio content through a generative adversarial network (GAN). In order to solve the problem of lip shape and audio synchronization in the video, the Wav2Lip model also designs a lip synchronization discriminator. The discriminator uses two parallel convolutional networks to extract the input audio and lip images as feature vectors respectively, and then calculates the cosine distance between the two feature vectors to judge the correspondence between the audio and lip shape. In addition, a visual quality discriminator is also used to improve visual quality and synchronization accuracy.

[0003] However, the current Wav2Lip model still has some shortcomings. First, the model cannot generate high-quality digital face videos. When the input video resolution is small, the final inference video effect is acceptable, but when the input video resolution is high, the final inference result is still blurry, especially in the lower half of the face, where the teeth are poorly restored. Second, because the training data set is composed of thousands of spoken sentences from the BBC in the UK, the effect is not very good when using Chinese inference. Summary of the invention

[0004] The purpose of the present invention is to provide a high-quality audio-driven digital face video generation method.

[0005] The technical solution for achieving the above-mentioned purpose includes the following contents.

[0006] A method for generating digital face videos based on audio drive includes optimizing a Wav2Lip model process and generating a video using the optimized Wav2Lip model. The Wav2Lip model optimization process includes the following steps:

[0007] Step 1) establishing a video data set, dividing the video data containing both speech and facial animation into a training set, a test set, and a validation set;

[0008] Step 2) pre-process all video data and cut each video into pictures and corresponding audio;

[0009] Step 3) Use the Wav2Lip model architecture to perform iterative training to obtain the weight file after model optimization. Use the Mel spectrum and MFCC fusion method to extract audio features from the audio generated in step 2). The generated video frame remains unchanged. Then use the GAN network to learn the mapping relationship between audio and image pairs. The generator network in the Wav2Lip model is responsible for generating realistic lip movements. The discriminator network in the Wav2Lip model is responsible for evaluating the consistency and authenticity of the generated lip movements. The training set data is mainly used to adjust the weights of the model. After each training cycle, the validation set is used to evaluate the performance of the model. When the model performs stably on the validation set, the test set is used to evaluate the performance of the model on new data. During the training process, the generator gradually learns to generate lip movements that better match the audio information, while the discriminator continuously improves its ability to identify the difference between the generated content and the real content. As the training deepens, the video quality and audio and video synchronization generated by the generator continue to improve, making it increasingly difficult for the discriminator to distinguish the difference between the real video and the generated video. After repeated iterative training, the video effect is getting better and better. When the synchronization loss value is observed to be continuously lower than the threshold, it can be considered that the quality of the generated video has reached the effect of lip synchronization. At this time, the obtained weight file is saved as the final training result as the final result after the Wav2Lip model optimization.

[0010] Furthermore, in step 3), when extracting audio features, the Mel spectrum of the audio is first calculated, then converted to a logarithmic scale and MFCC is calculated. To ensure the consistency of the two features in the time dimension, they are truncated according to the shorter time length, and finally the truncated Mel spectrum and MFCC are spliced ​​along the feature axis to obtain a comprehensive feature vector.

[0011] Furthermore, the ratio of the number of videos contained in the training set, the test set and the validation set is 8:1:1.

[0012] Furthermore, the synchronization loss value threshold is 0.2.

[0013] Furthermore, the speech is Mandarin Chinese, so that the optimized Wav2Lip model can generate high-quality Mandarin Chinese videos.

[0014] Furthermore, in step 2), a face detection algorithm is used to identify the face in the video frame, and then the video frame is cropped to retain only the lower half of the face as the important area.

[0015] By combining Mel spectrum and MFCC as a way to extract audio features, the model's ability to process speech and generate lip shape synchronization is enhanced. This method of fusion feature extraction can more accurately capture subtle changes in the audio and effectively map these changes to the lip shape movements in the video, so that the generated video lip shape is highly synchronized with the input audio. In addition, this method also improves the naturalness and fluency of lip synchronization, especially when processing complex sentences and multi-syllabic words. Through this high-level feature fusion, the final generated video not only has higher visual quality, but also improves the user experience, making the model more practical and widely applicable in practical applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 A schematic diagram of the flow of a method for generating digital face video based on audio drive according to an embodiment of the present invention;

[0017] Figure 2 Schematic diagram of the Wav2Lip model architecture of the audio-driven digital face video generation method of the embodiment. DETAILED DESCRIPTION

[0018] The present invention is specifically described below with reference to the embodiments.

[0019] See also Figure 1 and Figure 2 The method for generating digital face video based on audio driving in the embodiment includes four steps:

[0020] Step 1) Collect Chinese video data and divide the Chinese video data into a training set, a test set, and a validation set according to a ratio of 8:1:1;

[0021] Step 2) Preprocess the data set and cut each video into pictures and corresponding audio;

[0022] Step 3) Use the Wav2Lip model architecture to perform iterative training to obtain an optimized weight file;

[0023] Step 4) Model inference phase: The weight file generated in step 3) is used as the optimal result for inference, and the target face and audio are input to generate a lip-synced face video.

[0024] Specifically, step 1) since the original data set of the Wav2Lip model is trained on real English face videos, when applied to Chinese face videos, the lip sound correspondence effect is not good, so the present invention will re-make the Chinese data set. A part comes from the introduction video of Guilin tourist attractions. The downloaded video is cut using the editing software PR, each video is cut to within 5s, the video frame rate is adjusted to 25fps, and then the audio sampling rate is adjusted to 16000Hz using ffmpeg to meet the needs of model training. At the same time, since the purpose of this model is to meet the processing of generating any face video, as many videos of different faces as possible are needed during training to increase the diversity of training data, so the data set of the CMLR news anchor is also collected. Since the video and audio are separated in the data set, ffmpeg is used to merge the video and audio. Finally, all data sets are named by date. In order to prevent the situation where the video named by the repeated date is replaced, the python standard library batch rename folder technology is used to randomly generate non-repeating five-digit numbers and add them after the date. Among them, the short video after the original video cutting in each folder is also named as a 5-digit video ID ending with .mp4. Finally, the processed dataset paths are placed in the train.txt, test.txt, and val.txt folders in an 8:1:1 ratio.

[0025] Step 2) Preprocess the videos in the dataset. Use a facial detection algorithm to identify faces in the video frames, then crop the video frames to keep only the important areas of the face, especially the lower half of the face. Next, process the audio signal, select the audio segment corresponding to each video segment, and crop it into an audio signal that matches the length of the video frame. The resolution of the cut image is 96*96, and the portrait is in the middle of the image. After preprocessing, multiple video frames and corresponding audio after the short video is cut in step 1) are obtained in each folder, and these data are directly input into the neural network in step 3) for training.

[0026] Step 3) Train the model. Figure 2 , mainly showing the schematic diagram of the Wav2Lip model architecture, including a generator and two discriminators. The specific steps are:

[0027] 3.1) The generator combines the input video frames and the corresponding audio to generate lip videos synchronized with the audio. It is a 2D-CNN encoder-decoder network structure that contains three modules composed of convolutional networks: identity encoder, speech encoder, and face decoder.

[0028] The improved Wav2Lip model uses the fusion of Mel spectrum and MFCC to extract audio features, which enhances the model's ability to process audio signals. Mel spectrum first obtains spectrum data by performing a short-time Fourier transform on the audio signal, and then uses a Mel filter to map the obtained spectrum data to the Mel scale. Through this mapping, the Mel spectrum can effectively capture frequency features, but it has certain limitations in describing the cepstrum features of audio, so the Mel frequency cepstrum coefficient, or MFCC, is introduced. The calculation process of MFCC starts with the Mel spectrum. First, a logarithmic transform is applied to each value of the Mel spectrum, and then these logarithmically transformed data are subjected to a discrete cosine transform. Through the discrete cosine transform, MFCC extracts the main cepstrum peaks from the Mel spectrum.

[0029] In practice, the Mel spectrum of the audio is first calculated, then converted to a logarithmic scale and MFCC is calculated. This method not only captures the frequency information of the audio signal, but also analyzes its cepstrum characteristics. In order to ensure the consistency of the two features in the time dimension, they are truncated according to the shorter time length. Finally, the truncated Mel spectrum and MFCC are spliced ​​along the feature axis to obtain a comprehensive feature vector. This feature fusion method significantly improves the efficiency and accuracy of the Wav2Lip model, enabling it to more accurately synchronize lip movements and audio information in the video.

[0030] The fused spectrogram of the audio features, the random reference frame, and the corresponding real frame are concatenated and the input is reduced through a convolutional layer to form feature vectors of the audio and video frames. These feature vectors are projected onto fragments of the reconstructed frame through a series of transposed convolutional layers. There is a residual skip connection between the identity encoder and the face decoder. The training goal of the generator is to minimize the generated frame L g With the real frame L G The L1 reconstruction loss between them is used to improve the quality of the generated frames. The reconstruction objective function is as follows: the generator generates each frame independently and sends the continuous sequence of generated frames to the discriminator.

[0031]

[0032] Among them, L1 reconstruction loss is a loss function used to evaluate the pixel-level difference between the generated video frames and the real video frames.

[0033] 3.2) Wav2Lip uses two types of discriminators: lip sync discriminator and visual quality discriminator. The lip sync discriminator mainly detects the synchronization accuracy between the generated video frames and the input audio, and the visual quality discriminator ensures that the generated video frames look more natural and realistic visually.

[0034] 3.2.1) The lip synchronization discriminator needs to be pre-trained in advance, taking the audio signal and the generated frame as input to detect whether the generated frame is synchronized with the audio signal. This discriminator is improved from the SyncNet model, which is a deep learning model used to detect audio and video synchronization, and is used to ensure whether the voice and character lip movements in the video are synchronized. The lip synchronization discriminator has been improved in three main aspects: first, color images are used instead of the previous grayscale images to provide rich visual information; second, residual connections are used to increase the depth of the model; third, cosine similarity and binary cross entropy loss functions are used to optimize the synchronization detection performance of the model. The generator improves the lip synchronization quality of the generated frames by minimizing the synchronization loss from the lip synchronization discriminator. The synchronization loss function E sync Combining cosine similarity and binary cross entropy loss:

[0035]

[0036] The first formula is used to calculate the synchronization probability P between video and speech embeddings sync , which is mainly achieved by calculating the cosine similarity between the video embedding v and the speech embedding s. ∈ refers to a very small constant to avoid the denominator being zero. The second formula is the synchronization loss function, based on the synchronization probability P sync The calculation is performed and the losses of all samples are added up and divided by the total number of samples N to get the average synchronization loss for the entire batch.

[0037] During the training of the generator, the weights of the lip sync discriminator remain frozen because the lip sync discriminator is trained on lip data from real videos.

[0038] 3.2.2) Since the lip sync discriminator is mainly the degree of correspondence between the lip shape and its surroundings and the audio signal, in order to improve the quality of the generated image, the wav2lip model uses an additional visual quality discriminator D, which only targets the quality of the generated face and does not make any changes to the lip sync. The image frames generated by the generator and the real video frames in the training data are used as input to judge their authenticity and drive the naturalness of the generated video. It consists of a series of convolutional blocks, each of which includes a convolutional layer, an instance normalization layer and a Leaky ReLU activation. The latter two are crucial for stable training. The training goal is to maximize the objective function L disc :

[0039]

[0040] Among them, L gen L is the loss function of the generator, and its goal is to minimize the probability that the visual quality discriminator D judges the generated video frame x as a real video frame.disc is the loss function of the visual quality discriminator, which aims to maximize the ability to correctly identify real video frames and generated video frames. g refers to the generated video frames from the generator, L G Refers to the real video frame.

[0041] 3.3) The final optimization goal of the generator is to minimize the weighted sum of reconstruction loss, synchronization loss and adversarial loss:

[0042] L total =(1-s w -s g )·L recon +s w ·E sync +s g ·L gen

[0043] Among them, s w is the synchronization penalty weight, s g are the adversarial loss weights, which are empirically set to 0.03 and 0.07 in all experiments. The reconstruction loss measures the difference between the generator's generated frames and the original image frames, and the synchronization loss measures the difference between the generated frames and the target lip shape. The adversarial loss measures the adversarial performance of the generated frames against the discriminator in adversarial training. By minimizing the weighted sum of these loss functions, the generator can generate high-quality face images with lip sync.

[0044] During the training process, the training set data is mainly used to adjust the weights of the model. The generator and the discriminator are trained alternately. The generator is responsible for generating lip movements synchronized with the audio information, while the discriminator is responsible for evaluating the synchronization difference between the real video frame and the generated video frame. After each training cycle, the validation set is used to evaluate the performance of the model. By observing the sync loss and L1 loss, it is determined whether an early stopping strategy needs to be implemented to avoid overfitting, which helps to improve the generalization ability of the model. When the model performs stably on the validation set, the test set is used to evaluate the performance of the model on new data to ensure its effectiveness in practical applications. Through this iterative training, the generator gradually learns to produce lip movements that better match the audio information, while the discriminator continuously improves its ability to identify the difference between the generated content and the real content. As the training continues to deepen, the quality and synchronization of the videos generated by the generator continue to improve, making it increasingly difficult for the discriminator to distinguish between the real video and the generated video, and the resulting video effect is getting better and better. During training, the synchronization loss value sync is observed. When the loss value is continuously lower than 0.2, the training is terminated and the weight file obtained at this time is used as the final training result.

[0045] Step 4) performs model inference, and uses the weight file obtained from the final training in step 3) as the optimal result for inference. An image or video and an audio file introducing Guilin attractions are arbitrarily input, and the weight file is used for inference. Finally, an audio and video synchronized video is output, in which the lip movements and audio content completely correspond, demonstrating the model's good synchronization ability.

Claims

1. A method for generating digital face videos based on audio drive, comprising optimizing a Wav2Lip model process and generating videos with the optimized Wav2Lip model, characterized in that: The Wav2Lip model optimization process includes the following steps: Step 1) Establish a video dataset and divide the video data containing both speech and facial animation into a training set, a test set, and a validation set; Step 2) Preprocess all video data and cut each video into pictures and corresponding audio; Step 3) Use the Wav2Lip model architecture to perform iterative training to obtain the weight file after model optimization. Use the Mel spectrum and MFCC fusion method to extract audio features from the audio generated in step 2). The generated video frame remains unchanged. Then use the GAN network to learn the mapping relationship between audio and image pairs. The generator network in the Wav2Lip model is responsible for generating realistic lip movements. The discriminator network in the Wav2Lip model is responsible for evaluating the consistency and authenticity of the generated lip movements. The training set data is mainly used to adjust the weights of the model. After each training cycle, the validation set is used to evaluate the performance of the model. When the model performs stably on the validation set, the test set is used to evaluate the performance of the model on new data. During the training process, the generator gradually learns to generate lip movements that better match the audio information, while the discriminator continuously improves its ability to identify the difference between the generated content and the real content. As the training deepens, the quality of the video generated by the generator and the synchronization of audio and video continue to improve, making it increasingly difficult for the discriminator to distinguish the difference between the real video and the generated video. After repeated iterative training, the video effect is getting better and better. When the synchronization loss value is observed to be continuously lower than the threshold, it can be considered that the quality of the generated video has reached the effect of lip synchronization. At this time, the obtained weight file is saved as the final training result as the final result after the Wav2Lip model optimization.

2. The method for generating digital face video based on audio drive according to claim 1, characterized in that: In the step 3), when extracting audio features, the Mel spectrum of the audio is first calculated, then converted to a logarithmic scale and MFCC is calculated. To ensure the consistency of the two features in the time dimension, they are truncated according to the shorter time length. Finally, the truncated Mel spectrum and MFCC are spliced ​​along the feature axis to obtain a comprehensive feature vector.

3. The method for generating digital face video based on audio drive according to claim 1, characterized in that: The ratio of the number of videos contained in the training set, test set and validation set is 8:1:

1.

4. The method for generating digital face video based on audio drive according to claim 1, characterized in that: The synchronization loss value threshold is 0.

2.

5. The method for generating digital face video based on audio drive according to claim 1, characterized in that: The speech is in Mandarin Chinese.

6. The method for generating digital face video based on audio drive according to claim 1, characterized in that: In step 2), a face detection algorithm is used to identify the face in the video frame, and then the video frame is cropped to retain only the lower half of the face.

Citation Information

Cited By

  • Stylized digital human video generation method, electronic equipment and storage medium

    CN119211659A

  • Picture digital human generation method based on deep learning

    CN120070683A