ganeshblank commited on
Commit
30f37fa
β€’
1 Parent(s): dd6463f
This view is limited to 50 files because it contains too many changes. Β  See raw diff
Files changed (50) hide show
  1. .gitattributes +9 -0
  2. assets/.gitignore +2 -0
  3. assets/docs/changelog/2024-07-10.md +22 -0
  4. assets/docs/inference.gif +0 -0
  5. assets/docs/showcase.gif +3 -0
  6. assets/docs/showcase2.gif +3 -0
  7. assets/examples/driving/d0.mp4 +3 -0
  8. assets/examples/driving/d0.pkl +3 -0
  9. assets/examples/driving/d1.pkl +3 -0
  10. assets/examples/driving/d10.mp4 +3 -0
  11. assets/examples/driving/d10.pkl +3 -0
  12. assets/examples/driving/d11.mp4 +0 -0
  13. assets/examples/driving/d11.pkl +3 -0
  14. assets/examples/driving/d12.mp4 +0 -0
  15. assets/examples/driving/d12.pkl +3 -0
  16. assets/examples/driving/d13.mp4 +3 -0
  17. assets/examples/driving/d14.mp4 +0 -0
  18. assets/examples/driving/d18.mp4 +0 -0
  19. assets/examples/driving/d19.mp4 +0 -0
  20. assets/examples/driving/d2.pkl +3 -0
  21. assets/examples/driving/d3.mp4 +3 -0
  22. assets/examples/driving/d3.pkl +3 -0
  23. assets/examples/driving/d5.pkl +3 -0
  24. assets/examples/driving/d6.mp4 +3 -0
  25. assets/examples/driving/d6.pkl +3 -0
  26. assets/examples/driving/d7.pkl +3 -0
  27. assets/examples/driving/d8.pkl +3 -0
  28. assets/examples/driving/d9.mp4 +3 -0
  29. assets/examples/driving/d9.pkl +3 -0
  30. assets/examples/source/s0.jpg +0 -0
  31. assets/examples/source/s1.jpg +0 -0
  32. assets/examples/source/s10.jpg +0 -0
  33. assets/examples/source/s11.jpg +0 -0
  34. assets/examples/source/s12.jpg +0 -0
  35. assets/examples/source/s2.jpg +0 -0
  36. assets/examples/source/s3.jpg +0 -0
  37. assets/examples/source/s4.jpg +0 -0
  38. assets/examples/source/s5.jpg +0 -0
  39. assets/examples/source/s6.jpg +0 -0
  40. assets/examples/source/s7.jpg +0 -0
  41. assets/examples/source/s8.jpg +0 -0
  42. assets/examples/source/s9.jpg +0 -0
  43. assets/gradio_description_animation.md +16 -0
  44. assets/gradio_description_retargeting.md +4 -0
  45. assets/gradio_description_upload.md +2 -0
  46. assets/gradio_title.md +11 -0
  47. pretrained_weights/.gitattributes +45 -0
  48. pretrained_weights/.gitignore +18 -0
  49. pretrained_weights/.gitkeep +0 -0
  50. pretrained_weights/README.md +148 -0
