Giter VIP home page Giter VIP logo

liveportrait's Introduction

LivePortrait: Efficient Portrait Animation with Stitching and Retargeting Control

Pengfei Wan 1Di Zhang 1
1 Kuaishou Technology  2 University of Science and Technology of China  3 Fudan University 
Corresponding author


showcase
🔥 For more results, visit our homepage 🔥

🔥 Updates

  • 2024/08/06: 🎨 We support precise portrait editing in the Gradio interface, insipred by ComfyUI-AdvancedLivePortrait. See here.
  • 2024/08/05: 📦 Windows users can now download the one-click installer for Humans mode and Animals mode now! For details, see here.
  • 2024/08/02: 😸 We released a version of the Animals model, along with several other updates and improvements. Check out the details here!
  • 2024/07/25: 📦 Windows users can now download the package from HuggingFace or BaiduYun. Simply unzip and double-click run_windows.bat to enjoy!
  • 2024/07/24: 🎨 We support pose editing for source portraits in the Gradio interface. We’ve also lowered the default detection threshold to increase recall. Have fun!
  • 2024/07/19: ✨ We support 🎞️ portrait video editing (aka v2v)! More to see here.
  • 2024/07/17: 🍎 We support macOS with Apple Silicon, modified from jeethu's PR #143.
  • 2024/07/10: 💪 We support audio and video concatenating, driving video auto-cropping, and template making to protect privacy. More to see here.
  • 2024/07/09: 🤗 We released the HuggingFace Space, thanks to the HF team and Gradio!
  • 2024/07/04: 😊 We released the initial version of the inference code and models. Continuous updates, stay tuned!
  • 2024/07/04: 🔥 We released the homepage and technical report on arXiv.

Introduction 📖

This repo, named LivePortrait, contains the official PyTorch implementation of our paper LivePortrait: Efficient Portrait Animation with Stitching and Retargeting Control. 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) 💖.

Getting Started 🏁

1. Clone the code and prepare the environment 🛠️

Note

Make sure your system has git, conda, and FFmpeg installed. For details on FFmpeg installation, see how to install FFmpeg.

git clone https://github.com/KwaiVGI/LivePortrait
cd LivePortrait

# create env using conda
conda create -n LivePortrait python=3.9
conda activate LivePortrait

For Linux or Windows Users

X-Pose requires your torch version to be compatible with the CUDA version.

Firstly, check your current CUDA version by:

nvcc -V # example versions: 11.1, 11.8, 12.1, etc.

Then, install the corresponding torch version. Here are examples for different CUDA versions. Visit the PyTorch Official Website for installation commands if your CUDA version is not listed:

# for CUDA 11.1
pip install torch==1.10.1+cu111 torchvision==0.11.2 torchaudio==0.10.1 -f https://download.pytorch.org/whl/cu111/torch_stable.html
# for CUDA 11.8
pip install torch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 --index-url https://download.pytorch.org/whl/cu118
# for CUDA 12.1
pip install torch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 --index-url https://download.pytorch.org/whl/cu121
# ...

Finally, install the remaining dependencies:

pip install -r requirements.txt

For macOS with Apple Silicon Users

The X-Pose dependency does not support macOS, so you can skip its installation. While Humans mode works as usual, Animals mode is not supported. Use the provided requirements file for macOS with Apple Silicon:

# for macOS with Apple Silicon users
pip install -r requirements_macOS.txt

2. Download pretrained weights 📥

The easiest way to download the pretrained weights is from HuggingFace:

# !pip install -U "huggingface_hub[cli]"
huggingface-cli download KwaiVGI/LivePortrait --local-dir pretrained_weights --exclude "*.git*" "README.md" "docs"

If you cannot access to Huggingface, you can use hf-mirror to download:

# !pip install -U "huggingface_hub[cli]"
export HF_ENDPOINT=https://hf-mirror.com
huggingface-cli download KwaiVGI/LivePortrait --local-dir pretrained_weights --exclude "*.git*" "README.md" "docs"

Alternatively, you can download all pretrained weights from Google Drive or Baidu Yun (WIP). Unzip and place them in ./pretrained_weights.

Ensuring the directory structure is as or contains this.

3. Inference 🚀

Fast hands-on (humans) 👤

# For Linux and Windows users
python inference.py

