czk32611 commited on
Commit
71f5cd5
1 Parent(s): cdee5b8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +13 -288
README.md CHANGED
@@ -1,288 +1,13 @@
1
- # MuseTalk
2
-
3
- MuseTalk: Real-Time High Quality Lip Synchronization with Latent Space Inpainting
4
- </br>
5
- Yue Zhang <sup>\*</sup>,
6
- Minhao Liu<sup>\*</sup>,
7
- Zhaokang Chen,
8
- Bin Wu<sup>†</sup>,
9
- Yingjie He,
10
- Chao Zhan,
11
- Wenjiang Zhou
12
- (<sup>*</sup>Equal Contribution, <sup>†</sup>Corresponding Author, benbinwu@tencent.com)
13
-
14
- **[github](https://github.com/TMElyralab/MuseTalk)** **[huggingface](https://huggingface.co/TMElyralab/MuseTalk)** **Project (comming soon)** **Technical report (comming soon)**
15
-
16
- We introduce `MuseTalk`, a **real-time high quality** lip-syncing model (30fps+ on an NVIDIA Tesla V100). MuseTalk can be applied with input videos, e.g., generated by [MuseV](https://github.com/TMElyralab/MuseV), as a complete virtual human solution.
17
-
18
- # Overview
19
- `MuseTalk` is a real-time high quality audio-driven lip-syncing model trained in the latent space of `ft-mse-vae`, which
20
-
21
- 1. modifies an unseen face according to the input audio, with a size of face region of `256 x 256`.
22
- 1. supports audio in various languages, such as Chinese, English, and Japanese.
23
- 1. supports real-time inference with 30fps+ on an NVIDIA Tesla V100.
24
- 1. supports modification of the center point of the face region proposes, which **SIGNIFICANTLY** affects generation results.
25
- 1. checkpoint available trained on the HDTF dataset.
26
- 1. training codes (comming soon).
27
-
28
- # News
29
- - [04/02/2024] Released MuseTalk project and pretrained models.
30
-
31
- ## Model
32
- ![Model Structure](assets/figs/musetalk_arc.jpg)
33
- MuseTalk was trained in latent spaces, where the images were encoded by a freezed VAE. The audio was encoded by a freezed `whisper-tiny` model. The architecture of the generation network was borrowed from the UNet of the `stable-diffusion-v1-4`, where the audio embeddings were fused to the image embeddings by cross-attention.
34
-
35
- ## Cases
36
- ### MuseV + MuseTalk make human photos alive!
37
- <table class="center">
38
- <tr style="font-weight: bolder;text-align:center;">
39
- <td width="33%">Image</td>
40
- <td width="33%">MuseV</td>
41
- <td width="33%">+MuseTalk</td>
42
- </tr>
43
- <tr>
44
- <td>
45
- <img src=assets/demo/musk/musk.png width="95%">
46
- </td>
47
- <td >
48
- <video src=https://github.com/TMElyralab/MuseTalk/assets/163980830/4a4bb2d1-9d14-4ca9-85c8-7f19c39f712e controls preload></video>
49
- </td>
50
- <td >
51
- <video src=https://github.com/TMElyralab/MuseTalk/assets/163980830/b2a879c2-e23a-4d39-911d-51f0343218e4 controls preload></video>
52
- </td>
53
- </tr>
54
- <tr>
55
- <td>
56
- <img src=assets/demo/yongen/yongen.jpeg width="95%">
57
- </td>
58
- <td >
59
- <video src=https://github.com/TMElyralab/MuseTalk/assets/163980830/57ef9dee-a9fd-4dc8-839b-3fbbbf0ff3f4 controls preload></video>
60
- </td>
61
- <td >
62
- <video src=https://github.com/TMElyralab/MuseTalk/assets/163980830/94d8dcba-1bcd-4b54-9d1d-8b6fc53228f0 controls preload></video>
63
- </td>
64
- </tr>
65
- <tr>
66
- <td>
67
- <img src=assets/demo/sit/sit.jpeg width="95%">
68
- </td>
69
- <td >
70
- <video src=https://github.com/TMElyralab/MuseTalk/assets/163980830/5fbab81b-d3f2-4c75-abb5-14c76e51769e controls preload></video>
71
- </td>
72
- <td >
73
- <video src=https://github.com/TMElyralab/MuseTalk/assets/163980830/f8100f4a-3df8-4151-8de2-291b09269f66 controls preload></video>
74
- </td>
75
- </tr>
76
- <tr>
77
- <td>
78
- <img src=assets/demo/man/man.png width="95%">
79
- </td>
80
- <td >
81
- <video src=https://github.com/TMElyralab/MuseTalk/assets/163980830/a6e7d431-5643-4745-9868-8b423a454153 controls preload></video>
82
- </td>
83
- <td >
84
- <video src=https://github.com/TMElyralab/MuseTalk/assets/163980830/6ccf7bc7-cb48-42de-85bd-076d5ee8a623 controls preload></video>
85
- </td>
86
- </tr>
87
- <tr>
88
- <td>
89
- <img src=assets/demo/monalisa/monalisa.png width="95%">
90
- </td>
91
- <td >
92
- <video src=https://github.com/TMElyralab/MuseTalk/assets/163980830/1568f604-a34f-4526-a13a-7d282aa2e773 controls preload></video>
93
- </td>
94
- <td >
95
- <video src=https://github.com/TMElyralab/MuseTalk/assets/163980830/a40784fc-a885-4c1f-9b7e-8f87b7caf4e0 controls preload></video>
96
- </td>
97
- </tr>
98
- <tr>
99
- <td>
100
- <img src=assets/demo/sun1/sun.png width="95%">
101
- </td>
102
- <td >
103
- <video src=https://github.com/TMElyralab/MuseTalk/assets/163980830/37a3a666-7b90-4244-8d3a-058cb0e44107 controls preload></video>
104
- </td>
105
- <td >
106
- <video src=https://github.com/TMElyralab/MuseTalk/assets/163980830/172f4ff1-d432-45bd-a5a7-a07dec33a26b controls preload></video>
107
- </td>
108
- </tr>
109
- <tr>
110
- <td>
111
- <img src=assets/demo/sun2/sun.png width="95%">
112
- </td>
113
- <td >
114
- <video src=https://github.com/TMElyralab/MuseTalk/assets/163980830/37a3a666-7b90-4244-8d3a-058cb0e44107 controls preload></video>
115
- </td>
116
- <td >
117
- <video src=https://github.com/TMElyralab/MuseTalk/assets/163980830/85a6873d-a028-4cce-af2b-6c59a1f2971d controls preload></video>
118
- </td>
119
- </tr>
120
- </table >
121
-
122
- * The character of the last two rows, `Xinying Sun`, is a supermodel KOL. You can follow her on [douyin](https://www.douyin.com/user/MS4wLjABAAAAWDThbMPN_6Xmm_JgXexbOii1K-httbu2APdG8DvDyM8).
123
-
124
- ## Video dubbing
125
- <table class="center">
126
- <tr style="font-weight: bolder;text-align:center;">
127
- <td width="70%">MuseTalk</td>
128
- <td width="30%">Original videos</td>
129
- </tr>
130
- <tr>
131
- <td>
132
- <video src=https://github.com/TMElyralab/MuseTalk/assets/163980830/4d7c5fa1-3550-4d52-8ed2-52f158150f24 controls preload></video>
133
- </td>
134
- <td>
135
- <a href="//www.bilibili.com/video/BV1wT411b7HU">Link</a>
136
- <href src=""></href>
137
- </td>
138
- </tr>
139
- </table>
140
-
141
- * For video dubbing, we applied a self-developed tool which can identify the talking person.
142
-
143
- ## Some interesting videos!
144
- <table class="center">
145
- <tr style="font-weight: bolder;text-align:center;">
146
- <td width="50%">Image</td>
147
- <td width="50%">MuseV + MuseTalk</td>
148
- </tr>
149
- <tr>
150
- <td>
151
- <img src=assets/demo/video1/video1.png width="95%">
152
- </td>
153
- <td>
154
- <video src=https://github.com/TMElyralab/MuseTalk/assets/163980830/1f02f9c6-8b98-475e-86b8-82ebee82fe0d controls preload></video>
155
- </td>
156
- </tr>
157
- </table>
158
-
159
- # TODO:
160
- - [x] trained models and inference codes.
161
- - [ ] technical report.
162
- - [ ] training codes.
163
- - [ ] online UI.
164
- - [ ] a better model (may take longer).
165
-
166
-
167
- # Getting Started
168
- We provide a detailed tutorial about the installation and the basic usage of MuseTalk for new users:
169
- ## Installation
170
- To prepare the Python environment and install additional packages such as opencv, diffusers, mmcv, etc., please follow the steps below:
171
- ### Build environment
172
-
173
- We recommend a python version >=3.10 and cuda version =11.7. Then build environment as follows:
174
-
175
- ```shell
176
- pip install -r requirements.txt
177
- ```
178
-
179
- ### mmlab packages
180
- ```bash
181
- pip install --no-cache-dir -U openmim
182
- mim install mmengine
183
- mim install "mmcv>=2.0.1"
184
- mim install "mmdet>=3.1.0"
185
- mim install "mmpose>=1.1.0"
186
- ```
187
-
188
- ### Download ffmpeg-static
189
- Download the ffmpeg-static and
190
- ```
191
- export FFMPEG_PATH=/path/to/ffmpeg
192
- ```
193
- for example:
194
- ```
195
- export FFMPEG_PATH=/musetalk/ffmpeg-4.4-amd64-static
196
- ```
197
- ### Download weights
198
- You can download weights manually as follows:
199
-
200
- 1. Download our trained [weights](https://huggingface.co/TMElyralab/MuseTalk).
201
-
202
- 2. Download the weights of other components:
203
- - [sd-vae-ft-mse](https://huggingface.co/stabilityai/sd-vae-ft-mse)
204
- - [whisper](https://openaipublic.azureedge.net/main/whisper/models/65147644a518d12f04e32d6f3b26facc3f8dd46e5390956a9424a650c0ce22b9/tiny.pt)
205
- - [dwpose](https://huggingface.co/yzd-v/DWPose/tree/main)
206
- - [face-parse-bisent](https://github.com/zllrunning/face-parsing.PyTorch)
207
- - [resnet18](https://download.pytorch.org/models/resnet18-5c106cde.pth)
208
-
209
-
210
- Finally, these weights should be organized in `models` as follows:
211
- ```
212
- ./models/
213
- ├── musetalk
214
- │ └── musetalk.json
215
- │ └── pytorch_model.bin
216
- ├── dwpose
217
- │ └── dw-ll_ucoco_384.pth
218
- ├── face-parse-bisent
219
- │ ├── 79999_iter.pth
220
- │ └── resnet18-5c106cde.pth
221
- ├── sd-vae-ft-mse
222
- │ ├── config.json
223
- │ └── diffusion_pytorch_model.bin
224
- └── whisper
225
- └── tiny.pt
226
- ```
227
- ## Quickstart
228
-
229
- ### Inference
230
- Here, we provide the inference script.
231
- ```
232
- python -m scripts.inference --inference_config configs/inference/test.yaml
233
- ```
234
- configs/inference/test.yaml is the path to the inference configuration file, including video_path and audio_path.
235
- The video_path should be either a video file or a directory of images.
236
-
237
- You are recommended to input video with `25fps`, the same fps used when training the model. If your video is far less than 25fps, you are recommended to apply frame interpolation or directly convert the video to 25fps using ffmpeg.
238
-
239
- #### Use of bbox_shift to have adjustable results
240
- :mag_right: We have found that upper-bound of the mask has an important impact on mouth openness. Thus, to control the mask region, we suggest using the `bbox_shift` parameter. Positive values (moving towards the lower half) increase mouth openness, while negative values (moving towards the upper half) decrease mouth openness.
241
-
242
- You can start by running with the default configuration to obtain the adjustable value range, and then re-run the script within this range.
243
-
244
- For example, in the case of `Xinying Sun`, after running the default configuration, it shows that the adjustable value rage is [-9, 9]. Then, to decrease the mouth openness, we set the value to be `-7`.
245
- ```
246
- python -m scripts.inference --inference_config configs/inference/test.yaml --bbox_shift -7
247
- ```
248
- :pushpin: More technical details can be found in [bbox_shift](assets/BBOX_SHIFT.md).
249
-
250
- #### Combining MuseV and MuseTalk
251
-
252
- As a complete solution to virtual human generation, you are suggested to first apply [MuseV](https://github.com/TMElyralab/MuseV) to generate a video (text-to-video, image-to-video or pose-to-video) by referring [this](https://github.com/TMElyralab/MuseV?tab=readme-ov-file#text2video). Frame interpolation is suggested to increase frame rate. Then, you can use `MuseTalk` to generate a lip-sync video by referring [this](https://github.com/TMElyralab/MuseTalk?tab=readme-ov-file#inference).
253
-
254
- # Note
255
-
256
- If you want to launch online video chats, you are suggested to generate videos using MuseV and apply necessary pre-processing such as face detection and face parsing in advance. During online chatting, only UNet and the VAE decoder are involved, which makes MuseTalk real-time.
257
-
258
-
259
- # Acknowledgement
260
- 1. We thank open-source components like [whisper](https://github.com/openai/whisper), [dwpose](https://github.com/IDEA-Research/DWPose), [face-alignment](https://github.com/1adrianb/face-alignment), [face-parsing](https://github.com/zllrunning/face-parsing.PyTorch), [S3FD](https://github.com/yxlijun/S3FD.pytorch).
261
- 1. MuseTalk has referred much to [diffusers](https://github.com/huggingface/diffusers) and [isaacOnline/whisper](https://github.com/isaacOnline/whisper/tree/extract-embeddings).
262
- 1. MuseTalk has been built on [HDTF](https://github.com/MRzzm/HDTF) datasets.
263
-
264
- Thanks for open-sourcing!
265
-
266
- # Limitations
267
- - Resolution: Though MuseTalk uses a face region size of 256 x 256, which make it better than other open-source methods, it has not yet reached the theoretical resolution bound. We will continue to deal with this problem.
268
- If you need higher resolution, you could apply super resolution models such as [GFPGAN](https://github.com/TencentARC/GFPGAN) in combination with MuseTalk.
269
-
270
- - Identity preservation: Some details of the original face are not well preserved, such as mustache, lip shape and color.
271
-
272
- - Jitter: There exists some jitter as the current pipeline adopts single-frame generation.
273
-
274
- # Citation
275
- ```bib
276
- @article{musetalk,
277
- title={MuseTalk: Real-Time High Quality Lip Synchorization with Latent Space Inpainting},
278
- author={Zhang, Yue and Liu, Minhao and Chen, Zhaokang and Wu, Bin and He, Yingjie and Zhan, Chao and Zhou, Wenjiang},
279
- journal={arxiv},
280
- year={2024}
281
- }
282
- ```
283
- # Disclaimer/License
284
- 1. `code`: The code of MuseTalk is released under the MIT License. There is no limitation for both academic and commercial usage.
285
- 1. `model`: The trained model are available for any purpose, even commercially.
286
- 1. `other opensource model`: Other open-source models used must comply with their license, such as `whisper`, `ft-mse-vae`, `dwpose`, `S3FD`, etc..
287
- 1. The testdata are collected from internet, which are available for non-commercial research purposes only.
288
- 1. `AIGC`: This project strives to impact the domain of AI-driven video generation positively. Users are granted the freedom to create videos using this tool, but they are expected to comply with local laws and utilize it responsibly. The developers do not assume any responsibility for potential misuse by users.
 
1
+ ---
2
+ title: MuseVDemo
3
+ emoji: 🌍
4
+ colorFrom: gray
5
+ colorTo: purple
6
+ sdk: gradio
7
+ pinned: false
8
+ license: creativeml-openrail-m
9
+ app_file: app.py
10
+ app_port: 7860
11
+ ---
12
+
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference