LivePortrait
ONNX
cleardusk commited on
Commit
6d116d1
β€’
1 Parent(s): 7e898c2

chore: upload weights

Browse files
.gitattributes CHANGED
@@ -33,3 +33,11 @@ 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
+ liveportrait/retargeting_models/stitching_retargeting_module.pth filter=lfs diff=lfs merge=lfs -text
37
+ liveportrait/base_models/appearance_feature_extractor.pth filter=lfs diff=lfs merge=lfs -text
38
+ liveportrait/base_models/motion_extractor.pth filter=lfs diff=lfs merge=lfs -text
39
+ liveportrait/base_models/spade_generator.pth filter=lfs diff=lfs merge=lfs -text
40
+ liveportrait/base_models/warping_module.pth filter=lfs diff=lfs merge=lfs -text
41
+ insightface/models/buffalo_l/2d106det.onnx filter=lfs diff=lfs merge=lfs -text
42
+ insightface/models/buffalo_l/det_10g.onnx filter=lfs diff=lfs merge=lfs -text
43
+ liveportrait/landmark.onnx filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ **/__pycache__/
4
+ *.py[cod]
5
+ **/*.py[cod]
6
+ *$py.class
7
+
8
+ # Model weights
9
+ #**/*.pth
10
+ #**/*.onnx
11
+
12
+ # Ipython notebook
13
+ *.ipynb
14
+
15
+ # Temporary files or benchmark resources
16
+ animations/*
17
+ tmp/*
18
+ gradio_cached_examples/
README.md CHANGED
@@ -1,3 +1,148 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ ---
4
+
5
+ <h1 align="center">LivePortrait: Efficient Portrait Animation with Stitching and Retargeting Control</h1>
6
+
7
+ <div align='center'>
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
+
15
+ <div align='center'>
16
+ <a href='https://scholar.google.com/citations?user=P6MraaYAAAAJ' target='_blank'><strong>Pengfei Wan</strong></a><sup> 1</sup>&emsp;
17
+ <a href='https://openreview.net/profile?id=~Di_ZHANG3' target='_blank'><strong>Di Zhang</strong></a><sup> 1</sup>&emsp;
18
+ </div>
19
+
20
+ <div align='center'>
21
+ <sup>1 </sup>Kuaishou Technology&emsp; <sup>2 </sup>University of Science and Technology of China&emsp; <sup>3 </sup>Fudan University&emsp;
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>
29
+ <a href='https://huggingface.co/spaces/KwaiVGI/liveportrait'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue'></a>
30
+ </div>
31
+ <br>
32
+
33
+ <p align="center">
34
+ <img src="./assets/docs/showcase2.gif" alt="showcase">
35
+ <br>
36
+ πŸ”₯ For more results, visit our <a href="https://liveportrait.github.io/"><strong>homepage</strong></a> πŸ”₯
37
+ </p>
38
+
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).
47
+ We are actively updating and improving this repository. If you find any bugs or have suggestions, welcome to raise issues or submit pull requests (PR) πŸ’–.
48
+
49
+ ## πŸ”₯ Getting Started
50
+ ### 1. Clone the code and prepare the environment
51
+ ```bash
52
+ git clone https://github.com/KwaiVGI/LivePortrait
53
+ cd LivePortrait
54
+
55
+ # create env using conda
56
+ conda create -n LivePortrait python==3.9.18
57
+ conda activate LivePortrait
58
+ # install dependencies with pip
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
67
+ β”‚ └── models
68
+ β”‚ └── buffalo_l
69
+ β”‚ β”œβ”€β”€ 2d106det.onnx
70
+ β”‚ └── det_10g.onnx
71
+ └── liveportrait
72
+ β”œβ”€β”€ base_models
73
+ β”‚ β”œβ”€β”€ appearance_feature_extractor.pth
74
+ β”‚ β”œβ”€β”€ motion_extractor.pth
75
+ β”‚ β”œβ”€β”€ spade_generator.pth
76
+ β”‚ └── warping_module.pth
77
+ β”œβ”€β”€ landmark.onnx
78
+ └── retargeting_models
79
+ └── stitching_retargeting_module.pth
80
+ ```
81
+
82
+ ### 3. Inference πŸš€
83
+
84
+ ```bash
85
+ python inference.py
86
+ ```
87
+
88
+ If the script runs successfully, you will get an output mp4 file named `animations/s6--d0_concat.mp4`. This file includes the following results: driving video, input image, and generated result.
89
+
90
+ <p align="center">
91
+ <img src="./assets/docs/inference.gif" alt="image">
92
+ </p>
93
+
94
+ Or, you can change the input by specifying the `-s` and `-d` arguments:
95
+
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
+
119
+ ```bash
120
+ python speed.py
121
+ ```
122
+
123
+ Below are the results of inferring one frame on an RTX 4090 GPU using the native PyTorch framework with `torch.compile`:
124
+
125
+ | Model | Parameters(M) | Model Size(MB) | Inference(ms) |
126
+ |-----------------------------------|:-------------:|:--------------:|:-------------:|
127
+ | Appearance Feature Extractor | 0.84 | 3.3 | 0.82 |
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.
138
+
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
+ ```
insightface/models/buffalo_l/2d106det.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f001b856447c413801ef5c42091ed0cd516fcd21f2d6b79635b1e733a7109dbf
3
+ size 5030888
insightface/models/buffalo_l/det_10g.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5838f7fe053675b1c7a08b633df49e7af5495cee0493c7dcf6697200b85b5b91
3
+ size 16923827
liveportrait/base_models/appearance_feature_extractor.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5279bb8654293dbdf327030b397f107237dd9212fb11dd75b83dfb635211ceb5
3
+ size 3387959
liveportrait/base_models/motion_extractor.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:251e6a94ad667a1d0c69526d292677165110ef7f0cf0f6d199f0e414e8aa0ca5
3
+ size 112545506
liveportrait/base_models/spade_generator.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4780afc7909a9f84e24c01d73b31a555ef651521a1fe3b2429bd04534d992aee
3
+ size 221813590
liveportrait/base_models/warping_module.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2f61a6f265fe344f14132364859a78bdbbc2068577170693da57fb96d636e282
3
+ size 182180086
liveportrait/landmark.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:31d22a5041326c31f19b78886939a634a5aedcaa5ab8b9b951a1167595d147db
3
+ size 114666491
liveportrait/retargeting_models/stitching_retargeting_module.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3652d5a3f95099141a56986aaddec92fadf0a73c87a20fac9a2c07c32b28b611
3
+ size 2393098