# For macOS users with Apple Silicon (Intel is not tested). NOTE: this maybe 20x slower than RTX 4090
PYTORCH_ENABLE_MPS_FALLBACK=1 python inference.py

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 or video, and generated result.

image

Or, you can change the input by specifying the -s and -d arguments:

# source input is an image
python inference.py -s assets/examples/source/s9.jpg -d assets/examples/driving/d0.mp4

# source input is a video ✨
python inference.py -s assets/examples/source/s13.mp4 -d assets/examples/driving/d0.mp4

# more options to see
python inference.py -h

Fast hands-on (animals) 🐱🐶

Animals mode is ONLY tested on Linux and Windows with NVIDIA GPU.

You need to build an OP named MultiScaleDeformableAttention first, which is used by X-Pose, a general keypoint detection framework.

cd src/utils/dependencies/XPose/models/UniPose/ops
python setup.py build install
cd - # equal to cd ../../../../../../../

Then

python inference_animals.py -s assets/examples/source/s39.jpg -d assets/examples/driving/wink.pkl --driving_multiplier 1.75 --no_flag_stitching

If the script runs successfully, you will get an output mp4 file named animations/s39--wink_concat.mp4.

image

Driving video auto-cropping 📢📢📢

Important

To use your own driving video, we recommend: ⬇️

  • Crop it to a 1:1 aspect ratio (e.g., 512x512 or 256x256 pixels), or enable auto-cropping by --flag_crop_driving_video.
  • Focus on the head area, similar to the example videos.
  • Minimize shoulder movement.
  • Make sure the first frame of driving video is a frontal face with neutral expression.

Below is an auto-cropping case by --flag_crop_driving_video:

python inference.py -s assets/examples/source/s9.jpg -d assets/examples/driving/d13.mp4 --flag_crop_driving_video

If you find the results of auto-cropping is not well, you can modify the --scale_crop_driving_video, --vy_ratio_crop_driving_video options to adjust the scale and offset, or do it manually.

Motion template making

You can also use the auto-generated motion template files ending with .pkl to speed up inference, and protect privacy, such as:

python inference.py -s assets/examples/source/s9.jpg -d assets/examples/driving/d5.pkl # portrait animation
python inference.py -s assets/examples/source/s13.mp4 -d assets/examples/driving/d5.pkl # portrait video editing

4. Gradio interface 🤗

We also provide a Gradio interface for a better experience, just run by:

# For Linux and Windows users (and macOS with Intel??)
python app.py # humans mode

# For macOS with Apple Silicon users, Intel not supported, this maybe 20x slower than RTX 4090
PYTORCH_ENABLE_MPS_FALLBACK=1 python app.py # humans mode

We also provide a Gradio interface of animals mode, which is only tested on Linux with NVIDIA GPU:

python app_animals.py # animals mode 🐱🐶

You can specify the --server_port, --share, --server_name arguments to satisfy your needs!

🚀 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.

# enable torch.compile for faster inference
python app.py --flag_do_torch_compile

Note: This method is not supported on Windows and macOS.

Or, try it out effortlessly on HuggingFace 🤗

5. Inference speed evaluation 🚀🚀🚀

We have also provided a script to evaluate the inference speed of each module:

# For NVIDIA GPU
python speed.py

The results are here.

Community Resources 🤗

Discover the invaluable resources contributed by our community to enhance your LivePortrait experience:

And many more amazing contributions from our community!

Acknowledgements 💐

We would like to thank the contributors of FOMM, Open Facevid2vid, SPADE, InsightFace and X-Pose repositories, for their open research and contributions.

Citation 💖

If you find LivePortrait useful for your research, welcome to 🌟 this repo and cite our work using the following BibTeX:

@article{guo2024liveportrait,
  title   = {LivePortrait: Efficient Portrait Animation with Stitching and Retargeting Control},
  author  = {Guo, Jianzhu and Zhang, Dingyun and Liu, Xiaoqiang and Zhong, Zhizhou and Zhang, Yuan and Wan, Pengfei and Zhang, Di},
  journal = {arXiv preprint arXiv:2407.03168},
  year    = {2024}
}

Contact 📧

Jianzhu Guo (郭建珠); [email protected]

liveportrait's People

Contributors

cleardusk avatar eltociear avatar iflamed avatar iloveoreo avatar kkakkkka avatar longredzhong avatar opinsky avatar pablo8itall avatar v3ucn avatar wagenrace avatar zzzweakman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

liveportrait's Issues

Head wobble

