cleardusk commited on
Commit
4c240bd
β€’
1 Parent(s): cbf48a6

chore: update model card

Browse files
Files changed (1) hide show
  1. README.md +75 -15
README.md CHANGED
@@ -8,7 +8,7 @@ license: mit
8
  <a href='https://github.com/cleardusk' target='_blank'><strong>Jianzhu Guo</strong></a><sup> 1†</sup>&emsp;
9
  <a href='https://github.com/KwaiVGI' target='_blank'><strong>Dingyun Zhang</strong></a><sup> 1,2</sup>&emsp;
10
  <a href='https://github.com/KwaiVGI' target='_blank'><strong>Xiaoqiang Liu</strong></a><sup> 1</sup>&emsp;
11
- <a href='https://github.com/KwaiVGI' target='_blank'><strong>Zhizhou Zhong</strong></a><sup> 1,3</sup>&emsp;
12
  <a href='https://scholar.google.com.hk/citations?user=_8k1ubAAAAAJ' target='_blank'><strong>Yuan Zhang</strong></a><sup> 1</sup>&emsp;
13
  </div>
14
 
@@ -22,7 +22,7 @@ license: mit
22
  </div>
23
 
24
  <br>
25
- <div align="center" style="display: flex; justify-content: center; flex-wrap: wrap;">
26
  <!-- <a href='LICENSE'><img src='https://img.shields.io/badge/license-MIT-yellow'></a> -->
27
  <a href='https://arxiv.org/pdf/2407.03168'><img src='https://img.shields.io/badge/arXiv-LivePortrait-red'></a>
28
  <a href='https://liveportrait.github.io'><img src='https://img.shields.io/badge/Project-LivePortrait-green'></a>
@@ -39,8 +39,12 @@ license: mit
39
 
40
 
41
  ## πŸ”₯ Updates