.gitattributes CHANGED
@@ -33,3 +33,12 @@ 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
+ assets/docs/showcase.gif filter=lfs diff=lfs merge=lfs -text
37
+ assets/docs/showcase2.gif filter=lfs diff=lfs merge=lfs -text
38
+ assets/examples/driving/d0.mp4 filter=lfs diff=lfs merge=lfs -text
39
+ assets/examples/driving/d10.mp4 filter=lfs diff=lfs merge=lfs -text
40
+ assets/examples/driving/d13.mp4 filter=lfs diff=lfs merge=lfs -text
41
+ assets/examples/driving/d3.mp4 filter=lfs diff=lfs merge=lfs -text
42
+ assets/examples/driving/d6.mp4 filter=lfs diff=lfs merge=lfs -text
43
+ assets/examples/driving/d9.mp4 filter=lfs diff=lfs merge=lfs -text
44
+ pretrained_weights/docs/showcase2.gif filter=lfs diff=lfs merge=lfs -text
assets/.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ examples/driving/*.pkl
2
+ examples/driving/*_crop.mp4
assets/docs/changelog/2024-07-10.md ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## 2024/07/10
2
+
3
+ **First, thank you all for your attention, support, sharing, and contributions to LivePortrait!** ❀️
4
+ The popularity of LivePortrait has exceeded our expectations. If you encounter any issues or other problems and we do not respond promptly, please accept our apologies. We are still actively updating and improving this repository.
5
+
6
+ ### Updates
7
+
8
+ - <strong>Audio and video concatenating: </strong> If the driving video contains audio, it will automatically be included in the generated video. Additionally, the generated video will maintain the same FPS as the driving video. If you run LivePortrait on Windows, you need to install `ffprobe` and `ffmpeg` exe, see issue [#94](https://github.com/KwaiVGI/LivePortrait/issues/94).
9
+
10
+ - <strong>Driving video auto-cropping: </strong> Implemented automatic cropping for driving videos by tracking facial landmarks and calculating a global cropping box with a 1:1 aspect ratio. Alternatively, you can crop using video editing software or other tools to achieve a 1:1 ratio. Auto-cropping is not enbaled by default, you can specify it by `--flag_crop_driving_video`.
11
+
12
+ - <strong>Template making: </strong> Added the ability to create templates to protect privacy. The template is a `.pkl` file that only contains the motions of the driving video. Theoretically, it is impossible to reconstruct the original face from the template. These templates can be used to generate videos without needing the original driving video. By default, the template will be generated and saved as a .pkl file with the same name as the driving video. Once generated, you can specify it using the `-d` or `--driving_info` option.
13
+
14
+
15
+ ### About driving video
16
+
17
+ - For a guide on using your own driving video, see the [driving video auto-cropping](https://github.com/KwaiVGI/LivePortrait/tree/main?tab=readme-ov-file#driving-video-auto-cropping) section.
18
+
19
+
20
+ ### Others
21
+
22
+ - If you encounter a black box problem, disable half-precision inference by using `--no_flag_use_half_precision`, reported by issue [#40](https://github.com/KwaiVGI/LivePortrait/issues/40), [#48](https://github.com/KwaiVGI/LivePortrait/issues/48), [#62](https://github.com/KwaiVGI/LivePortrait/issues/62).
assets/docs/inference.gif ADDED
assets/docs/showcase.gif ADDED

Git LFS Details

  • SHA256: 7bca5f38bfd555bf7c013312d87883afdf39d97fba719ac171c60f897af49e21
  • Pointer size: 132 Bytes
  • Size of remote file: 6.62 MB
assets/docs/showcase2.gif ADDED

Git LFS Details

  • SHA256: eb1fffb139681775780b2956e7d0289f55d199c1a3e14ab263887864d4b0d586
  • Pointer size: 132 Bytes
  • Size of remote file: 2.88 MB
assets/examples/driving/d0.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:63f6f9962e1fdf6e6722172e7a18155204858d5d5ce3b1e0646c150360c33bed
3
+ size 2958395
assets/examples/driving/d0.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e68ccd7d726efada2f9479940c96f11d7e988e68e60b58e7cba69ec21db769a0
3
+ size 41087
assets/examples/driving/d1.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:16b47d68396e4a5fc0756b4c83827e8fc27c08bc92be1aa04809f741d9db95f9
3
+ size 8599
assets/examples/driving/d10.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac7ee3c2419046f11dc230b6db33c2391a98334eba2b1d773e7eb9627992622f
3
+ size 1064930
assets/examples/driving/d10.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:82b6bca311c3e1eaf3a0708cb369a9c56b398b4783e61455bbe28c88a5520418
3
+ size 234995
assets/examples/driving/d11.mp4 ADDED
Binary file (469 kB). View file
 
assets/examples/driving/d11.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4b9bbd523d03ba8cc8c6b560bb236be111fe40e59a9bccba3fadbae73010ad29
3
+ size 118124
assets/examples/driving/d12.mp4 ADDED
Binary file (596 kB). View file
 
assets/examples/driving/d12.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dd7ebf491c9b36cb6fe55c18201ddc25f69131c25c9f158076e40a1e0c83ac95
3
+ size 96116
assets/examples/driving/d13.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d03e39c28323cde1c5fc6c5629aa83fe6c834fa7c9ed2dac969e1247eaafdb60
3
+ size 2475854
assets/examples/driving/d14.mp4 ADDED
Binary file (891 kB). View file
 
assets/examples/driving/d18.mp4 ADDED
Binary file (187 kB). View file
 
assets/examples/driving/d19.mp4 ADDED
Binary file (233 kB). View file
 
assets/examples/driving/d2.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:021a0e83d4ae81ab75b49b31a6cf75ac7987c86e02808aced3dd49894512a082
3
+ size 8599
assets/examples/driving/d3.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ef5c86e49b1b43dcb1449b499eb5a7f0cbae2f78aec08b5598193be1e4257099
3
+ size 1430968
assets/examples/driving/d3.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4f51d50dfd8ca5f5154ae8d40d676308970c68720c99d3cd58a62d5d4cf53002
3
+ size 185730
assets/examples/driving/d5.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:91f2863838a089fe418b22864e7c48ac1f2b9d4513afb033a9d9dd5979a90b8c
3
+ size 77776
assets/examples/driving/d6.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00e3ea79bbf28cbdc4fbb67ec655d9a0fe876e880ec45af55ae481348d0c0fff
3
+ size 1967790
assets/examples/driving/d6.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1dac86504addf300e0b3dc3faa209099f9f1a40e659794ea7031df4f29787113
3
+ size 528486
assets/examples/driving/d7.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84aed70f3dd01ebd818c51fc11762eeff51efeef05b1f15a660b105c4c0748da
3
+ size 93496
assets/examples/driving/d8.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:099afc34d40794aa733644af76dcd1bc387573c381a82340018df7019a06d68e
3
+ size 144334
assets/examples/driving/d9.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9a414aa1d547be35306d692065a2157434bf40a6025ba8e30ce12e5bb322cc33
3
+ size 2257929
assets/examples/driving/d9.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8d2b938526b64c6658f2b1c5776f3f98d3190bb74f2c8ee0891f73ea14cef8a0
3
+ size 307840
assets/examples/source/s0.jpg ADDED
assets/examples/source/s1.jpg ADDED
assets/examples/source/s10.jpg ADDED
assets/examples/source/s11.jpg ADDED
assets/examples/source/s12.jpg ADDED
assets/examples/source/s2.jpg ADDED
assets/examples/source/s3.jpg ADDED
assets/examples/source/s4.jpg ADDED
assets/examples/source/s5.jpg ADDED
assets/examples/source/s6.jpg ADDED
assets/examples/source/s7.jpg ADDED
assets/examples/source/s8.jpg ADDED
assets/examples/source/s9.jpg ADDED
assets/gradio_description_animation.md ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <span style="font-size: 1.2em;">πŸ”₯ To animate the source portrait with the driving video, please follow these steps:</span>
2
+ <div style="font-size: 1.2em; margin-left: 20px;">
3
+ 1. In the <strong>Animation Options</strong> section, we recommend enabling the <strong>do crop (source)</strong> option if faces occupy a small portion of your image.
4
+ </div>
5
+ <div style="font-size: 1.2em; margin-left: 20px;">
6
+ 2. Press the <strong>πŸš€ Animate</strong> button and wait for a moment. Your animated video will appear in the result block. This may take a few moments.
7
+ </div>
8
+ <div style="font-size: 1.2em; margin-left: 20px;">
9
+ 3. If you want to upload your own driving video, <strong>the best practice</strong>:
10
+
11
+ - Crop it to a 1:1 aspect ratio (e.g., 512x512 or 256x256 pixels), or enable auto-driving by checking `do crop (driving video)`.
12
+ - Focus on the head area, similar to the example videos.
13
+ - Minimize shoulder movement.
14
+ - Make sure the first frame of driving video is a frontal face with **neutral expression**.
15
+
16
+ </div>
assets/gradio_description_retargeting.md ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <br>
2
+
3
+ ## Retargeting
4
+ <span style="font-size: 1.2em;">πŸ”₯ To edit the eyes and lip open ratio of the source portrait, drag the sliders and click the <strong>πŸš— Retargeting</strong> button. You can try running it multiple times. <strong>😊 Set both ratios to 0.8 to see what's going on!</strong> </span>
assets/gradio_description_upload.md ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ ## πŸ€— This is the gradio demo for **LivePortrait** for video.
2
+ <div style="font-size: 1.2em;">Please upload or use a webcam to get a <strong>Source Portrait</strong> (any aspect ratio) and upload a <strong>Driving Video</strong> (1:1 aspect ratio, or any aspect ratio with <code>do crop (driving video)</code> checked).</div>
assets/gradio_title.md ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div style="display: flex; justify-content: center; align-items: center; text-align: center;">
2
+ <div>
3
+ <h1>LivePortrait: Efficient Portrait Animation with Stitching and Retargeting Control</h1>
4
+ <div style="display: flex; justify-content: center; align-items: center; text-align: center;>
5
+ <a href="https://arxiv.org/pdf/2407.03168"><img src="https://img.shields.io/badge/arXiv-2407.03168-red"></a>
6
+ <a href="https://liveportrait.github.io"><img src="https://img.shields.io/badge/Project_Page-LivePortrait-green" alt="Project Page"></a>
7
+ <a href="https://github.com/KwaiVGI/LivePortrait"><img src="https://img.shields.io/badge/Github-Code-blue"></a>
8
+ <a href='https://huggingface.co/spaces/KwaiVGI/liveportrait'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue'></a>
9
+ </div>
10
+ </div>
11
+ </div>
pretrained_weights/.gitattributes ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz 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
44
+ docs/inference.gif filter=lfs diff=lfs merge=lfs -text
45
+ docs/showcase2.gif filter=lfs diff=lfs merge=lfs -text
pretrained_weights/.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/
pretrained_weights/.gitkeep ADDED
File without changes
pretrained_weights/README.md ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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" 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>
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="./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="./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
+ ```