I managed to remove wobble of shoulders by masking driving vid so only the head is visible this had a great effect.

The head on results from certain driving vids can have bad wobble caused by the head enlarging, I imagine this is due to a bad driving vid affecting the alignment crop radius, on another project I was able to set a persistent crop radius based on the most common value that worked rather well what are your thoughts on resolving this?

I don't have the driving vid for this or the settings so if anybody has all the settings checked and the concanated file and a noticable head wobble then please upload

hedra-lifeportrait--Editor2.mp4

How to use Pets mode?

I would like to use the pet effect feature. Do you have plans to make it available?

animals

face detector not detecting animals such as dogs and cats although project pages mentions it might be possible

🐱🐶 Generalization to Animals 🐼🐱

🐱🐶 Generalization to Animals 🐼🐱
By fine-tuning on animals data, these cute cats, dogs and pandas can be precisely driven by humans

image

I'm interested in the animal models, but I tried the current code and it says no faces were found. Can you update the animal/pet code to support that? Thanks

TypeError: Info() got an unexpected keyword argument 'duration'

Everything was working fine before the update.

D:\AI\LivePortrait\venv\lib\site-packages\torch\nn\modules\conv.py:605: UserWarning: Plan failed with a cudnnException:
CUDNN_BACKEND_EXECUTION_PLAN_DESCRIPTOR: cudnnFinalize Descriptor Failed cudnn_status: CUDNN_STATUS_NOT_SUPPORTED
(Triggered internally at ..\aten\src\ATen\native\cudnn\Conv_v8.cpp:919.)
return F.conv3d(
Animating... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:02
Concatenating result... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
Dump to animations/1111111111111111111--Gradio_3_concat.mp4

Dump to animations/1111111111111111111--Gradio_3.mp4

Traceback (most recent call last):
File "D:\AI\LivePortrait\venv\lib\site-packages\gradio\queueing.py", line 532, in process_events
response = await route_utils.call_process_api(
File "D:\AI\LivePortrait\venv\lib\site-packages\gradio\route_utils.py", line 276, in call_process_api
output = await app.get_blocks().process_api(
File "D:\AI\LivePortrait\venv\lib\site-packages\gradio\blocks.py", line 1928, in process_api
result = await self.call_function(
File "D:\AI\LivePortrait\venv\lib\site-packages\gradio\blocks.py", line 1514, in call_function
prediction = await anyio.to_thread.run_sync(
File "D:\AI\LivePortrait\venv\lib\site-packages\anyio\to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "D:\AI\LivePortrait\venv\lib\site-packages\anyio_backends_asyncio.py", line 2177, in run_sync_in_worker_thread
return await future
File "D:\AI\LivePortrait\venv\lib\site-packages\anyio_backends_asyncio.py", line 859, in run
result = context.run(func, *args)
File "D:\AI\LivePortrait\venv\lib\site-packages\gradio\utils.py", line 832, in wrapper
response = f(*args, **kwargs)
File "D:\AI\LivePortrait\src\gradio_pipeline.py", line 64, in execute_video
gr.Info("Run successfully!", duration=2)
TypeError: Info() got an unexpected keyword argument 'duration'

Torso movement

Great work! Not really an issue but was curious if there was a way to get the torso to move a little more naturally within a portrait shot.

做了款解压即用的Windows工具,不用搭建环境

伟大的工作,效果很好。
https://github.com/zhaoyun0071/LivePortrait-windows-GUI

V1.2 版本:2024-7-7
1、现在驱动视频支持自动裁剪人脸区域了,默认勾选自动裁剪视频人脸区域即可;

2、修复16代显卡黑图的问题,不勾选半精度即可;

3、生成的视频和驱动视频帧率抱持一致,且带有驱动视频的声音;

4、支持pkl格式的驱动视频导入,pkl格式就是勾选自动裁剪视频人脸区域后自动生成的数据文件,和驱动视频同名同目录。

V1.1 版本:2024-7-5

1、支持批量选择图片和驱动视频。批量生成。

V1.0 版本:2024-7-4

1、基于LivePortrait项目,原汁原味,支持图片模拟驱动视频的表情、五官动作等。

Turn off head motion option

Excellent work, congratulations!

I wonder if there is an option to remove the head motion completely. In my test I was driving it with a series of still
images and the head started shaking and changing its size.

Thanks in advance

about “ Portrait video editing with stitching‘’ part

Hey, you guys are just incredibly awesome! 🌟 This is hands down the best project I've come across recently. The test results are flawlessly perfect! 📊💯 I checked out the sections on your homepage about 'Portrait video editing with stitching' and 'Generalization to Animals'. 🐶🎨 Are there any release plans for these features

How to make a driving video?

as the title describes, can u explain how to make a driving video like the samples in ./assets/examples/driving

老铁666!!!!

我承认可灵刚出的时候说话大声了,现在又来个这个!!!!马上测试!!!!!!!

enhance body movement

very nice work but need something simple but big
when human move head the body make move little bit that change will make the model number one

bravo keep going....

Gradio Colab Help

I'm trying to create a colab notebook for the gradio version of the project. I have all the pieces together but for some reason when I run the final cell "python app.py" , the cell seem to get stuck and doesn't execute the rest of the script. No error pops up but a Gradio link never generates. Would anyone happen to have an idea what might cause this. Any help would be appreciated. Link to the colab - https://colab.research.google.com/drive/15pX7d8FfCMTty1v0DpgeApIR4VCduyDR?usp=sharing

access to KVQ

Thank you for the interesting work.

I found that you used KVQ (CVPR 2023) to filter out the low-qaulity frames, and you are the author of KVQ.
Any chance to access KVQ ? or any other options such as HyperIQA ?

SUPPORT FOR MASKING

Im using Kijai implementation in Comfyui it would be good to mask are of the image to transfer head movement this will be good for hair, hat, helmet, etc.. here is a video example wen the tech only moves the face area and it supposed to move the helmet too.

LivePortrait_00017.mp4

face3d error

(LivePortrait) PS J:\githubs\LivePortrait> python .\inference.py
ERROR:albumentations.check_version:Error fetching version info
Traceback (most recent call last):
File "I:\anaconda3\envs\LivePortrait\lib\site-packages\albumentations\check_version.py", line 32, in fetch_version_info
data = response.read()
File "I:\anaconda3\envs\LivePortrait\lib\http\client.py", line 476, in read
s = self.safe_read(self.length)
File "I:\anaconda3\envs\LivePortrait\lib\http\client.py", line 626, in safe_read
chunk = self.fp.read(min(amt, MAXAMOUNT))
File "I:\anaconda3\envs\LivePortrait\lib\socket.py", line 704, in readinto
return self.sock.recv_into(b)
File "I:\anaconda3\envs\LivePortrait\lib\ssl.py", line 1275, in recv_into
return self.read(nbytes, buffer)
File "I:\anaconda3\envs\LivePortrait\lib\ssl.py", line 1133, in read
return self.sslobj.read(len, buffer)
socket.timeout: The read operation timed out
Traceback (most recent call last):
File "J:\githubs\LivePortrait\inference.py", line 7, in
from src.live_portrait_pipeline import LivePortraitPipeline
File "J:\githubs\LivePortrait\src\live_portrait_pipeline.py", line 20, in
from .utils.cropper import Cropper
File "J:\githubs\LivePortrait\src\utils\cropper.py", line 10, in
from .face_analysis_diy import FaceAnalysisDIY
File "J:\githubs\LivePortrait\src\utils\face_analysis_diy.py", line 9, in
from .dependencies.insightface.app import FaceAnalysis
File "J:\githubs\LivePortrait\src\utils\dependencies\insightface_init
.py", line 18, in
from . import app
File "J:\githubs\LivePortrait\src\utils\dependencies\insightface\app_init
.py", line 2, in
from .mask_renderer import *
File "J:\githubs\LivePortrait\src\utils\dependencies\insightface\app\mask_renderer.py", line 8, in
from ..thirdparty import face3d
File "J:\githubs\LivePortrait\src\utils\dependencies\insightface\thirdparty\face3d_init.py", line 3, in
from . import mesh
File "J:\githubs\LivePortrait\src\utils\dependencies\insightface\thirdparty\face3d\mesh_init.py", line 9, in
from .cython import mesh_core_cython
ImportError: cannot import name 'mesh_core_cython' from 'src.utils.dependencies.insightface.thirdparty.face3d.mesh.cython' (unknown location)

anyone has this error ? how to fixed ?

Failure in loading motion_extractor model

I followed the setup stages in the README (pip installations and downloading models from the Drive folder), and then tried to run inference.py but got this error message :

[07:53:17] Load appearance_feature_extractor done.
live_portrait_wrapper.py:29
Traceback (most recent call last):
  File "/efs/user_folders/yossib/Dev/LivePortrait/inference.py", line 33, in <module>
    main()
  File "/efs/user_folders/yossib/Dev/LivePortrait/inference.py", line 23, in main
    live_portrait_pipeline = LivePortraitPipeline(
  File "/efs/user_folders/yossib/Dev/LivePortrait/src/live_portrait_pipeline.py", line 38, in __init__
    self.live_portrait_wrapper: LivePortraitWrapper = LivePortraitWrapper(cfg=inference_cfg)
  File "/efs/user_folders/yossib/Dev/LivePortrait/src/live_portrait_wrapper.py", line 31, in __init__
    self.motion_extractor = load_model(cfg.checkpoint_M, model_config, cfg.device_id, 'motion_extractor')
  File "/efs/user_folders/yossib/Dev/LivePortrait/src/utils/helper.py", line 132, in load_model
    model.load_state_dict(torch.load(ckpt_path, map_location=lambda storage, loc: storage))
  File "/opt/conda/envs/LivePortrait/lib/python3.9/site-packages/torch/serialization.py", line 1004, in load
    with _open_zipfile_reader(opened_file) as opened_zipfile:
  File "/opt/conda/envs/LivePortrait/lib/python3.9/site-packages/torch/serialization.py", line 456, in __init__
    super().__init__(torch._C.PyTorchFileReader(name_or_buffer))
RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

This is how my models folder looks like :

(LivePortrait) ~/Dev/LivePortrait$ find pretrained_weights/
pretrained_weights/
pretrained_weights/insightface
pretrained_weights/insightface/models
pretrained_weights/insightface/models/buffalo_l
pretrained_weights/insightface/models/buffalo_l/det_10g.onnx
pretrained_weights/insightface/models/buffalo_l/2d106det.onnx
pretrained_weights/liveportrait
pretrained_weights/liveportrait/base_models
pretrained_weights/liveportrait/base_models/appearance_feature_extractor.pth
pretrained_weights/liveportrait/base_models/spade_generator.pth
pretrained_weights/liveportrait/base_models/motion_extractor.pth
pretrained_weights/liveportrait/base_models/warping_module.pth
pretrained_weights/liveportrait/landmark.onnx
pretrained_weights/liveportrait/retargeting_models
pretrained_weights/liveportrait/retargeting_models/stitching_retargeting_module.pth
pretrained_weights/.gitkeep

What should we do to prevent filtering during resizing (in Pixel art scenarios)

First of all, thank you for this great work. When I tried it in my pixel art-based images, it produced very successful results. However, I have one question: Is it possible to make it not apply filtering during resizing and perform a nearest neighbor style resize? I changed the interpolation in the cv2 resize parts, but the result did not change. I think the model is doing this smoothing internally during resize. Do you have any suggestions for this?

Flask等框架来创建一个API来处理这个任务, create an API to handle this task,

步骤 1:安装Flask
首先,你需要安装Flask。可以通过pip来安装:
pip install Flask
步骤 2:创建Flask应用
创建一个新的Python脚本,例如app1.py,并添加以下代码:
`from flask import Flask, request, jsonify
import subprocess
import os

app = Flask(name)

@app.route('/run-inference', methods=['POST'])
def run_inference():
# 获取JSON请求中的数据
data = request.json
source_image = data.get('source_image')
driving_video = data.get('driving_video')

if not source_image or not driving_video:
    return jsonify({"error": "Missing source_image or driving_video parameter"}), 400

# 构建命令
command = f'python inference.py -s {source_image} -d {driving_video}'

# 运行命令
try:
    subprocess.run(command, check=True, shell=True, cwd='C:/ALLWEBUI/liveportarit/LivePortrait')
    return jsonify({"message": "Inference completed successfully"}), 200
except subprocess.CalledProcessError as e:
    return jsonify({"error": str(e)}), 500

if name == 'main':
app.run(host='0.0.0.0', port=5000)
步骤 3:运行Flask应用 在终端中运行Flask应用:python app1.py
`

步骤 4:通过API调用
现在,你可以通过API来调用这个命令。例如,使用curl命令:
`import requests

url = 'http://localhost:5000/run-inference'
data = {
'source_image': 'Your image file here',
'driving_video': 'assets/examples/driving/d13(1).mp4'
}

response = requests.post(url, json=data)

print(response.json())
`

ImportError: cannot import name 'mesh_core_cython'

Hello! The installation went well, but an error is displayed at startup:

ImportError: cannot import name 'mesh_core_cython' from 'src.utils.dependencies.insightface.thirdparty.face3d.mesh.cython' (unknown location)

How to fine

How to fine tune, refer to the demonstration of fine-tuning animal faces in the paper

Error after installing

I've gone through the steps on the main page to install. Setup environment, install requirements and gradio as well as the models. I get the same error whether I use a conda env or python one.
When running python inference.py or python app.py I get the following:

(venv) I:\zzzz_stablediffusion-other\zz_LP\LivePortrait>python app.py
INFO:albumentations.check_version:A new version of Albumentations is available: 1.4.11 (you have 1.4.10). Upgrade using: pip install --upgrade albumentations
Traceback (most recent call last):
  File "I:\zzzz_stablediffusion-other\zz_LP\LivePortrait\app.py", line 11, in <module>
    from src.gradio_pipeline import GradioPipeline
  File "I:\zzzz_stablediffusion-other\zz_LP\LivePortrait\src\gradio_pipeline.py", line 8, in <module>
    from .live_portrait_pipeline import LivePortraitPipeline
  File "I:\zzzz_stablediffusion-other\zz_LP\LivePortrait\src\live_portrait_pipeline.py", line 20, in <module>
    from .utils.cropper import Cropper
  File "I:\zzzz_stablediffusion-other\zz_LP\LivePortrait\src\utils\cropper.py", line 11, in <module>
    from .face_analysis_diy import FaceAnalysisDIY
  File "I:\zzzz_stablediffusion-other\zz_LP\LivePortrait\src\utils\face_analysis_diy.py", line 9, in <module>
    from .dependencies.insightface.app import FaceAnalysis
  File "I:\zzzz_stablediffusion-other\zz_LP\LivePortrait\src\utils\dependencies\insightface\__init__.py", line 18, in <module>
    from . import app
  File "I:\zzzz_stablediffusion-other\zz_LP\LivePortrait\src\utils\dependencies\insightface\app\__init__.py", line 2, in <module>
    from .mask_renderer import *
  File "I:\zzzz_stablediffusion-other\zz_LP\LivePortrait\src\utils\dependencies\insightface\app\mask_renderer.py", line 8, in <module>
    from ..thirdparty import face3d
  File "I:\zzzz_stablediffusion-other\zz_LP\LivePortrait\src\utils\dependencies\insightface\thirdparty\face3d\__init__.py", line 3, in <module>
    from . import mesh
  File "I:\zzzz_stablediffusion-other\zz_LP\LivePortrait\src\utils\dependencies\insightface\thirdparty\face3d\mesh\__init__.py", line 9, in <module>
    from .cython import mesh_core_cython
ImportError: cannot import name 'mesh_core_cython' from 'src.utils.dependencies.insightface.thirdparty.face3d.mesh.cython' (unknown location)

Demo Reproduce

Great Work!!! Could you give more instructions on how to reproduce the demos in the project page.

CUDNN_STATUS_NOT_SUPPORTED in logs

I am getting the following when performing an animate. I have done a 'git pull' to make sure I have latest files and re-ran 'pip install -r requirements.txt' after doing so.

I:\zzzz_stablediffusion-other\zz_LP\LivePortrait\venv\lib\site-packages\torch\nn
\modules\conv.py:605: UserWarning: Plan failed with a cudnnException:
CUDNN_BACKEND_EXECUTION_PLAN_DESCRIPTOR: cudnnFinalize Descriptor Failed
cudnn_status: CUDNN_STATUS_NOT_SUPPORTED (Triggered internally at
..\aten\src\ATen\native\cudnn\Conv_v8.cpp:919.)
  return F.conv3d(
I:\zzzz_stablediffusion-other\zz_LP\LivePortrait\venv\lib\site-packages\torch\nn
\modules\conv.py:456: UserWarning: Plan failed with a cudnnException:
CUDNN_BACKEND_EXECUTION_PLAN_DESCRIPTOR: cudnnFinalize Descriptor Failed
cudnn_status: CUDNN_STATUS_NOT_SUPPORTED (Triggered internally at
..\aten\src\ATen\native\cudnn\Conv_v8.cpp:919.)
  return F.conv2d(input, weight, bias, self.stride,
Animating... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:29
Concatenating result... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
Dump to animations/s10--d5_concat.mp4

writing ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   0% -:--:--[swscaler @ 000001adabad0000] Warning: data is not aligned! This can lead to a speed loss
Dump to animations/s10--d5.mp4

retargeting

re-targeting in the gradio seems to show correct results in the example image it produces but does not change the video

[ONNXRuntimeError] : 7 : INVALID_PROTOBUF : Load model from....

hi,gays,
(D:\work\Git\LivePortrait\LivePortrait) D:\work\Git\LivePortrait>python app.py
[09:06:26] Load appearance_feature_extractor done. live_portrait_wrapper.py:29
Load motion_extractor done. live_portrait_wrapper.py:32
Load warping_module done. live_portrait_wrapper.py:35
[09:06:27] Load spade_generator done. live_portrait_wrapper.py:38
Load stitching_retargeting_module done. live_portrait_wrapper.py:42
[09:06:31] LandmarkRunner warmup time: 1.211s landmark_runner.py:89
Traceback (most recent call last):
File "D:\work\Git\LivePortrait\app.py", line 28, in
gradio_pipeline = GradioPipeline(
File "D:\work\Git\LivePortrait\src\gradio_pipeline.py", line 26, in init
super().init(inference_cfg, crop_cfg)
File "D:\work\Git\LivePortrait\src\live_portrait_pipeline.py", line 39, in init
self.cropper = Cropper(crop_cfg=crop_cfg)
File "D:\work\Git\LivePortrait\src\utils\cropper.py", line 44, in init
self.face_analysis_wrapper = FaceAnalysisDIY(
File "D:\work\Git\LivePortrait\src\utils\face_analysis_diy.py", line 37, in init
super().init(name=name, root=root, allowed_modules=allowed_modules, **kwargs)
File "D:\work\Git\LivePortrait\src\utils\dependencies\insightface\app\face_analysis.py", line 33, in init
model = model_zoo.get_model(onnx_file, **kwargs)
File "D:\work\Git\LivePortrait\src\utils\dependencies\insightface\model_zoo\model_zoo.py", line 96, in get_model
model = router.get_model(providers=providers, provider_options=provider_options)
File "D:\work\Git\LivePortrait\src\utils\dependencies\insightface\model_zoo\model_zoo.py", line 40, in get_model
session = PickableInferenceSession(self.onnx_file, **kwargs)
File "D:\work\Git\LivePortrait\src\utils\dependencies\insightface\model_zoo\model_zoo.py", line 25, in init
super().init(model_path, **kwargs)
File "D:\work\Git\LivePortrait\LivePortrait\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 419, in init
self._create_inference_session(providers, provider_options, disabled_optimizers)
File "D:\work\Git\LivePortrait\LivePortrait\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 472, in _create_inference_session
sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model)
onnxruntime.capi.onnxruntime_pybind11_state.InvalidProtobuf: [ONNXRuntimeError] : 7 : INVALID_PROTOBUF : Load model from D:\work\Git\LivePortrait\src\utils../../pretrained_weights/insightface\models\buffalo_l\det_10g.onnx failed:Protobuf parsing failed.

When we enable eye retarget ratio the movement is gone

I am working on a 1-click installers (all ready for Windows, RunPod, Massed Compute & Kaggle (works amazing on free Kaggle account)) and a tutorial video and flag_eye_retargeting is not working

I have made a lot of changes and implemented the logic but here comparison

Default settings as below

Demo_img_1_concat_sound_0029.mp4

When target eyes-open ratio is 30% more of original and target lip-open ratio is 80% more as below

Demo_img_1_concat_sound_0033.mp4

screencapture-127-0-0-1-7860-2024-07-06-20_10_43

Training code

Excellent work guys! Loved reading the paper. Are there any plans to release the training code and/or the dataset?

readme中的推荐安装命令执行依赖包的时候,onnxruntime-gpu报python版本太低,确定要限制python版本为3.9.18?

pip install -r requirements.txt

ERROR: Ignored the following versions that require a different python version: 1.14.0 Requires-Python >=3.10; 1.14.0rc1 Requires-Python >=3.10; 1.14.0rc2 Requires-Python >=3.10
ERROR: Could not find a version that satisfies the requirement onnxruntime-gpu==1.18.0 (from versions: none)
ERROR: No matching distribution found for onnxruntime-gpu==1.18.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.