42
- - **`2024/07/04`**: πŸ”₯ We released the initial version of the inference code and models. Continuous updates, stay tuned!
43
- - **`2024/07/04`**: 😊 We released the [homepage](https://liveportrait.github.io) and technical report on [arXiv](https://arxiv.org/pdf/2407.03168).
 
 
 
 
44
 
45
  ## Introduction
46
  This repo, named **LivePortrait**, contains the official PyTorch implementation of our paper [LivePortrait: Efficient Portrait Animation with Stitching and Retargeting Control](https://arxiv.org/pdf/2407.03168).
@@ -59,8 +63,19 @@ conda activate LivePortrait
59
  pip install -r requirements.txt
60
  ```
61
 
 
 
62
  ### 2. Download pretrained weights
63
- Download our pretrained LivePortrait weights and face detection models of InsightFace from [Google Drive](https://drive.google.com/drive/folders/1UtKgzKjFAOmZkhNK-OYT0caJ_w2XAnib) or [Baidu Yun](https://pan.baidu.com/s/1MGctWmNla_vZxDbEp2Dtzw?pwd=z5cn). We have packed all weights in one directory 😊. Unzip and place them in `./pretrained_weights` ensuring the directory structure is as follows:
 
 
 
 
 
 
 
 
 
64
  ```text
65
  pretrained_weights
66
  β”œβ”€β”€ insightface
@@ -81,6 +96,7 @@ pretrained_weights
81
 
82
  ### 3. Inference πŸš€
83
 
 
84
  ```bash
85
  python inference.py
86
  ```
@@ -96,23 +112,55 @@ Or, you can change the input by specifying the `-s` and `-d` arguments:
96
  ```bash
97
  python inference.py -s assets/examples/source/s9.jpg -d assets/examples/driving/d0.mp4
98
 
99
- # or disable pasting back
100
  python inference.py -s assets/examples/source/s9.jpg -d assets/examples/driving/d0.mp4 --no_flag_pasteback
101
 
102
  # more options to see
103
  python inference.py -h
104
  ```
105
 
106
- **More interesting results can be found in our [Homepage](https://liveportrait.github.io)** 😊
 
 
 
 
 
 
107
 
108
- ### 4. Gradio interface
 
 
 
109
 
110
- We also provide a Gradio interface for a better experience, just run by:
 
 
 
 
 
 
 
 
 
 
 
 
111
 
112
  ```bash
113
  python app.py
114
  ```
115
 
 
 
 
 
 
 
 
 
 
 
 
116
  ### 5. Inference speed evaluation πŸš€πŸš€πŸš€
117
  We have also provided a script to evaluate the inference speed of each module:
118
 
@@ -128,10 +176,22 @@ Below are the results of inferring one frame on an RTX 4090 GPU using the native
128
  | Motion Extractor | 28.12 | 108 | 0.84 |
129
  | Spade Generator | 55.37 | 212 | 7.59 |
130
  | Warping Module | 45.53 | 174 | 5.21 |
131
- | Stitching and Retargeting Modules| 0.23 | 2.3 | 0.31 |
 
 
 
 
 
 
132
 
133
- *Note: the listed values of Stitching and Retargeting Modules represent the combined parameter counts and the total sequential inference time of three MLP networks.*
 
 
 
 
 
134
 
 
135
 
136
  ## Acknowledgements
137
  We would like to thank the contributors of [FOMM](https://github.com/AliaksandrSiarohin/first-order-model), [Open Facevid2vid](https://github.com/zhanglonghao1992/One-Shot_Free-View_Neural_Talking_Head_Synthesis), [SPADE](https://github.com/NVlabs/SPADE), [InsightFace](https://github.com/deepinsight/insightface) repositories, for their open research and contributions.
@@ -139,10 +199,10 @@ We would like to thank the contributors of [FOMM](https://github.com/AliaksandrS
139
  ## Citation πŸ’–
140
  If you find LivePortrait useful for your research, welcome to 🌟 this repo and cite our work using the following BibTeX:
141
  ```bibtex
142
- @article{guo2024live,
143
  title = {LivePortrait: Efficient Portrait Animation with Stitching and Retargeting Control},
144
- author = {Jianzhu Guo and Dingyun Zhang and Xiaoqiang Liu and Zhizhou Zhong and Yuan Zhang and Pengfei Wan and Di Zhang},
145
- year = {2024},
146
- journal = {arXiv preprint:2407.03168},
147
  }
148
  ```
 
8
  <a href='https://github.com/cleardusk' target='_blank'><strong>Jianzhu Guo</strong></a><sup> 1†</sup>&emsp;
9
  <a href='https://github.com/KwaiVGI' target='_blank'><strong>Dingyun Zhang</strong></a><sup> 1,2</sup>&emsp;
10
  <a href='https://github.com/KwaiVGI' target='_blank'><strong>Xiaoqiang Liu</strong></a><sup> 1</sup>&emsp;
11
+ <a href='https://scholar.google.com/citations?user=t88nyvsAAAAJ&hl' target='_blank'><strong>Zhizhou Zhong</strong></a><sup> 1,3</sup>&emsp;
12
  <a href='https://scholar.google.com.hk/citations?user=_8k1ubAAAAAJ' target='_blank'><strong>Yuan Zhang</strong></a><sup> 1</sup>&emsp;
13
  </div>
14
 
 
22
  </div>
23
 
24
  <br>
25
+ <div align="center">
26
  <!-- <a href='LICENSE'><img src='https://img.shields.io/badge/license-MIT-yellow'></a> -->
27
  <a href='https://arxiv.org/pdf/2407.03168'><img src='https://img.shields.io/badge/arXiv-LivePortrait-red'></a>
28
  <a href='https://liveportrait.github.io'><img src='https://img.shields.io/badge/Project-LivePortrait-green'></a>
 
39
 
40
 
41
  ## πŸ”₯ Updates
42
+ - **`2024/07/10`**: πŸ’ͺ We support audio and video concatenating, driving video auto-cropping, and template making to protect privacy. More to see [here](docs/changelog/2024-07-10.md).
43
+ - **`2024/07/09`**: πŸ€— We released the [HuggingFace Space](https://huggingface.co/spaces/KwaiVGI/liveportrait), thanks to the HF team and [Gradio](https://github.com/gradio-app/gradio)!
44
+ - **`2024/07/04`**: 😊 We released the initial version of the inference code and models. Continuous updates, stay tuned!
45
+ - **`2024/07/04`**: πŸ”₯ We released the [homepage](https://liveportrait.github.io) and technical report on [arXiv](https://arxiv.org/pdf/2407.03168).
46
+
47
+
48
 
49
  ## Introduction
50
  This repo, named **LivePortrait**, contains the official PyTorch implementation of our paper [LivePortrait: Efficient Portrait Animation with Stitching and Retargeting Control](https://arxiv.org/pdf/2407.03168).
 
63
  pip install -r requirements.txt
64
  ```
65
 
66
+ **Note:** make sure your system has [FFmpeg](https://ffmpeg.org/) installed!
67
+
68
  ### 2. Download pretrained weights
69
+
70
+ The easiest way to download the pretrained weights is from HuggingFace:
71
+ ```bash
72
+ # you may need to run `git lfs install` first
73
+ git clone https://huggingface.co/KwaiVGI/liveportrait pretrained_weights
74
+ ```
75
+
76
+ Alternatively, you can download all pretrained weights from [Google Drive](https://drive.google.com/drive/folders/1UtKgzKjFAOmZkhNK-OYT0caJ_w2XAnib) or [Baidu Yun](https://pan.baidu.com/s/1MGctWmNla_vZxDbEp2Dtzw?pwd=z5cn). Unzip and place them in `./pretrained_weights`.
77
+
78
+ Ensuring the directory structure is as follows, or contains:
79
  ```text
80
  pretrained_weights
81
  β”œβ”€β”€ insightface
 
96
 
97
  ### 3. Inference πŸš€
98
 
99
+ #### Fast hands-on
100
  ```bash
101
  python inference.py
102
  ```
 
112
  ```bash
113
  python inference.py -s assets/examples/source/s9.jpg -d assets/examples/driving/d0.mp4
114
 
115
+ # disable pasting back to run faster
116
  python inference.py -s assets/examples/source/s9.jpg -d assets/examples/driving/d0.mp4 --no_flag_pasteback
117
 
118
  # more options to see
119
  python inference.py -h
120
  ```
121
 
122
+ #### Driving video auto-cropping
123
+
124
+ πŸ“• To use your own driving video, we **recommend**:
125
+ - Crop it to a **1:1** aspect ratio (e.g., 512x512 or 256x256 pixels), or enable auto-cropping by `--flag_crop_driving_video`.
126
+ - Focus on the head area, similar to the example videos.
127
+ - Minimize shoulder movement.
128
+ - Make sure the first frame of driving video is a frontal face with **neutral expression**.
129
 
130
+ Below is a auto-cropping case by `--flag_crop_driving_video`:
131
+ ```bash
132
+ python inference.py -s assets/examples/source/s9.jpg -d assets/examples/driving/d13.mp4 --flag_crop_driving_video
133
+ ```
134
 
135
+ If you find the results of auto-cropping is not well, you can modify the `--scale_crop_video`, `--vy_ratio_crop_video` options to adjust the scale and offset, or do it manually.
136
+
137
+ #### Motion template making
138
+ You can also use the auto-generated motion template files ending with `.pkl` to speed up inference, and **protect privacy**, such as:
139
+ ```bash
140
+ python inference.py -s assets/examples/source/s9.jpg -d assets/examples/driving/d5.pkl
141
+ ```
142
+
143
+ **Discover more interesting results on our [Homepage](https://liveportrait.github.io)** 😊
144
+
145
+ ### 4. Gradio interface πŸ€—
146
+
147
+ We also provide a Gradio <a href='https://github.com/gradio-app/gradio'><img src='https://img.shields.io/github/stars/gradio-app/gradio'></a> interface for a better experience, just run by:
148
 
149
  ```bash
150
  python app.py
151
  ```
152
 
153
+ You can specify the `--server_port`, `--share`, `--server_name` arguments to satisfy your needs!
154
+
155
+ πŸš€ We also provide an acceleration option `--flag_do_torch_compile`. The first-time inference triggers an optimization process (about one minute), making subsequent inferences 20-30% faster. Performance gains may vary with different CUDA versions.
156
+ ```bash
157
+ # enable torch.compile for faster inference
158
+ python app.py --flag_do_torch_compile
159
+ ```
160
+ **Note**: This method has not been fully tested. e.g., on Windows.
161
+
162
+ **Or, try it out effortlessly on [HuggingFace](https://huggingface.co/spaces/KwaiVGI/LivePortrait) πŸ€—**
163
+
164
  ### 5. Inference speed evaluation πŸš€πŸš€πŸš€
165
  We have also provided a script to evaluate the inference speed of each module:
166
 
 
176
  | Motion Extractor | 28.12 | 108 | 0.84 |
177
  | Spade Generator | 55.37 | 212 | 7.59 |
178
  | Warping Module | 45.53 | 174 | 5.21 |
179
+ | Stitching and Retargeting Modules | 0.23 | 2.3 | 0.31 |
180
+
181
+ *Note: The values for the Stitching and Retargeting Modules represent the combined parameter counts and total inference time of three sequential MLP networks.*
182
+
183
+ ## Community Resources πŸ€—
184
+
185
+ Discover the invaluable resources contributed by our community to enhance your LivePortrait experience:
186
 
187
+ - [ComfyUI-LivePortraitKJ](https://github.com/kijai/ComfyUI-LivePortraitKJ) by [@kijai](https://github.com/kijai)
188
+ - [comfyui-liveportrait](https://github.com/shadowcz007/comfyui-liveportrait) by [@shadowcz007](https://github.com/shadowcz007)
189
+ - [LivePortrait hands-on tutorial](https://www.youtube.com/watch?v=uyjSTAOY7yI) by [@AI Search](https://www.youtube.com/@theAIsearch)
190
+ - [ComfyUI tutorial](https://www.youtube.com/watch?v=8-IcDDmiUMM) by [@Sebastian Kamph](https://www.youtube.com/@sebastiankamph)
191
+ - [LivePortrait In ComfyUI](https://www.youtube.com/watch?v=aFcS31OWMjE) by [@Benji](https://www.youtube.com/@TheFutureThinker)
192
+ - [Replicate Playground](https://replicate.com/fofr/live-portrait) and [cog-comfyui](https://github.com/fofr/cog-comfyui) by [@fofr](https://github.com/fofr)
193
 
194
+ And many more amazing contributions from our community!
195
 
196
  ## Acknowledgements
197
  We would like to thank the contributors of [FOMM](https://github.com/AliaksandrSiarohin/first-order-model), [Open Facevid2vid](https://github.com/zhanglonghao1992/One-Shot_Free-View_Neural_Talking_Head_Synthesis), [SPADE](https://github.com/NVlabs/SPADE), [InsightFace](https://github.com/deepinsight/insightface) repositories, for their open research and contributions.
 
199
  ## Citation πŸ’–
200
  If you find LivePortrait useful for your research, welcome to 🌟 this repo and cite our work using the following BibTeX:
201
  ```bibtex
202
+ @article{guo2024liveportrait,
203
  title = {LivePortrait: Efficient Portrait Animation with Stitching and Retargeting Control},
204
+ author = {Guo, Jianzhu and Zhang, Dingyun and Liu, Xiaoqiang and Zhong, Zhizhou and Zhang, Yuan and Wan, Pengfei and Zhang, Di},
205
+ journal = {arXiv preprint arXiv:2407.03168},
206
+ year = {2024}
207
  }
208
  ```