MarkoVidrih commited on
Commit
eb9bb9b
1 Parent(s): ec6c9e8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +102 -0
README.md CHANGED
@@ -1,3 +1,105 @@
1
  ---
2
  license: wtfpl
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: wtfpl
3
  ---
4
+
5
+ # Wav2Lip-HD: Improving Wav2Lip to achieve High-Fidelity Videos
6
+
7
+ This repository contains code for achieving high-fidelity lip-syncing in videos, using the [Wav2Lip algorithm](https://github.com/Rudrabha/Wav2Lip) for lip-syncing and the [Real-ESRGAN algorithm](https://github.com/xinntao/Real-ESRGAN) for super-resolution. The combination of these two algorithms allows for the creation of lip-synced videos that are both highly accurate and visually stunning.
8
+
9
+ ## Algorithm
10
+
11
+ The algorithm for achieving high-fidelity lip-syncing with Wav2Lip and Real-ESRGAN can be summarized as follows:
12
+
13
+ 1. The input video and audio are given to `Wav2Lip` algorithm.
14
+ 2. Python script is written to extract frames from the video generated by wav2lip.
15
+ 3. Frames are provided to Real-ESRGAN algorithm to improve quality.
16
+ 4. Then, the high-quality frames are converted to video using ffmpeg, along with the original audio.
17
+ 5. The result is a high-quality lip-syncing video.
18
+ 6. The specific steps for running this algorithm are described in the [Testing Model](https://github.com/saifhassan/Wav2Lip-HD#testing-model) section of this README.
19
+
20
+ ## Testing Model
21
+
22
+ To test the "Wav2Lip-HD" model, follow these steps:
23
+
24
+ 1. Clone this repository and install requirements using following command (Make sure, Python and CUDA are already installed):
25
+
26
+ ```
27
+ git clone https://github.com/saifhassan/Wav2Lip-HD.git
28
+ cd Wav2Lip-HD
29
+ pip install -r requirements.txt
30
+ ```
31
+
32
+ 2. Downloading weights
33
+
34
+ | Model | Directory | Download Link |
35
+ | :------------- |:-------------| :-----:|
36
+ | Wav2Lip | [checkpoints/](https://github.com/saifhassan/Wav2Lip-HD/tree/main/checkpoints) | [Link](https://drive.google.com/drive/folders/1tB_uz-TYMePRMZzrDMdShWUZZ0JK3SIZ?usp=sharing) |
37
+ | ESRGAN | [experiments/001_ESRGAN_x4_f64b23_custom16k_500k_B16G1_wandb/models/](https://github.com/saifhassan/Wav2Lip-HD/tree/main/experiments/001_ESRGAN_x4_f64b23_custom16k_500k_B16G1_wandb/models) | [Link](https://drive.google.com/file/d/1Al8lEpnx2K-kDX7zL2DBcAuDnSKXACPb/view?usp=sharing) |
38
+ | Face_Detection | [face_detection/detection/sfd/](https://github.com/saifhassan/Wav2Lip-HD/tree/main/face_detection/detection/sfd) | [Link](https://drive.google.com/file/d/1uNLYCPFFmO-og3WSHyFytJQLLYOwH5uY/view?usp=sharing) |
39
+ | Real-ESRGAN | Real-ESRGAN/gfpgan/weights/ | [Link](https://drive.google.com/drive/folders/1BLx6aMpHgFt41fJ27_cRmT8bt53kVAYG?usp=sharing) |
40
+ | Real-ESRGAN | Real-ESRGAN/weights/ | [Link](https://drive.google.com/file/d/1qNIf8cJl_dQo3ivelPJVWFkApyEAGnLi/view?usp=sharing) |
41
+
42
+
43
+ 3. Put input video to `input_videos` directory and input audio to `input_audios` directory.
44
+ 4. Open `run_final.sh` file and modify following parameters:
45
+
46
+ `filename=kennedy` (just video file name without extension)
47
+
48
+ `input_audio=input_audios/ai.wav` (audio filename with extension)
49
+
50
+ 5. Execute `run_final.sh` using following command:
51
+
52
+ ```
53
+ bash run_final.sh
54
+ ```
55
+
56
+ 6. Outputs
57
+
58
+ - `output_videos_wav2lip` directory contains video output generated by wav2lip algorithm.
59
+ - `frames_wav2lip` directory contains frames extracted from video (generated by wav2lip algorithm).
60
+ - `frames_hd` directory contains frames after performing super-resolution using Real-ESRGAN algorithm.
61
+ - `output_videos_hd` directory contains final high quality video output generated by Wav2Lip-HD.
62
+
63
+
64
+ ## Results
65
+ The results produced by Wav2Lip-HD are in two forms, one is frames and other is videos. Both are shared below:
66
+
67
+ ### Example output frames </summary>
68
+ <table>
69
+ <tr>
70
+ <td>Frame by Wav2Lip</td>
71
+ <td>Optimized Frame</td>
72
+ </tr>
73
+ <tr>
74
+ <td><img src="examples/1_low.jpg" width=500></td>
75
+ <td><img src="examples/1_hd.jpg" width=500></td>
76
+ </tr>
77
+ <tr>
78
+ <td><img src="examples/kennedy_low.jpg" width=500></td>
79
+ <td><img src="examples/kennedy_hd.jpg" width=500></td>
80
+ </tr>
81
+
82
+ </tr>
83
+ <tr>
84
+ <td><img src="examples/mona_low.jpg" width=500></td>
85
+ <td><img src="examples/mona_hd.jpg" width=500></td>
86
+ </tr>
87
+ </table>
88
+ </Details>
89
+
90
+ ### Example output videos
91
+
92
+ | Video by Wav2Lip | Optimized Video |
93
+ | ------------- | ------------- |
94
+ | <video src="https://user-images.githubusercontent.com/11873763/229389410-56d96244-8c67-4add-a43e-a4900aa9db88.mp4" width="500"> | <video src="https://user-images.githubusercontent.com/11873763/229389414-d5cb6d33-7772-47a7-b829-9e3d5c3945a1.mp4" width="500">|
95
+ | <video src="https://user-images.githubusercontent.com/11873763/229389751-507669f1-7772-4863-ab23-8df7f206a065.mp4" width="500"> | <video src="https://user-images.githubusercontent.com/11873763/229389962-5373b765-ce3a-4af2-bd6a-8be8543ee933.mp4" width="500">|
96
+
97
+ ## Acknowledgements
98
+
99
+ We would like to thank the following repositories and libraries for their contributions to our work:
100
+
101
+ 1. The [Wav2Lip](https://github.com/Rudrabha/Wav2Lip) repository, which is the core model of our algorithm that performs lip-sync.
102
+ 2. The [face-parsing.PyTorch](https://github.com/zllrunning/face-parsing.PyTorch) repository, which provides us with a model for face segmentation.
103
+ 3. The [Real-ESRGAN](https://github.com/xinntao/Real-ESRGAN) repository, which provides the super resolution component for our algorithm.
104
+ 4. [ffmpeg](https://ffmpeg.org), which we use for converting frames to video.
105
+