kevinwang676 commited on
Commit
9aaf024
1 Parent(s): 8f28809

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +23 -0
  2. .gitignore +174 -0
  3. .ipynb_checkpoints/Untitled-checkpoint.ipynb +6 -0
  4. LICENSE +21 -0
  5. README.md +268 -13
  6. Untitled.ipynb +533 -0
  7. app_sadtalker.py +111 -0
  8. checkpoints/SadTalker_V0.0.2_256.safetensors +3 -0
  9. checkpoints/SadTalker_V0.0.2_512.safetensors +3 -0
  10. checkpoints/mapping_00109-model.pth.tar +3 -0
  11. checkpoints/mapping_00229-model.pth.tar +3 -0
  12. cog.yaml +35 -0
  13. docs/FAQ.md +46 -0
  14. docs/best_practice.md +94 -0
  15. docs/changlelog.md +29 -0
  16. docs/example_crop.gif +3 -0
  17. docs/example_crop_still.gif +3 -0
  18. docs/example_full.gif +3 -0
  19. docs/example_full_crop.gif +0 -0
  20. docs/example_full_enhanced.gif +3 -0
  21. docs/face3d.md +48 -0
  22. docs/free_view_result.gif +3 -0
  23. docs/install.md +47 -0
  24. docs/resize_good.gif +3 -0
  25. docs/resize_no.gif +3 -0
  26. docs/sadtalker_logo.png +0 -0
  27. docs/using_ref_video.gif +3 -0
  28. docs/webui_extension.md +50 -0
  29. examples/driven_audio/RD_Radio31_000.wav +0 -0
  30. examples/driven_audio/RD_Radio34_002.wav +0 -0
  31. examples/driven_audio/RD_Radio36_000.wav +0 -0
  32. examples/driven_audio/RD_Radio40_000.wav +0 -0
  33. examples/driven_audio/bus_chinese.wav +0 -0
  34. examples/driven_audio/chinese_news.wav +3 -0
  35. examples/driven_audio/chinese_poem1.wav +0 -0
  36. examples/driven_audio/chinese_poem2.wav +0 -0
  37. examples/driven_audio/deyu.wav +3 -0
  38. examples/driven_audio/eluosi.wav +3 -0
  39. examples/driven_audio/fayu.wav +3 -0
  40. examples/driven_audio/imagine.wav +3 -0
  41. examples/driven_audio/itosinger1.wav +0 -0
  42. examples/driven_audio/japanese.wav +3 -0
  43. examples/ref_video/WDA_AlexandriaOcasioCortez_000.mp4 +3 -0
  44. examples/ref_video/WDA_KatieHill_000.mp4 +3 -0
  45. examples/source_image/art_0.png +0 -0
  46. examples/source_image/art_1.png +0 -0
  47. examples/source_image/art_10.png +0 -0
  48. examples/source_image/art_11.png +0 -0
  49. examples/source_image/art_12.png +0 -0
  50. examples/source_image/art_13.png +0 -0
.gitattributes CHANGED
@@ -33,3 +33,26 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ docs/example_crop.gif filter=lfs diff=lfs merge=lfs -text
37
+ docs/example_crop_still.gif filter=lfs diff=lfs merge=lfs -text
38
+ docs/example_full.gif filter=lfs diff=lfs merge=lfs -text
39
+ docs/example_full_enhanced.gif filter=lfs diff=lfs merge=lfs -text
40
+ docs/free_view_result.gif filter=lfs diff=lfs merge=lfs -text
41
+ docs/resize_good.gif filter=lfs diff=lfs merge=lfs -text
42
+ docs/resize_no.gif filter=lfs diff=lfs merge=lfs -text
43
+ docs/using_ref_video.gif filter=lfs diff=lfs merge=lfs -text
44
+ examples/driven_audio/chinese_news.wav filter=lfs diff=lfs merge=lfs -text
45
+ examples/driven_audio/deyu.wav filter=lfs diff=lfs merge=lfs -text
46
+ examples/driven_audio/eluosi.wav filter=lfs diff=lfs merge=lfs -text
47
+ examples/driven_audio/fayu.wav filter=lfs diff=lfs merge=lfs -text
48
+ examples/driven_audio/imagine.wav filter=lfs diff=lfs merge=lfs -text
49
+ examples/driven_audio/japanese.wav filter=lfs diff=lfs merge=lfs -text
50
+ examples/ref_video/WDA_AlexandriaOcasioCortez_000.mp4 filter=lfs diff=lfs merge=lfs -text
51
+ examples/ref_video/WDA_KatieHill_000.mp4 filter=lfs diff=lfs merge=lfs -text
52
+ examples/source_image/art_16.png filter=lfs diff=lfs merge=lfs -text
53
+ examples/source_image/art_17.png filter=lfs diff=lfs merge=lfs -text
54
+ examples/source_image/art_3.png filter=lfs diff=lfs merge=lfs -text
55
+ examples/source_image/art_4.png filter=lfs diff=lfs merge=lfs -text
56
+ examples/source_image/art_5.png filter=lfs diff=lfs merge=lfs -text
57
+ examples/source_image/art_8.png filter=lfs diff=lfs merge=lfs -text
58
+ examples/source_image/art_9.png filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ env/
126
+ venv/
127
+ ENV/
128
+ env.bak/
129
+ venv.bak/
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+
141
+ # mypy
142
+ .mypy_cache/
143
+ .dmypy.json
144
+ dmypy.json
145
+
146
+ # Pyre type checker
147
+ .pyre/
148
+
149
+ # pytype static type analyzer
150
+ .pytype/
151
+
152
+ # Cython debug symbols
153
+ cython_debug/
154
+
155
+ # PyCharm
156
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
159
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
+ .idea/
161
+
162
+ examples/results/*
163
+ gfpgan/*
164
+ checkpoints/*
165
+ assets/*
166
+ results/*
167
+ Dockerfile
168
+ start_docker.sh
169
+ start.sh
170
+
171
+ checkpoints
172
+
173
+ # Mac
174
+ .DS_Store
.ipynb_checkpoints/Untitled-checkpoint.ipynb ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [],
3
+ "metadata": {},
4
+ "nbformat": 4,
5
+ "nbformat_minor": 5
6
+ }
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Tencent AI Lab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md CHANGED
@@ -1,13 +1,268 @@
1
- ---
2
- title: SadTalker
3
- emoji: 🏃
4
- colorFrom: gray
5
- colorTo: blue
6
- sdk: gradio
7
- sdk_version: 3.37.0
8
- app_file: app.py
9
- pinned: false
10
- license: mit
11
- ---
12
-
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+
3
+ <img src='https://user-images.githubusercontent.com/4397546/229094115-862c747e-7397-4b54-ba4a-bd368bfe2e0f.png' width='500px'/>
4
+
5
+
6
+ <!--<h2> 😭 SadTalker: <span style="font-size:12px">Learning Realistic 3D Motion Coefficients for Stylized Audio-Driven Single Image Talking Face Animation </span> </h2> -->
7
+
8
+ <a href='https://arxiv.org/abs/2211.12194'><img src='https://img.shields.io/badge/ArXiv-PDF-red'></a> &nbsp; <a href='https://sadtalker.github.io'><img src='https://img.shields.io/badge/Project-Page-Green'></a> &nbsp; [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Winfredy/SadTalker/blob/main/quick_demo.ipynb) &nbsp; [![Hugging Face Spaces](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)](https://huggingface.co/spaces/vinthony/SadTalker) &nbsp; [![sd webui-colab](https://img.shields.io/badge/Automatic1111-Colab-green)](https://colab.research.google.com/github/camenduru/stable-diffusion-webui-colab/blob/main/video/stable/stable_diffusion_1_5_video_webui_colab.ipynb) &nbsp; [![Replicate](https://replicate.com/cjwbw/sadtalker/badge)](https://replicate.com/cjwbw/sadtalker)
9
+
10
+ <div>
11
+ <a target='_blank'>Wenxuan Zhang <sup>*,1,2</sup> </a>&emsp;
12
+ <a href='https://vinthony.github.io/' target='_blank'>Xiaodong Cun <sup>*,2</a>&emsp;
13
+ <a href='https://xuanwangvc.github.io/' target='_blank'>Xuan Wang <sup>3</sup></a>&emsp;
14
+ <a href='https://yzhang2016.github.io/' target='_blank'>Yong Zhang <sup>2</sup></a>&emsp;
15
+ <a href='https://xishen0220.github.io/' target='_blank'>Xi Shen <sup>2</sup></a>&emsp; </br>
16
+ <a href='https://yuguo-xjtu.github.io/' target='_blank'>Yu Guo<sup>1</sup> </a>&emsp;
17
+ <a href='https://scholar.google.com/citations?hl=zh-CN&user=4oXBp9UAAAAJ' target='_blank'>Ying Shan <sup>2</sup> </a>&emsp;
18
+ <a target='_blank'>Fei Wang <sup>1</sup> </a>&emsp;
19
+ </div>
20
+ <br>
21
+ <div>
22
+ <sup>1</sup> Xi'an Jiaotong University &emsp; <sup>2</sup> Tencent AI Lab &emsp; <sup>3</sup> Ant Group &emsp;
23
+ </div>
24
+ <br>
25
+ <i><strong><a href='https://arxiv.org/abs/2211.12194' target='_blank'>CVPR 2023</a></strong></i>
26
+ <br>
27
+ <br>
28
+
29
+
30
+ ![sadtalker](https://user-images.githubusercontent.com/4397546/222490039-b1f6156b-bf00-405b-9fda-0c9a9156f991.gif)
31
+
32
+ <b>TL;DR: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; single portrait image 🙎‍♂️ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; audio 🎤 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; talking head video 🎞.</b>
33
+
34
+ <br>
35
+
36
+ </div>
37
+
38
+
39
+
40
+ ## 🔥 Highlight
41
+
42
+ - 🔥 The extension of the [stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui) is online. Checkout more details [here](docs/webui_extension.md).
43
+
44
+ https://user-images.githubusercontent.com/4397546/231495639-5d4bb925-ea64-4a36-a519-6389917dac29.mp4
45
+
46
+ - 🔥 `full image mode` is online! checkout [here](https://github.com/Winfredy/SadTalker#full-bodyimage-generation) for more details.
47
+
48
+ | still+enhancer in v0.0.1 | still + enhancer in v0.0.2 | [input image @bagbag1815](https://twitter.com/bagbag1815/status/1642754319094108161) |
49
+ |:--------------------: |:--------------------: | :----: |
50
+ | <video src="https://user-images.githubusercontent.com/48216707/229484996-5d7be64f-2553-4c9e-a452-c5cf0b8ebafe.mp4" type="video/mp4"> </video> | <video src="https://user-images.githubusercontent.com/4397546/230717873-355b7bf3-d3de-49f9-a439-9220e623fce7.mp4" type="video/mp4"> </video> | <img src='./examples/source_image/full_body_2.png' width='380'>
51
+
52
+ - 🔥 Several new mode, eg, `still mode`, `reference mode`, `resize mode` are online for better and custom applications.
53
+
54
+ - 🔥 Happy to see more community demos at [bilibili](https://search.bilibili.com/all?keyword=sadtalker&from_source=webtop_search&spm_id_from=333.1007&search_source=3
55
+ ), [Youtube](https://www.youtube.com/results?search_query=sadtalker&sp=CAM%253D) and [twitter #sadtalker](https://twitter.com/search?q=%23sadtalker&src=typed_query).
56
+
57
+ ## 📋 Changelog (Previous changelog can be founded [here](docs/changlelog.md))
58
+
59
+ - __[2023.06.12]__: add more new features in WEBUI extension, see the discussion [here](https://github.com/OpenTalker/SadTalker/discussions/386).
60
+
61
+ - __[2023.06.05]__: release a new 512 beta face model. Fixed some bugs and improve the performance.
62
+
63
+ - __[2023.04.15]__: Adding automatic1111 colab by @camenduru, thanks for this awesome colab: [![sd webui-colab](https://img.shields.io/badge/Automatic1111-Colab-green)](https://colab.research.google.com/github/camenduru/stable-diffusion-webui-colab/blob/main/video/stable/stable_diffusion_1_5_video_webui_colab.ipynb).
64
+
65
+ - __[2023.04.12]__: adding a more detailed sd-webui installation document, fixed reinstallation problem.
66
+
67
+ - __[2023.04.12]__: Fixed the sd-webui safe issues becasue of the 3rd packages, optimize the output path in `sd-webui-extension`.
68
+
69
+ - __[2023.04.08]__: ❗️❗️❗️ In v0.0.2, we add a logo watermark to the generated video to prevent abusing since it is very realistic.
70
+
71
+ - __[2023.04.08]__: v0.0.2, full image animation, adding baidu driver for download checkpoints. Optimizing the logic about enhancer.
72
+
73
+
74
+ ## 🚧 TODO: See the Discussion https://github.com/OpenTalker/SadTalker/issues/280
75
+
76
+ ## If you have any problem, please view our [FAQ](docs/FAQ.md) before opening an issue.
77
+
78
+
79
+
80
+ ## ⚙️ 1. Installation.
81
+
82
+ Tutorials from communities: [中文windows教程](https://www.bilibili.com/video/BV1Dc411W7V6/) | [日本語コース](https://br-d.fanbox.cc/posts/5685086?utm_campaign=manage_post_page&utm_medium=share&utm_source=twitter)
83
+
84
+ ### Linux:
85
+
86
+ 1. Installing [anaconda](https://www.anaconda.com/), python and git.
87
+
88
+ 2. Creating the env and install the requirements.
89
+ ```bash
90
+ git clone https://github.com/Winfredy/SadTalker.git
91
+
92
+ cd SadTalker
93
+
94
+ conda create -n sadtalker python=3.8
95
+
96
+ conda activate sadtalker
97
+
98
+ pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113
99
+
100
+ conda install ffmpeg
101
+
102
+ pip install -r requirements.txt
103
+
104
+ ### tts is optional for gradio demo.
105
+ ### pip install TTS
106
+
107
+ ```
108
+ ### Windows ([中文windows教程](https://www.bilibili.com/video/BV1Dc411W7V6/)):
109
+
110
+ 1. Install [Python 3.10.6](https://www.python.org/downloads/windows/), checking "Add Python to PATH".
111
+ 2. Install [git](https://git-scm.com/download/win) manually (OR `scoop install git` via [scoop](https://scoop.sh/)).
112
+ 3. Install `ffmpeg`, following [this instruction](https://www.wikihow.com/Install-FFmpeg-on-Windows) (OR using `scoop install ffmpeg` via [scoop](https://scoop.sh/)).
113
+ 4. Download our SadTalker repository, for example by running `git clone https://github.com/Winfredy/SadTalker.git`.
114
+ 5. Download the `checkpoint` and `gfpgan` [below↓](https://github.com/Winfredy/SadTalker#-2-download-trained-models).
115
+ 5. Run `start.bat` from Windows Explorer as normal, non-administrator, user, a gradio WebUI demo will be started.
116
+
117
+ ### Macbook:
118
+
119
+ More tips about installnation on Macbook and the Docker file can be founded [here](docs/install.md)
120
+
121
+ ## 📥 2. Download Trained Models.
122
+
123
+ You can run the following script to put all the models in the right place.
124
+
125
+ ```bash
126
+ bash scripts/download_models.sh
127
+ ```
128
+
129
+ Other alternatives:
130
+ > we also provide an offline patch (`gfpgan/`), thus, no model will be downloaded when generating.
131
+
132
+ **Google Driver**: download our pre-trained model from [ this link (main checkpoints)](https://drive.google.com/file/d/1gwWh45pF7aelNP_P78uDJL8Sycep-K7j/view?usp=sharing) and [ gfpgan (offline patch)](https://drive.google.com/file/d/19AIBsmfcHW6BRJmeqSFlG5fL445Xmsyi?usp=sharing)
133
+
134
+ **Github Release Page**: download all the files from the [lastest github release page](https://github.com/Winfredy/SadTalker/releases), and then, put it in ./checkpoints.
135
+
136
+ **百度云盘**: we provided the downloaded model in [checkpoints, 提取码: sadt.](https://pan.baidu.com/s/1P4fRgk9gaSutZnn8YW034Q?pwd=sadt) And [gfpgan, 提取码: sadt.](https://pan.baidu.com/s/1kb1BCPaLOWX1JJb9Czbn6w?pwd=sadt)
137
+
138
+
139
+
140
+ <details><summary>Model Details</summary>
141
+
142
+
143
+ Model explains:
144
+
145
+ ##### New version
146
+ | Model | Description
147
+ | :--- | :----------
148
+ |checkpoints/mapping_00229-model.pth.tar | Pre-trained MappingNet in Sadtalker.
149
+ |checkpoints/mapping_00109-model.pth.tar | Pre-trained MappingNet in Sadtalker.
150
+ |checkpoints/SadTalker_V0.0.2_256.safetensors | packaged sadtalker checkpoints of old version, 256 face render).
151
+ |checkpoints/SadTalker_V0.0.2_512.safetensors | packaged sadtalker checkpoints of old version, 512 face render).
152
+ |gfpgan/weights | Face detection and enhanced models used in `facexlib` and `gfpgan`.
153
+
154
+
155
+ ##### Old version
156
+ | Model | Description
157
+ | :--- | :----------
158
+ |checkpoints/auido2exp_00300-model.pth | Pre-trained ExpNet in Sadtalker.
159
+ |checkpoints/auido2pose_00140-model.pth | Pre-trained PoseVAE in Sadtalker.
160
+ |checkpoints/mapping_00229-model.pth.tar | Pre-trained MappingNet in Sadtalker.
161
+ |checkpoints/mapping_00109-model.pth.tar | Pre-trained MappingNet in Sadtalker.
162
+ |checkpoints/facevid2vid_00189-model.pth.tar | Pre-trained face-vid2vid model from [the reappearance of face-vid2vid](https://github.com/zhanglonghao1992/One-Shot_Free-View_Neural_Talking_Head_Synthesis).
163
+ |checkpoints/epoch_20.pth | Pre-trained 3DMM extractor in [Deep3DFaceReconstruction](https://github.com/microsoft/Deep3DFaceReconstruction).
164
+ |checkpoints/wav2lip.pth | Highly accurate lip-sync model in [Wav2lip](https://github.com/Rudrabha/Wav2Lip).
165
+ |checkpoints/shape_predictor_68_face_landmarks.dat | Face landmark model used in [dilb](http://dlib.net/).
166
+ |checkpoints/BFM | 3DMM library file.
167
+ |checkpoints/hub | Face detection models used in [face alignment](https://github.com/1adrianb/face-alignment).
168
+ |gfpgan/weights | Face detection and enhanced models used in `facexlib` and `gfpgan`.
169
+
170
+ The final folder will be shown as:
171
+
172
+ <img width="331" alt="image" src="https://user-images.githubusercontent.com/4397546/232511411-4ca75cbf-a434-48c5-9ae0-9009e8316484.png">
173
+
174
+
175
+ </details>
176
+
177
+ ## 🔮 3. Quick Start ([Best Practice](docs/best_practice.md)).
178
+
179
+ ### WebUI Demos:
180
+
181
+ **Online**: [Huggingface](https://huggingface.co/spaces/vinthony/SadTalker) | [SDWebUI-Colab](https://colab.research.google.com/github/camenduru/stable-diffusion-webui-colab/blob/main/video/stable/stable_diffusion_1_5_video_webui_colab.ipynb) | [Colab](https://colab.research.google.com/github/Winfredy/SadTalker/blob/main/quick_demo.ipynb)
182
+
183
+ **Local Autiomatic1111 stable-diffusion webui extension**: please refer to [Autiomatic1111 stable-diffusion webui docs](docs/webui_extension.md).
184
+
185
+ **Local gradio demo(highly recommanded!)**: Similar to our [hugging-face demo](https://huggingface.co/spaces/vinthony/SadTalker) can be run by:
186
+
187
+ ```bash
188
+ ## you need manually install TTS(https://github.com/coqui-ai/TTS) via `pip install tts` in advanced.
189
+ python app.py
190
+ ```
191
+
192
+ **Local gradio demo(highly recommanded!)**:
193
+
194
+ - windows: just double click `webui.bat`, the requirements will be installed automatically.
195
+ - Linux/Mac OS: run `bash webui.sh` to start the webui.
196
+
197
+
198
+ ### Manually usages:
199
+
200
+ ##### Animating a portrait image from default config:
201
+ ```bash
202
+ python inference.py --driven_audio <audio.wav> \
203
+ --source_image <video.mp4 or picture.png> \
204
+ --enhancer gfpgan
205
+ ```
206
+ The results will be saved in `results/$SOME_TIMESTAMP/*.mp4`.
207
+
208
+ ##### Full body/image Generation:
209
+
210
+ Using `--still` to generate a natural full body video. You can add `enhancer` to improve the quality of the generated video.
211
+
212
+ ```bash
213
+ python inference.py --driven_audio <audio.wav> \
214
+ --source_image <video.mp4 or picture.png> \
215
+ --result_dir <a file to store results> \
216
+ --still \
217
+ --preprocess full \
218
+ --enhancer gfpgan
219
+ ```
220
+
221
+ More examples and configuration and tips can be founded in the [ >>> best practice documents <<<](docs/best_practice.md).
222
+
223
+ ## 🛎 Citation
224
+
225
+ If you find our work useful in your research, please consider citing:
226
+
227
+ ```bibtex
228
+ @article{zhang2022sadtalker,
229
+ title={SadTalker: Learning Realistic 3D Motion Coefficients for Stylized Audio-Driven Single Image Talking Face Animation},
230
+ author={Zhang, Wenxuan and Cun, Xiaodong and Wang, Xuan and Zhang, Yong and Shen, Xi and Guo, Yu and Shan, Ying and Wang, Fei},
231
+ journal={arXiv preprint arXiv:2211.12194},
232
+ year={2022}
233
+ }
234
+ ```
235
+
236
+
237
+
238
+ ## 💗 Acknowledgements
239
+
240
+ Facerender code borrows heavily from [zhanglonghao's reproduction of face-vid2vid](https://github.com/zhanglonghao1992/One-Shot_Free-View_Neural_Talking_Head_Synthesis) and [PIRender](https://github.com/RenYurui/PIRender). We thank the authors for sharing their wonderful code. In training process, We also use the model from [Deep3DFaceReconstruction](https://github.com/microsoft/Deep3DFaceReconstruction) and [Wav2lip](https://github.com/Rudrabha/Wav2Lip). We thank for their wonderful work.
241
+
242
+ See also these wonderful 3rd libraries we use:
243
+
244
+ - **Face Utils**: https://github.com/xinntao/facexlib
245
+ - **Face Enhancement**: https://github.com/TencentARC/GFPGAN
246
+ - **Image/Video Enhancement**:https://github.com/xinntao/Real-ESRGAN
247
+
248
+ ## 🥂 Extensions:
249
+
250
+ - [SadTalker-Video-Lip-Sync](https://github.com/Zz-ww/SadTalker-Video-Lip-Sync) from [@Zz-ww](https://github.com/Zz-ww): SadTalker for Video Lip Editing
251
+
252
+ ## 🥂 Related Works
253
+ - [StyleHEAT: One-Shot High-Resolution Editable Talking Face Generation via Pre-trained StyleGAN (ECCV 2022)](https://github.com/FeiiYin/StyleHEAT)
254
+ - [CodeTalker: Speech-Driven 3D Facial Animation with Discrete Motion Prior (CVPR 2023)](https://github.com/Doubiiu/CodeTalker)
255
+ - [VideoReTalking: Audio-based Lip Synchronization for Talking Head Video Editing In the Wild (SIGGRAPH Asia 2022)](https://github.com/vinthony/video-retalking)
256
+ - [DPE: Disentanglement of Pose and Expression for General Video Portrait Editing (CVPR 2023)](https://github.com/Carlyx/DPE)
257
+ - [3D GAN Inversion with Facial Symmetry Prior (CVPR 2023)](https://github.com/FeiiYin/SPI/)
258
+ - [T2M-GPT: Generating Human Motion from Textual Descriptions with Discrete Representations (CVPR 2023)](https://github.com/Mael-zys/T2M-GPT)
259
+
260
+ ## 📢 Disclaimer
261
+
262
+ This is not an official product of Tencent. This repository can only be used for personal/research/non-commercial purposes.
263
+
264
+ LOGO: color and font suggestion: [ChatGPT](ai.com), logo font:[Montserrat Alternates
265
+ ](https://fonts.google.com/specimen/Montserrat+Alternates?preview.text=SadTalker&preview.text_type=custom&query=mont).
266
+
267
+ All the copyright of the demo images and audio are from communities users or the geneartion from stable diffusion. Free free to contact us if you feel uncomfortable.
268
+
Untitled.ipynb ADDED
@@ -0,0 +1,533 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "c69a901b-8c3f-4188-97bd-5594c4496ec5",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "from huggingface_hub import HfApi\n",
11
+ "api = HfApi()"
12
+ ]
13
+ },
14
+ {
15
+ "cell_type": "code",
16
+ "execution_count": 3,
17
+ "id": "8b249adc-ccd0-4145-86ce-64509ad276cf",
18
+ "metadata": {},
19
+ "outputs": [
20
+ {
21
+ "data": {
22
+ "application/vnd.jupyter.widget-view+json": {
23
+ "model_id": "faf7b41b81e54705bae8921f2a86e9fd",
24
+ "version_major": 2,
25
+ "version_minor": 0
26
+ },
27
+ "text/plain": [
28
+ "VBox(children=(HTML(value='<center> <img\\nsrc=https://huggingface.co/front/assets/huggingface_logo-noborder.sv…"
29
+ ]
30
+ },
31
+ "metadata": {},
32
+ "output_type": "display_data"
33
+ }
34
+ ],
35
+ "source": [
36
+ "from huggingface_hub import login\n",
37
+ "login()"
38
+ ]
39
+ },
40
+ {
41
+ "cell_type": "code",
42
+ "execution_count": null,
43
+ "id": "41815b66-b12b-45da-9a5e-92c527fe2b4a",
44
+ "metadata": {},
45
+ "outputs": [
46
+ {
47
+ "data": {
48
+ "application/vnd.jupyter.widget-view+json": {
49
+ "model_id": "6bb4c00dda664acd9f70e029e15dbd57",
50
+ "version_major": 2,
51
+ "version_minor": 0
52
+ },
53
+ "text/plain": [
54
+ "SadTalker_V0.0.2_512.safetensors: 0%| | 0.00/725M [00:00<?, ?B/s]"
55
+ ]
56
+ },
57
+ "metadata": {},
58
+ "output_type": "display_data"
59
+ },
60
+ {
61
+ "data": {
62
+ "application/vnd.jupyter.widget-view+json": {
63
+ "model_id": "b9a78d85c20642ac86da6b6d0ab97031",
64
+ "version_major": 2,
65
+ "version_minor": 0
66
+ },
67
+ "text/plain": [
68
+ "mapping_00109-model.pth.tar: 0%| | 0.00/156M [00:00<?, ?B/s]"
69
+ ]
70
+ },
71
+ "metadata": {},
72
+ "output_type": "display_data"
73
+ },
74
+ {
75
+ "data": {
76
+ "application/vnd.jupyter.widget-view+json": {
77
+ "model_id": "d396b1372ea04ae79dd82677c1c33352",
78
+ "version_major": 2,
79
+ "version_minor": 0
80
+ },
81
+ "text/plain": [
82
+ "Upload 31 LFS files: 0%| | 0/31 [00:00<?, ?it/s]"
83
+ ]
84
+ },
85
+ "metadata": {},
86
+ "output_type": "display_data"
87
+ },
88
+ {
89
+ "data": {
90
+ "application/vnd.jupyter.widget-view+json": {
91
+ "model_id": "7b924c6f560b40b78152a87f5c388d6b",
92
+ "version_major": 2,
93
+ "version_minor": 0
94
+ },
95
+ "text/plain": [
96
+ "mapping_00229-model.pth.tar: 0%| | 0.00/156M [00:00<?, ?B/s]"
97
+ ]
98
+ },
99
+ "metadata": {},
100
+ "output_type": "display_data"
101
+ },
102
+ {
103
+ "data": {
104
+ "application/vnd.jupyter.widget-view+json": {
105
+ "model_id": "4245c014a4d04d6daacd47d7d81c6249",
106
+ "version_major": 2,
107
+ "version_minor": 0
108
+ },
109
+ "text/plain": [
110
+ "SadTalker_V0.0.2_256.safetensors: 0%| | 0.00/725M [00:00<?, ?B/s]"
111
+ ]
112
+ },
113
+ "metadata": {},
114
+ "output_type": "display_data"
115
+ },
116
+ {
117
+ "data": {
118
+ "application/vnd.jupyter.widget-view+json": {
119
+ "model_id": "d7f2b0a6b3ed4d5e895da21237f42577",
120
+ "version_major": 2,
121
+ "version_minor": 0
122
+ },
123
+ "text/plain": [
124
+ "example_crop.gif: 0%| | 0.00/1.55M [00:00<?, ?B/s]"
125
+ ]
126
+ },
127
+ "metadata": {},
128
+ "output_type": "display_data"
129
+ },
130
+ {
131
+ "data": {
132
+ "application/vnd.jupyter.widget-view+json": {
133
+ "model_id": "24ea098c821c4fc79ffa38b2fe5a1575",
134
+ "version_major": 2,
135
+ "version_minor": 0
136
+ },
137
+ "text/plain": [
138
+ "example_crop_still.gif: 0%| | 0.00/1.25M [00:00<?, ?B/s]"
139
+ ]
140
+ },
141
+ "metadata": {},
142
+ "output_type": "display_data"
143
+ },
144
+ {
145
+ "data": {
146
+ "application/vnd.jupyter.widget-view+json": {
147
+ "model_id": "b828fea9017846748cbe423f1b5fada7",
148
+ "version_major": 2,
149
+ "version_minor": 0
150
+ },
151
+ "text/plain": [
152
+ "example_full.gif: 0%| | 0.00/1.46M [00:00<?, ?B/s]"
153
+ ]
154
+ },
155
+ "metadata": {},
156
+ "output_type": "display_data"
157
+ },
158
+ {
159
+ "data": {
160
+ "application/vnd.jupyter.widget-view+json": {
161
+ "model_id": "a0b664fbf3f8465d9b286290e5f14d8f",
162
+ "version_major": 2,
163
+ "version_minor": 0
164
+ },
165
+ "text/plain": [
166
+ "example_full_enhanced.gif: 0%| | 0.00/5.78M [00:00<?, ?B/s]"
167
+ ]
168
+ },
169
+ "metadata": {},
170
+ "output_type": "display_data"
171
+ },
172
+ {
173
+ "data": {
174
+ "application/vnd.jupyter.widget-view+json": {
175
+ "model_id": "e7483527580845429ce33f4f987e7ddb",
176
+ "version_major": 2,
177
+ "version_minor": 0
178
+ },
179
+ "text/plain": [
180
+ "free_view_result.gif: 0%| | 0.00/5.61M [00:00<?, ?B/s]"
181
+ ]
182
+ },
183
+ "metadata": {},
184
+ "output_type": "display_data"
185
+ },
186
+ {
187
+ "data": {
188
+ "application/vnd.jupyter.widget-view+json": {
189
+ "model_id": "7662c74dc37e4e8a9e756da854c7267a",
190
+ "version_major": 2,
191
+ "version_minor": 0
192
+ },
193
+ "text/plain": [
194
+ "resize_good.gif: 0%| | 0.00/1.73M [00:00<?, ?B/s]"
195
+ ]
196
+ },
197
+ "metadata": {},
198
+ "output_type": "display_data"
199
+ },
200
+ {
201
+ "data": {
202
+ "application/vnd.jupyter.widget-view+json": {
203
+ "model_id": "0e6e3f1dbb26419c895a7fed7a7f31ac",
204
+ "version_major": 2,
205
+ "version_minor": 0
206
+ },
207
+ "text/plain": [
208
+ "resize_no.gif: 0%| | 0.00/2.14M [00:00<?, ?B/s]"
209
+ ]
210
+ },
211
+ "metadata": {},
212
+ "output_type": "display_data"
213
+ },
214
+ {
215
+ "data": {
216
+ "application/vnd.jupyter.widget-view+json": {
217
+ "model_id": "bdf7d2a9e5784350af4be3d57cc72fa4",
218
+ "version_major": 2,
219
+ "version_minor": 0
220
+ },
221
+ "text/plain": [
222
+ "using_ref_video.gif: 0%| | 0.00/8.11M [00:00<?, ?B/s]"
223
+ ]
224
+ },
225
+ "metadata": {},
226
+ "output_type": "display_data"
227
+ },
228
+ {
229
+ "data": {
230
+ "application/vnd.jupyter.widget-view+json": {
231
+ "model_id": "3348de1636bc4d85b2674eeed42d03d9",
232
+ "version_major": 2,
233
+ "version_minor": 0
234
+ },
235
+ "text/plain": [
236
+ "chinese_news.wav: 0%| | 0.00/1.54M [00:00<?, ?B/s]"
237
+ ]
238
+ },
239
+ "metadata": {},
240
+ "output_type": "display_data"
241
+ },
242
+ {
243
+ "data": {
244
+ "application/vnd.jupyter.widget-view+json": {
245
+ "model_id": "40d1dc6faf634304a13e18feab5816af",
246
+ "version_major": 2,
247
+ "version_minor": 0
248
+ },
249
+ "text/plain": [
250
+ "deyu.wav: 0%| | 0.00/2.69M [00:00<?, ?B/s]"
251
+ ]
252
+ },
253
+ "metadata": {},
254
+ "output_type": "display_data"
255
+ },
256
+ {
257
+ "data": {
258
+ "application/vnd.jupyter.widget-view+json": {
259
+ "model_id": "2c91050e17e34841ae74d4a9b414eaf7",
260
+ "version_major": 2,
261
+ "version_minor": 0
262
+ },
263
+ "text/plain": [
264
+ "eluosi.wav: 0%| | 0.00/1.79M [00:00<?, ?B/s]"
265
+ ]
266
+ },
267
+ "metadata": {},
268
+ "output_type": "display_data"
269
+ },
270
+ {
271
+ "data": {
272
+ "application/vnd.jupyter.widget-view+json": {
273
+ "model_id": "35ed59910dd04972b65bd0684dd497c1",
274
+ "version_major": 2,
275
+ "version_minor": 0
276
+ },
277
+ "text/plain": [
278
+ "fayu.wav: 0%| | 0.00/1.94M [00:00<?, ?B/s]"
279
+ ]
280
+ },
281
+ "metadata": {},
282
+ "output_type": "display_data"
283
+ },
284
+ {
285
+ "data": {
286
+ "application/vnd.jupyter.widget-view+json": {
287
+ "model_id": "6cc44214a3224b9fa952d8fdd69b262d",
288
+ "version_major": 2,
289
+ "version_minor": 0
290
+ },
291
+ "text/plain": [
292
+ "imagine.wav: 0%| | 0.00/1.62M [00:00<?, ?B/s]"
293
+ ]
294
+ },
295
+ "metadata": {},
296
+ "output_type": "display_data"
297
+ },
298
+ {
299
+ "data": {
300
+ "application/vnd.jupyter.widget-view+json": {
301
+ "model_id": "21b4c8e2efbe4205b961d849c52c0c66",
302
+ "version_major": 2,
303
+ "version_minor": 0
304
+ },
305
+ "text/plain": [
306
+ "japanese.wav: 0%| | 0.00/2.62M [00:00<?, ?B/s]"
307
+ ]
308
+ },
309
+ "metadata": {},
310
+ "output_type": "display_data"
311
+ },
312
+ {
313
+ "data": {
314
+ "application/vnd.jupyter.widget-view+json": {
315
+ "model_id": "8df2d5959a394789b9defb2d8dea9680",
316
+ "version_major": 2,
317
+ "version_minor": 0
318
+ },
319
+ "text/plain": [
320
+ "WDA_AlexandriaOcasioCortez_000.mp4: 0%| | 0.00/2.26M [00:00<?, ?B/s]"
321
+ ]
322
+ },
323
+ "metadata": {},
324
+ "output_type": "display_data"
325
+ },
326
+ {
327
+ "data": {
328
+ "application/vnd.jupyter.widget-view+json": {
329
+ "model_id": "bee85421a93345f88e1ba92bdc627a92",
330
+ "version_major": 2,
331
+ "version_minor": 0
332
+ },
333
+ "text/plain": [
334
+ "WDA_KatieHill_000.mp4: 0%| | 0.00/3.55M [00:00<?, ?B/s]"
335
+ ]
336
+ },
337
+ "metadata": {},
338
+ "output_type": "display_data"
339
+ },
340
+ {
341
+ "data": {
342
+ "application/vnd.jupyter.widget-view+json": {
343
+ "model_id": "1dfceecdadf2443bb935b58c06116ac3",
344
+ "version_major": 2,
345
+ "version_minor": 0
346
+ },
347
+ "text/plain": [
348
+ "art_16.png: 0%| | 0.00/1.48M [00:00<?, ?B/s]"
349
+ ]
350
+ },
351
+ "metadata": {},
352
+ "output_type": "display_data"
353
+ },
354
+ {
355
+ "data": {
356
+ "application/vnd.jupyter.widget-view+json": {
357
+ "model_id": "7b054b4faa49444786ac49f10bc2ca27",
358
+ "version_major": 2,
359
+ "version_minor": 0
360
+ },
361
+ "text/plain": [
362
+ "art_17.png: 0%| | 0.00/2.09M [00:00<?, ?B/s]"
363
+ ]
364
+ },
365
+ "metadata": {},
366
+ "output_type": "display_data"
367
+ },
368
+ {
369
+ "data": {
370
+ "application/vnd.jupyter.widget-view+json": {
371
+ "model_id": "78db6e2bdf3f4e8289cda18189d2f9bd",
372
+ "version_major": 2,
373
+ "version_minor": 0
374
+ },
375
+ "text/plain": [
376
+ "art_3.png: 0%| | 0.00/1.35M [00:00<?, ?B/s]"
377
+ ]
378
+ },
379
+ "metadata": {},
380
+ "output_type": "display_data"
381
+ },
382
+ {
383
+ "data": {
384
+ "application/vnd.jupyter.widget-view+json": {
385
+ "model_id": "ef5a284a239548c4964ea3a924975cbc",
386
+ "version_major": 2,
387
+ "version_minor": 0
388
+ },
389
+ "text/plain": [
390
+ "art_4.png: 0%| | 0.00/3.63M [00:00<?, ?B/s]"
391
+ ]
392
+ },
393
+ "metadata": {},
394
+ "output_type": "display_data"
395
+ },
396
+ {
397
+ "data": {
398
+ "application/vnd.jupyter.widget-view+json": {
399
+ "model_id": "fbdf097df06247c98da1a3f7b4322c92",
400
+ "version_major": 2,
401
+ "version_minor": 0
402
+ },
403
+ "text/plain": [
404
+ "art_5.png: 0%| | 0.00/1.23M [00:00<?, ?B/s]"
405
+ ]
406
+ },
407
+ "metadata": {},
408
+ "output_type": "display_data"
409
+ },
410
+ {
411
+ "data": {
412
+ "application/vnd.jupyter.widget-view+json": {
413
+ "model_id": "1099a9330eae49178d53d35827f9fa05",
414
+ "version_major": 2,
415
+ "version_minor": 0
416
+ },
417
+ "text/plain": [
418
+ "art_8.png: 0%| | 0.00/3.12M [00:00<?, ?B/s]"
419
+ ]
420
+ },
421
+ "metadata": {},
422
+ "output_type": "display_data"
423
+ },
424
+ {
425
+ "data": {
426
+ "application/vnd.jupyter.widget-view+json": {
427
+ "model_id": "f53f1a45946f4a8db6c7a48f525b8f7c",
428
+ "version_major": 2,
429
+ "version_minor": 0
430
+ },
431
+ "text/plain": [
432
+ "art_9.png: 0%| | 0.00/1.26M [00:00<?, ?B/s]"
433
+ ]
434
+ },
435
+ "metadata": {},
436
+ "output_type": "display_data"
437
+ },
438
+ {
439
+ "data": {
440
+ "application/vnd.jupyter.widget-view+json": {
441
+ "model_id": "de038d6f5aa84c63b2335af75c82e337",
442
+ "version_major": 2,
443
+ "version_minor": 0
444
+ },
445
+ "text/plain": [
446
+ "GFPGANv1.4.pth: 0%| | 0.00/349M [00:00<?, ?B/s]"
447
+ ]
448
+ },
449
+ "metadata": {},
450
+ "output_type": "display_data"
451
+ },
452
+ {
453
+ "data": {
454
+ "application/vnd.jupyter.widget-view+json": {
455
+ "model_id": "69daa05b13a745fa8a27e6447282fdff",
456
+ "version_major": 2,
457
+ "version_minor": 0
458
+ },
459
+ "text/plain": [
460
+ "alignment_WFLW_4HG.pth: 0%| | 0.00/194M [00:00<?, ?B/s]"
461
+ ]
462
+ },
463
+ "metadata": {},
464
+ "output_type": "display_data"
465
+ },
466
+ {
467
+ "data": {
468
+ "application/vnd.jupyter.widget-view+json": {
469
+ "model_id": "ee0b32bbe61647359a6e8324a092b95e",
470
+ "version_major": 2,
471
+ "version_minor": 0
472
+ },
473
+ "text/plain": [
474
+ "detection_Resnet50_Final.pth: 0%| | 0.00/109M [00:00<?, ?B/s]"
475
+ ]
476
+ },
477
+ "metadata": {},
478
+ "output_type": "display_data"
479
+ },
480
+ {
481
+ "data": {
482
+ "application/vnd.jupyter.widget-view+json": {
483
+ "model_id": "709b3e709e704234826dd1050f260688",
484
+ "version_major": 2,
485
+ "version_minor": 0
486
+ },
487
+ "text/plain": [
488
+ "parsing_parsenet.pth: 0%| | 0.00/85.3M [00:00<?, ?B/s]"
489
+ ]
490
+ },
491
+ "metadata": {},
492
+ "output_type": "display_data"
493
+ }
494
+ ],
495
+ "source": [
496
+ "api.upload_folder(\n",
497
+ " folder_path=\"/workspace/SadTalker\",\n",
498
+ " repo_id=\"kevinwang676/SadTalker\",\n",
499
+ " repo_type=\"space\",\n",
500
+ ")"
501
+ ]
502
+ },
503
+ {
504
+ "cell_type": "code",
505
+ "execution_count": null,
506
+ "id": "c15c0fad-c4ac-4fd5-b886-89d2f97bc285",
507
+ "metadata": {},
508
+ "outputs": [],
509
+ "source": []
510
+ }
511
+ ],
512
+ "metadata": {
513
+ "kernelspec": {
514
+ "display_name": "Python 3 (ipykernel)",
515
+ "language": "python",
516
+ "name": "python3"
517
+ },
518
+ "language_info": {
519
+ "codemirror_mode": {
520
+ "name": "ipython",
521
+ "version": 3
522
+ },
523
+ "file_extension": ".py",
524
+ "mimetype": "text/x-python",
525
+ "name": "python",
526
+ "nbconvert_exporter": "python",
527
+ "pygments_lexer": "ipython3",
528
+ "version": "3.10.11"
529
+ }
530
+ },
531
+ "nbformat": 4,
532
+ "nbformat_minor": 5
533
+ }
app_sadtalker.py ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os, sys
2
+ import gradio as gr
3
+ from src.gradio_demo import SadTalker
4
+
5
+
6
+ try:
7
+ import webui # in webui
8
+ in_webui = True
9
+ except:
10
+ in_webui = False
11
+
12
+
13
+ def toggle_audio_file(choice):
14
+ if choice == False:
15
+ return gr.update(visible=True), gr.update(visible=False)
16
+ else:
17
+ return gr.update(visible=False), gr.update(visible=True)
18
+
19
+ def ref_video_fn(path_of_ref_video):
20
+ if path_of_ref_video is not None:
21
+ return gr.update(value=True)
22
+ else:
23
+ return gr.update(value=False)
24
+
25
+ def sadtalker_demo(checkpoint_path='checkpoints', config_path='src/config', warpfn=None):
26
+
27
+ sad_talker = SadTalker(checkpoint_path, config_path, lazy_load=True)
28
+
29
+ with gr.Blocks(analytics_enabled=False) as sadtalker_interface:
30
+ gr.Markdown("<div align='center'> <h2> 😭 SadTalker: Learning Realistic 3D Motion Coefficients for Stylized Audio-Driven Single Image Talking Face Animation (CVPR 2023) </span> </h2> \
31
+ <a style='font-size:18px;color: #efefef' href='https://arxiv.org/abs/2211.12194'>Arxiv</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
32
+ <a style='font-size:18px;color: #efefef' href='https://sadtalker.github.io'>Homepage</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
33
+ <a style='font-size:18px;color: #efefef' href='https://github.com/Winfredy/SadTalker'> Github </div>")
34
+
35
+ with gr.Row().style(equal_height=False):
36
+ with gr.Column(variant='panel'):
37
+ with gr.Tabs(elem_id="sadtalker_source_image"):
38
+ with gr.TabItem('Upload image'):
39
+ with gr.Row():
40
+ source_image = gr.Image(label="Source image", source="upload", type="filepath", elem_id="img2img_image").style(width=512)
41
+
42
+ with gr.Tabs(elem_id="sadtalker_driven_audio"):
43
+ with gr.TabItem('Upload OR TTS'):
44
+ with gr.Column(variant='panel'):
45
+ driven_audio = gr.Audio(label="Input audio", source="upload", type="filepath")
46
+
47
+ if sys.platform != 'win32' and not in_webui:
48
+ from src.utils.text2speech import TTSTalker
49
+ tts_talker = TTSTalker()
50
+ with gr.Column(variant='panel'):
51
+ input_text = gr.Textbox(label="Generating audio from text", lines=5, placeholder="please enter some text here, we genreate the audio from text using @Coqui.ai TTS.")
52
+ tts = gr.Button('Generate audio',elem_id="sadtalker_audio_generate", variant='primary')
53
+ tts.click(fn=tts_talker.test, inputs=[input_text], outputs=[driven_audio])
54
+
55
+ with gr.Column(variant='panel'):
56
+ with gr.Tabs(elem_id="sadtalker_checkbox"):
57
+ with gr.TabItem('Settings'):
58
+ gr.Markdown("need help? please visit our [best practice page](https://github.com/OpenTalker/SadTalker/blob/main/docs/best_practice.md) for more detials")
59
+ with gr.Column(variant='panel'):
60
+ # width = gr.Slider(minimum=64, elem_id="img2img_width", maximum=2048, step=8, label="Manually Crop Width", value=512) # img2img_width
61
+ # height = gr.Slider(minimum=64, elem_id="img2img_height", maximum=2048, step=8, label="Manually Crop Height", value=512) # img2img_width
62
+ pose_style = gr.Slider(minimum=0, maximum=46, step=1, label="Pose style", value=0) #
63
+ size_of_image = gr.Radio([256, 512], value=256, label='face model resolution', info="use 256/512 model?") #
64
+ preprocess_type = gr.Radio(['crop', 'resize','full', 'extcrop', 'extfull'], value='crop', label='preprocess', info="How to handle input image?")
65
+ is_still_mode = gr.Checkbox(label="Still Mode (fewer hand motion, works with preprocess `full`)")
66
+ batch_size = gr.Slider(label="batch size in generation", step=1, maximum=10, value=2)
67
+ enhancer = gr.Checkbox(label="GFPGAN as Face enhancer")
68
+ submit = gr.Button('Generate', elem_id="sadtalker_generate", variant='primary')
69
+
70
+ with gr.Tabs(elem_id="sadtalker_genearted"):
71
+ gen_video = gr.Video(label="Generated video", format="mp4").style(width=256)
72
+
73
+ if warpfn:
74
+ submit.click(
75
+ fn=warpfn(sad_talker.test),
76
+ inputs=[source_image,
77
+ driven_audio,
78
+ preprocess_type,
79
+ is_still_mode,
80
+ enhancer,
81
+ batch_size,
82
+ size_of_image,
83
+ pose_style
84
+ ],
85
+ outputs=[gen_video]
86
+ )
87
+ else:
88
+ submit.click(
89
+ fn=sad_talker.test,
90
+ inputs=[source_image,
91
+ driven_audio,
92
+ preprocess_type,
93
+ is_still_mode,
94
+ enhancer,
95
+ batch_size,
96
+ size_of_image,
97
+ pose_style
98
+ ],
99
+ outputs=[gen_video]
100
+ )
101
+
102
+ return sadtalker_interface
103
+
104
+
105
+ if __name__ == "__main__":
106
+
107
+ demo = sadtalker_demo()
108
+ demo.queue()
109
+ demo.launch()
110
+
111
+
checkpoints/SadTalker_V0.0.2_256.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c211f5d6de003516bf1bbda9f47049a4c9c99133b1ab565c6961e5af16477bff
3
+ size 725066984
checkpoints/SadTalker_V0.0.2_512.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0e063f7ff5258240bdb0f7690783a7b1374e6a4a81ce8fa33456f4cd49694340
3
+ size 725066984
checkpoints/mapping_00109-model.pth.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84a8642468a3fcfdd9ab6be955267043116c2bec2284686a5262f1eaf017f64c
3
+ size 155779231
checkpoints/mapping_00229-model.pth.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62a1e06006cc963220f6477438518ed86e9788226c62ae382ddc42fbcefb83f1
3
+ size 155521183
cog.yaml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ build:
2
+ gpu: true
3
+ cuda: "11.3"
4
+ python_version: "3.8"
5
+ system_packages:
6
+ - "ffmpeg"
7
+ - "libgl1-mesa-glx"
8
+ - "libglib2.0-0"
9
+ python_packages:
10
+ - "torch==1.12.1"
11
+ - "torchvision==0.13.1"
12
+ - "torchaudio==0.12.1"
13
+ - "joblib==1.1.0"
14
+ - "scikit-image==0.19.3"
15
+ - "basicsr==1.4.2"
16
+ - "facexlib==0.3.0"
17
+ - "resampy==0.3.1"
18
+ - "pydub==0.25.1"
19
+ - "scipy==1.10.1"
20
+ - "kornia==0.6.8"
21
+ - "face_alignment==1.3.5"
22
+ - "imageio==2.19.3"
23
+ - "imageio-ffmpeg==0.4.7"
24
+ - "librosa==0.9.2" #
25
+ - "tqdm==4.65.0"
26
+ - "yacs==0.1.8"
27
+ - "gfpgan==1.3.8"
28
+ - "dlib-bin==19.24.1"
29
+ - "av==10.0.0"
30
+ - "trimesh==3.9.20"
31
+ run:
32
+ - mkdir -p /root/.cache/torch/hub/checkpoints/ && wget --output-document "/root/.cache/torch/hub/checkpoints/s3fd-619a316812.pth" "https://www.adrianbulat.com/downloads/python-fan/s3fd-619a316812.pth"
33
+ - mkdir -p /root/.cache/torch/hub/checkpoints/ && wget --output-document "/root/.cache/torch/hub/checkpoints/2DFAN4-cd938726ad.zip" "https://www.adrianbulat.com/downloads/python-fan/2DFAN4-cd938726ad.zip"
34
+
35
+ predict: "predict.py:Predictor"
docs/FAQ.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ## Frequency Asked Question
3
+
4
+ **Q: `ffmpeg` is not recognized as an internal or external command**
5
+
6
+ In Linux, you can install the ffmpeg via `conda install ffmpeg`. Or on Mac OS X, try to install ffmpeg via `brew install ffmpeg`. On windows, make sure you have `ffmpeg` in the `%PATH%` as suggested in [#54](https://github.com/Winfredy/SadTalker/issues/54), then, following [this](https://www.geeksforgeeks.org/how-to-install-ffmpeg-on-windows/) installation to install `ffmpeg`.
7
+
8
+ **Q: Running Requirments.**
9
+
10
+ Please refer to the discussion here: https://github.com/Winfredy/SadTalker/issues/124#issuecomment-1508113989
11
+
12
+
13
+ **Q: ModuleNotFoundError: No module named 'ai'**
14
+
15
+ please check the checkpoint's size of the `epoch_20.pth`. (https://github.com/Winfredy/SadTalker/issues/167, https://github.com/Winfredy/SadTalker/issues/113)
16
+
17
+ **Q: Illegal Hardware Error: Mac M1**
18
+
19
+ please reinstall the `dlib` by `pip install dlib` individually. (https://github.com/Winfredy/SadTalker/issues/129, https://github.com/Winfredy/SadTalker/issues/109)
20
+
21
+
22
+ **Q: FileNotFoundError: [Errno 2] No such file or directory: checkpoints\BFM_Fitting\similarity_Lm3D_all.mat**
23
+
24
+ Make sure you have downloaded the checkpoints and gfpgan as [here](https://github.com/Winfredy/SadTalker#-2-download-trained-models) and placed them in the right place.
25
+
26
+ **Q: RuntimeError: unexpected EOF, expected 237192 more bytes. The file might be corrupted.**
27
+
28
+ The files are not automatically downloaded. Please update the code and download the gfpgan folders as [here](https://github.com/Winfredy/SadTalker#-2-download-trained-models).
29
+
30
+ **Q: CUDA out of memory error**
31
+
32
+ please refer to https://stackoverflow.com/questions/73747731/runtimeerror-cuda-out-of-memory-how-setting-max-split-size-mb
33
+
34
+ ```
35
+ # windows
36
+ set PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:128
37
+ python inference.py ...
38
+
39
+ # linux
40
+ export PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:128
41
+ python inference.py ...
42
+ ```
43
+
44
+ **Q: Error while decoding stream #0:0: Invalid data found when processing input [mp3float @ 0000015037628c00] Header missing**
45
+
46
+ Our method only support wav or mp3 files as input, please make sure the feeded audios are in these formats.
docs/best_practice.md ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Best Practice and Tips for configuration
2
+
3
+ > Our model only works on REAL person's photo or the portrait image similar to REAL person. The anime talking head genreation method will be released in future.
4
+
5
+ Advanced confiurations for `inference.py`:
6
+
7
+ | Name | Configuration | default | Explaination |
8
+ |:------------- |:------------- |:----- | :------------- |
9
+ | Enhance Mode | `--enhancer` | None | Using `gfpgan` or `RestoreFormer` to enhance the generated face via face restoration network
10
+ | Background Enhancer | `--background_enhancer` | None | Using `realesrgan` to enhance the full video.
11
+ | Still Mode | ` --still` | False | Using the same pose parameters as the original image, fewer head motion.
12
+ | Expressive Mode | `--expression_scale` | 1.0 | a larger value will make the expression motion stronger.
13
+ | save path | `--result_dir` |`./results` | The file will be save in the newer location.
14
+ | preprocess | `--preprocess` | `crop` | Run and produce the results in the croped input image. Other choices: `resize`, where the images will be resized to the specific resolution. `full` Run the full image animation, use with `--still` to get better results.
15
+ | ref Mode (eye) | `--ref_eyeblink` | None | A video path, where we borrow the eyeblink from this reference video to provide more natural eyebrow movement.
16
+ | ref Mode (pose) | `--ref_pose` | None | A video path, where we borrow the pose from the head reference video.
17
+ | 3D Mode | `--face3dvis` | False | Need additional installation. More details to generate the 3d face can be founded [here](docs/face3d.md).
18
+ | free-view Mode | `--input_yaw`,<br> `--input_pitch`,<br> `--input_roll` | None | Genearting novel view or free-view 4D talking head from a single image. More details can be founded [here](https://github.com/Winfredy/SadTalker#generating-4d-free-view-talking-examples-from-audio-and-a-single-image).
19
+
20
+
21
+ ### About `--preprocess`
22
+
23
+ Our method automatically handle the input images via `crop`, `resize` and `full`.
24
+
25
+ In `crop` mode, we only generate the croped image via the facial keypoints and generated the facial anime avator. The animation of both expression and head pose are realistic.
26
+
27
+ > still mode will stop the eyeblink and head pose movement.
28
+
29
+ | [input image @bagbag1815](https://twitter.com/bagbag1815/status/1642754319094108161) | crop | crop w/still |
30
+ |:--------------------: |:--------------------: | :----: |
31
+ | <img src='../examples/source_image/full_body_2.png' width='380'> | ![full_body_2](example_crop.gif) | ![full_body_2](example_crop_still.gif) |
32
+
33
+
34
+ In `resize` mode, we resize the whole images to generate the fully talking head video. Thus, an image similar to the ID photo can be produced. ⚠️ It will produce bad results for full person images.
35
+
36
+
37
+
38
+
39
+ | <img src='../examples/source_image/full_body_2.png' width='380'> | <img src='../examples/source_image/full4.jpeg' width='380'> |
40
+ |:--------------------: |:--------------------: |
41
+ | ❌ not suitable for resize mode | ✅ good for resize mode |
42
+ | <img src='resize_no.gif'> | <img src='resize_good.gif' width='380'> |
43
+
44
+ In `full` mode, our model will automatically process the croped region and paste back to the original image. Remember to use `--still` to keep the original head pose.
45
+
46
+ | input | `--still` | `--still` & `enhancer` |
47
+ |:--------------------: |:--------------------: | :--:|
48
+ | <img src='../examples/source_image/full_body_2.png' width='380'> | <img src='./example_full.gif' width='380'> | <img src='./example_full_enhanced.gif' width='380'>
49
+
50
+
51
+ ### About `--enhancer`
52
+
53
+ For better facial quality, we intergate [gfpgan](https://github.com/TencentARC/GFPGAN) and [real-esrgan](https://github.com/xinntao/Real-ESRGAN) for different purpose. Just adding `--enhancer <gfpgan or RestoreFormer>` or `--background_enhancer <realesrgan>` for the enhancement of the face and the full image.
54
+
55
+ ```bash
56
+ # make sure above packages are available:
57
+ pip install gfpgan
58
+ pip install realesrgan
59
+ ```
60
+
61
+ ### About `--face3dvis`
62
+
63
+ This flag indicate that we can generated the 3d-rendered face and it's 3d facial landmarks. More details can be founded [here](face3d.md).
64
+
65
+ | Input | Animated 3d face |
66
+ |:-------------: | :-------------: |
67
+ | <img src='../examples/source_image/art_0.png' width='200px'> | <video src="https://user-images.githubusercontent.com/4397546/226856847-5a6a0a4d-a5ec-49e2-9b05-3206db65e8e3.mp4"></video> |
68
+
69
+ > Kindly ensure to activate the audio as the default audio playing is incompatible with GitHub.
70
+
71
+
72
+
73
+ #### reference eye-link mode.
74
+
75
+ | Input, w/ reference video , reference video |
76
+ |:-------------: |
77
+ | ![free_view](using_ref_video.gif)|
78
+ | If the reference video is shorter than the input audio, we will loop the reference video .
79
+
80
+
81
+
82
+ #### Generating 4D free-view talking examples from audio and a single image
83
+
84
+ We use `input_yaw`, `input_pitch`, `input_roll` to control head pose. For example, `--input_yaw -20 30 10` means the input head yaw degree changes from -20 to 30 and then changes from 30 to 10.
85
+ ```bash
86
+ python inference.py --driven_audio <audio.wav> \
87
+ --source_image <video.mp4 or picture.png> \
88
+ --result_dir <a file to store results> \
89
+ --input_yaw -20 30 10
90
+ ```
91
+
92
+ | Results, Free-view results, Novel view results |
93
+ |:-------------: |
94
+ | ![free_view](free_view_result.gif)|
docs/changlelog.md ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## changelogs
2
+
3
+
4
+ - __[2023.04.06]__: stable-diffiusion webui extension is release.
5
+
6
+ - __[2023.04.03]__: Enable TTS in huggingface and gradio local demo.
7
+
8
+ - __[2023.03.30]__: Launch beta version of the full body mode.
9
+
10
+ - __[2023.03.30]__: Launch new feature: through using reference videos, our algorithm can generate videos with more natural eye blinking and some eyebrow movement.
11
+
12
+ - __[2023.03.29]__: `resize mode` is online by `python infererence.py --preprocess resize`! Where we can produce a larger crop of the image as discussed in https://github.com/Winfredy/SadTalker/issues/35.
13
+
14
+ - __[2023.03.29]__: local gradio demo is online! `python app.py` to start the demo. New `requirments.txt` is used to avoid the bugs in `librosa`.
15
+
16
+ - __[2023.03.28]__: Online demo is launched in [![Hugging Face Spaces](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)](https://huggingface.co/spaces/vinthony/SadTalker), thanks AK!
17
+
18
+ - __[2023.03.22]__: Launch new feature: generating the 3d face animation from a single image. New applications about it will be updated.
19
+
20
+ - __[2023.03.22]__: Launch new feature: `still mode`, where only a small head pose will be produced via `python inference.py --still`.
21
+
22
+ - __[2023.03.18]__: Support `expression intensity`, now you can change the intensity of the generated motion: `python inference.py --expression_scale 1.3 (some value > 1)`.
23
+
24
+ - __[2023.03.18]__: Reconfig the data folders, now you can download the checkpoint automatically using `bash scripts/download_models.sh`.
25
+ - __[2023.03.18]__: We have offically integrate the [GFPGAN](https://github.com/TencentARC/GFPGAN) for face enhancement, using `python inference.py --enhancer gfpgan` for better visualization performance.
26
+ - __[2023.03.14]__: Specify the version of package `joblib` to remove the errors in using `librosa`, [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Winfredy/SadTalker/blob/main/quick_demo.ipynb) is online!
27
+ - __[2023.03.06]__: Solve some bugs in code and errors in installation
28
+ - __[2023.03.03]__: Release the test code for audio-driven single image animation!
29
+ - __[2023.02.28]__: SadTalker has been accepted by CVPR 2023!
docs/example_crop.gif ADDED

Git LFS Details

  • SHA256: da08306e3e6355928887e74057ee4221f9d877d8536341d907e29fe35e078b45
  • Pointer size: 132 Bytes
  • Size of remote file: 1.55 MB
docs/example_crop_still.gif ADDED

Git LFS Details

  • SHA256: 667c7531ed0a4d97a3ca9b15f79eea655b93dc40eda94498aa43b9e6a48c49aa
  • Pointer size: 132 Bytes
  • Size of remote file: 1.25 MB
docs/example_full.gif ADDED

Git LFS Details

  • SHA256: 2d1a2b8f5ed7b942a8625a5767828c1bc47568165a187079fbbb8492ed57301b
  • Pointer size: 132 Bytes
  • Size of remote file: 1.46 MB
docs/example_full_crop.gif ADDED
docs/example_full_enhanced.gif ADDED

Git LFS Details

  • SHA256: 906ca893e72854021c7715f784dc3fe219bbe67b73ff461e6ba8374f0d3b4712
  • Pointer size: 132 Bytes
  • Size of remote file: 5.78 MB
docs/face3d.md ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## 3D Face visualization
2
+
3
+ We use pytorch3d to visualize the produced 3d face from a single image.
4
+
5
+ Since it is not easy to install, we produce a new install guidence here:
6
+
7
+ ```bash
8
+ git clone https://github.com/Winfredy/SadTalker.git
9
+ cd SadTalker
10
+ conda create -n sadtalker3d python=3.8
11
+ source activate sadtalker3d
12
+
13
+ conda install ffmpeg
14
+ conda install -c fvcore -c iopath -c conda-forge fvcore iopath
15
+ conda install libgcc gmp
16
+
17
+ pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113
18
+
19
+ # insintall pytorch3d
20
+ pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py38_cu113_pyt1110/download.html
21
+
22
+ pip install -r requirements3d.txt
23
+
24
+ ### install gpfgan for enhancer
25
+ pip install git+https://github.com/TencentARC/GFPGAN
26
+
27
+
28
+ ### when occurs gcc version problem `from pytorch import _C` from pytorch3d, add the anaconda path to LD_LIBRARY_PATH
29
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/$YOUR_ANACONDA_PATH/lib/
30
+
31
+ ```
32
+
33
+
34
+ Then, generating the result via:
35
+
36
+ ```bash
37
+
38
+
39
+ python inference.py --driven_audio <audio.wav> \
40
+ --source_image <video.mp4 or picture.png> \
41
+ --result_dir <a file to store results> \
42
+ --face3dvis
43
+
44
+ ```
45
+
46
+ Then, the results will be given in the folders with the file name of `face3d.mp4`.
47
+
48
+ More applications about 3d face will be released.
docs/free_view_result.gif ADDED

Git LFS Details

  • SHA256: 035a7fba6800964254728f82fec47fe5c91458183e19a7506dd54d89940af40f
  • Pointer size: 132 Bytes
  • Size of remote file: 5.61 MB
docs/install.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ### Mac (Tested on M1 Mac OS 13.3)
3
+
4
+ ```
5
+ git clone https://github.com/Winfredy/SadTalker.git
6
+
7
+ cd SadTalker
8
+
9
+ conda create -n sadtalker python=3.8
10
+
11
+ conda activate sadtalker
12
+
13
+ # install pytorch 2.0
14
+ pip install torch torchvision torchaudio
15
+
16
+ conda install ffmpeg
17
+
18
+ pip install -r requirements.txt
19
+
20
+ pip install dlib # mac need to install the original dlib.
21
+
22
+ ```
23
+
24
+
25
+
26
+ ### Windows Native
27
+
28
+ - Make sure you have `ffmpeg` in the `%PATH%` as suggested in [#54](https://github.com/Winfredy/SadTalker/issues/54), following [this](https://www.geeksforgeeks.org/how-to-install-ffmpeg-on-windows/) installation to install `ffmpeg`.
29
+
30
+
31
+ ### Windows WSL
32
+ - Make sure the environment: `export LD_LIBRARY_PATH=/usr/lib/wsl/lib:$LD_LIBRARY_PATH`
33
+
34
+
35
+ ### Docker installnation
36
+
37
+ A dockerfile are also provided by [@thegenerativegeneration](https://github.com/thegenerativegeneration) in [docker hub](https://hub.docker.com/repository/docker/wawa9000/sadtalker), which can be used directly as:
38
+
39
+ ```bash
40
+ docker run --gpus "all" --rm -v $(pwd):/host_dir wawa9000/sadtalker \
41
+ --driven_audio /host_dir/deyu.wav \
42
+ --source_image /host_dir/image.jpg \
43
+ --expression_scale 1.0 \
44
+ --still \
45
+ --result_dir /host_dir
46
+ ```
47
+
docs/resize_good.gif ADDED

Git LFS Details

  • SHA256: ada6f2ea847e71c2a963882fd83f6b54193f4fe7c402f9f20698632b15bbdc0c
  • Pointer size: 132 Bytes
  • Size of remote file: 1.73 MB
docs/resize_no.gif ADDED

Git LFS Details

  • SHA256: c7702f0be5c87c8977bf3c4a73ea4d27e90d0a5a3015816abb880cfd8f75c6ac
  • Pointer size: 132 Bytes
  • Size of remote file: 2.14 MB
docs/sadtalker_logo.png ADDED
docs/using_ref_video.gif ADDED

Git LFS Details

  • SHA256: 9bb68ae077a6c009e7d30a36d34c30bf1310a073ab3c7d9cc1b5c9abe285e888
  • Pointer size: 132 Bytes
  • Size of remote file: 8.11 MB
docs/webui_extension.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ## Run SadTalker as a Stable Diffusion WebUI Extension.
3
+
4
+ 1. Installing the lastest version of [stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui) and install the sadtalker via `extension`.
5
+ <img width="726" alt="image" src="https://user-images.githubusercontent.com/4397546/230698519-267d1d1f-6e99-4dd4-81e1-7b889259efbd.png">
6
+
7
+ 2. Download the checkpoints manually, for Linux and Mac:
8
+
9
+ ```bash
10
+
11
+ cd SOMEWHERE_YOU_LIKE
12
+
13
+ bash <(wget -qO- https://raw.githubusercontent.com/Winfredy/SadTalker/main/scripts/download_models.sh)
14
+ ```
15
+
16
+ For windows, you can download all the checkpoints from [google drive](https://drive.google.com/drive/folders/1Wd88VDoLhVzYsQ30_qDVluQr_Xm46yHT?usp=sharing) or [百度云盘](https://pan.baidu.com/s/1nXuVNd0exUl37ISwWqbFGA?pwd=sadt) 提取码: sadt.
17
+
18
+ 3.1. options 1: put the checkpoint in `stable-diffusion-webui/models/SadTalker` or `stable-diffusion-webui/extensions/SadTalker/checkpoints/`, the checkpoints will be detected automatically.
19
+
20
+ 3.2. Options 2: Set the path of `SADTALKTER_CHECKPOINTS` in `webui_user.sh`(linux) or `webui_user.bat`(windows) by:
21
+
22
+ > only works if you are directly starting webui from `webui_user.sh` or `webui_user.bat`.
23
+
24
+ ```bash
25
+ # windows (webui_user.bat)
26
+ set SADTALKER_CHECKPOINTS=D:\SadTalker\checkpoints
27
+
28
+ # linux (webui_user.sh)
29
+ export SADTALKER_CHECKPOINTS=/path/to/SadTalker/checkpoints
30
+ ```
31
+
32
+ 4. Then, starting the webui via `webui.sh or webui_user.sh(linux)` or `webui_user.bat(windows)` or any other methods, the SadTalker can be used in stable-diffusion-webui directly.
33
+
34
+ <img width="726" alt="image" src="https://user-images.githubusercontent.com/4397546/230698614-58015182-2916-4240-b324-e69022ef75b3.png">
35
+
36
+ ## Questsions
37
+
38
+ 1. if you are running on CPU, you need to specific `--disable-safe-unpickle` in `webui_user.sh` or `webui_user.bat`.
39
+
40
+ ```bash
41
+ # windows (webui_user.bat)
42
+ set COMMANDLINE_ARGS="--disable-safe-unpickle"
43
+
44
+ # linux (webui_user.sh)
45
+ export COMMANDLINE_ARGS="--disable-safe-unpickle"
46
+ ```
47
+
48
+
49
+
50
+ (Some [important discussion](https://github.com/Winfredy/SadTalker/issues/78) if you are unable to use `full` mode).
examples/driven_audio/RD_Radio31_000.wav ADDED
Binary file (512 kB). View file
 
examples/driven_audio/RD_Radio34_002.wav ADDED
Binary file (512 kB). View file
 
examples/driven_audio/RD_Radio36_000.wav ADDED
Binary file (512 kB). View file
 
examples/driven_audio/RD_Radio40_000.wav ADDED
Binary file (512 kB). View file
 
examples/driven_audio/bus_chinese.wav ADDED
Binary file (652 kB). View file
 
examples/driven_audio/chinese_news.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b0f4d313a1ca671bc4831d60bcf0c12225efbffe6c0e93e54fbfe9bcd4021cb
3
+ size 1536078
examples/driven_audio/chinese_poem1.wav ADDED
Binary file (263 kB). View file
 
examples/driven_audio/chinese_poem2.wav ADDED
Binary file (461 kB). View file
 
examples/driven_audio/deyu.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba1839c57770a2ab0b593ce814344bfd4d750da02acc9be9e8cf5b9113a0f88a
3
+ size 2694784
examples/driven_audio/eluosi.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d4a3593815dc7b68c256672baa61934c9479efa770af2065fb0886f02713606e
3
+ size 1786672
examples/driven_audio/fayu.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:16ebd13626ae4171030b4ea05cceef06078483c352e4b68d469fc2a52bfffceb
3
+ size 1940428
examples/driven_audio/imagine.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2db410217e074d91ae6011e1c5dc0b94f02d05d381c50af8e54253eeacad17d2
3
+ size 1618510
examples/driven_audio/itosinger1.wav ADDED
Binary file (500 kB). View file
 
examples/driven_audio/japanese.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3db5426d0b158799e2be4f609b11f75bfbd4affffe18e9a1c8e6f241fcdedcfc
3
+ size 2622712
examples/ref_video/WDA_AlexandriaOcasioCortez_000.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a85242c3fc4d50e2202cea393b9e7ee59019759b68e78e26a254d528c22615a7
3
+ size 2257667
examples/ref_video/WDA_KatieHill_000.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1fbb4cfd64eedc49b170c441714a9c4fd5e2c2f8a11592070ad89fbd257f2817
3
+ size 3548230
examples/source_image/art_0.png ADDED
examples/source_image/art_1.png ADDED
examples/source_image/art_10.png ADDED
examples/source_image/art_11.png ADDED
examples/source_image/art_12.png ADDED
examples/source_image/art_13.png ADDED