musepose-demo
项目介绍
- https://github.com/TMElyralab/MusePose
- 发布的模型能够根据给定的姿势序列,生成参考图中人物的舞蹈视频,结果质量超越了同一主题中几乎所有当前开源的模型。
- 发布pose align算法,以便用户可以将任意舞蹈视频与任意参考图像对齐,这显著提高了推理性能并增强了模型的可用性
部署
cd custom_nodes
git clone https://github.com/TMElyralab/MusePose.git
pip install -r requirements.txt
pip install --no-cache-dir -U openmim
mim install mmengine
mim install "mmcv>=2.0.1"
mim install "mmdet>=3.1.0"
mim install "mmpose>=1.1.0"
模型下载
cd MusePose
import os
import wget
from tqdm import tqdmos.makedirs('pretrained_weights', exist_ok=True)urls = ['https://download.openmmlab.com/mmdetection/v2.0/yolox/yolox_l_8x8_300e_coco/yolox_l_8x8_300e_coco_20211126_140236-d3bd2b23.pth','https://huggingface.co/yzd-v/DWPose/resolve/main/dw-ll_ucoco_384.pth','https://huggingface.co/TMElyralab/MusePose/resolve/main/MusePose/denoising_unet.pth','https://huggingface.co/TMElyralab/MusePose/resolve/main/MusePose/motion_module.pth','https://huggingface.co/TMElyralab/MusePose/resolve/main/MusePose/pose_guider.pth','https://huggingface.co/TMElyralab/MusePose/resolve/main/MusePose/reference_unet.pth','https://huggingface.co/lambdalabs/sd-image-variations-diffusers/resolve/main/unet/diffusion_pytorch_model.bin','https://huggingface.co/lambdalabs/sd-image-variations-diffusers/resolve/main/image_encoder/pytorch_model.bin','https://huggingface.co/stabilityai/sd-vae-ft-mse/resolve/main/diffusion_pytorch_model.bin']paths = ['dwpose', 'dwpose', 'MusePose', 'MusePose', 'MusePose', 'MusePose', 'sd-image-variations-diffusers/unet', 'image_encoder', 'sd-vae-ft-mse']for path in paths:os.makedirs(f'pretrained_weights/{path}', exist_ok=True)# saving weights
for url, path in tqdm(zip(urls, paths)):filename = wget.download(url, f'pretrained_weights/{path}')config_urls = ['https://huggingface.co/lambdalabs/sd-image-variations-diffusers/resolve/main/unet/config.json','https://huggingface.co/lambdalabs/sd-image-variations-diffusers/resolve/main/image_encoder/config.json','https://huggingface.co/stabilityai/sd-vae-ft-mse/resolve/main/config.json']config_paths = ['sd-image-variations-diffusers/unet', 'image_encoder', 'sd-vae-ft-mse']# saving config files
for url, path in tqdm(zip(config_urls, config_paths)):filename = wget.download(url, f'pretrained_weights/{path}')# renaming model name as given in readme
os.rename('pretrained_weights/dwpose/yolox_l_8x8_300e_coco_20211126_140236-d3bd2b23.pth', 'pretrained_weights/dwpose/yolox_l_8x8_300e_coco.pth')
运行效果
工作流
{"last_node_id": 16,"last_link_id": 11,"nodes": [{"id": 5,"type": "filenamestring","pos": [983,765],"size": {"0": 210,"1": 26},"flags": {},"order": 3,"mode": 0,"inputs": [{"name": "filenames","type": "VHS_FILENAMES","link": 6,"slot_index": 0,"label": "filenames"}],"outputs": [{"name": "STRING","type": "STRING","links": [3],"shape": 3,"slot_index": 0,"label": "STRING"}],"properties": {"Node name for S&R": "filenamestring"}},{"id": 13,"type": "filenamestring","pos": [1241,768],"size": {"0": 210,"1": 26},"flags": {},"order": 6,"mode": 0,"inputs": [{"name": "filenames","type": "VHS_FILENAMES","link": 8,"slot_index": 0,"label": "filenames"}],"outputs": [{"name": "STRING","type": "STRING","links": [9],"shape": 3,"slot_index": 0,"label": "STRING"}],"properties": {"Node name for S&R": "filenamestring"}},{"id": 4,"type": "museposealign","pos": [1077,542],"size": {"0": 315,"1": 150},"flags": {},"order": 4,"mode": 0,"inputs": [{"name": "image","type": "IMAGE","link": 4,"slot_index": 0,"label": "image"},{"name": "video","type": "STRING","link": 3,"widget": {"name": "video"},"slot_index": 1,"label": "video"}],"outputs": [{"name": "IMAGE","type": "IMAGE","links": [7],"shape": 3,"slot_index": 0,"label": "IMAGE"}],"properties": {"Node name for S&R": "museposealign"},"widgets_values": ["",512,700,300,0]},{"id": 10,"type": "VHS_VideoCombine","pos": [371,810],"size": [210,641.7777777777778],"flags": {},"order": 2,"mode": 0,"inputs": [{"name": "images","type": "IMAGE","link": 5,"label": "images"},{"name": "audio","type": "VHS_AUDIO","link": null,"label": "audio"},{"name": "meta_batch","type": "VHS_BatchManager","link": null,"label": "batch_manager"}],"outputs": [{"name": "Filenames","type": "VHS_FILENAMES","links": [6],"shape": 3,"slot_index": 0,"label": "Filenames"}],"properties": {"Node name for S&R": "VHS_VideoCombine"},"widgets_values": {"frame_rate": 24,"loop_count": 0,"filename_prefix": "AnimateDiff","format": "video/h264-mp4","pix_fmt": "yuv420p","crf": 19,"save_metadata": true,"pingpong": false,"save_output": false,"videopreview": {"hidden": false,"paused": false,"params": {"filename": "AnimateDiff_00028.mp4","subfolder": "","type": "temp","format": "video/h264-mp4"}}}},{"id": 11,"type": "VHS_VideoCombine","pos": [973,807],"size": [390,896],"flags": {},"order": 5,"mode": 0,"inputs": [{"name": "images","type": "IMAGE","link": 7,"label": "images"},{"name": "audio","type": "VHS_AUDIO","link": null,"label": "audio"},{"name": "meta_batch","type": "VHS_BatchManager","link": null,"label": "batch_manager"}],"outputs": [{"name": "Filenames","type": "VHS_FILENAMES","links": [8],"shape": 3,"slot_index": 0,"label": "Filenames"}],"properties": {"Node name for S&R": "VHS_VideoCombine"},"widgets_values": {"frame_rate": 24,"loop_count": 0,"filename_prefix": "AnimateDiff","format": "video/h264-mp4","pix_fmt": "yuv420p","crf": 19,"save_metadata": true,"pingpong": false,"save_output": false,"videopreview": {"hidden": false,"paused": false,"params": {"filename": "AnimateDiff_00029.mp4","subfolder": "","type": "temp","format": "video/h264-mp4"}}}},{"id": 6,"type": "LoadImage","pos": [592,1014],"size": {"0": 368.78228759765625,"1": 444.1121826171875},"flags": {},"order": 0,"mode": 0,"outputs": [{"name": "IMAGE","type": "IMAGE","links": [4,10],"shape": 3,"slot_index": 0,"label": "IMAGE"},{"name": "MASK","type": "MASK","links": null,"shape": 3,"label": "MASK"}],"properties": {"Node name for S&R": "LoadImage"},"widgets_values": ["pic (4).png","image"]},{"id": 9,"type": "VHS_LoadVideo","pos": [7,837],"size": [357.83404541015625,876.5938585069445],"flags": {},"order": 1,"mode": 0,"inputs": [{"name": "meta_batch","type": "VHS_BatchManager","link": null,"label": "batch_manager"}],"outputs": [{"name": "IMAGE","type": "IMAGE","links": [5],"shape": 3,"slot_index": 0,"label": "IMAGE"},{"name": "frame_count","type": "INT","links": null,"shape": 3,"label": "frame_count"},{"name": "audio","type": "VHS_AUDIO","links": null,"shape": 3,"label": "audio"},{"name": "video_info","type": "VHS_VIDEOINFO","links": null,"shape": 3,"label": "video_info"}],"properties": {"Node name for S&R": "VHS_LoadVideo"},"widgets_values": {"video": "dance.mp4","force_rate": 40,"force_size": "Disabled","custom_width": 512,"custom_height": 512,"frame_load_cap": 0,"skip_first_frames": 100,"select_every_nth": 1,"choose video to upload": "image","videopreview": {"hidden": false,"paused": false,"params": {"frame_load_cap": 0,"skip_first_frames": 100,"force_rate": 40,"filename": "dance.mp4","type": "input","format": "video/mp4","select_every_nth": 1}}}},{"id": 14,"type": "VHS_VideoCombine","pos": [1376,803],"size": [390,896],"flags": {},"order": 8,"mode": 0,"inputs": [{"name": "images","type": "IMAGE","link": 11,"label": "images"},{"name": "audio","type": "VHS_AUDIO","link": null,"label": "audio"},{"name": "meta_batch","type": "VHS_BatchManager","link": null,"label": "batch_manager"}],"outputs": [{"name": "Filenames","type": "VHS_FILENAMES","links": [],"shape": 3,"slot_index": 0,"label": "Filenames"}],"properties": {"Node name for S&R": "VHS_VideoCombine"},"widgets_values": {"frame_rate": 60,"loop_count": 0,"filename_prefix": "AnimateDiff","format": "video/h264-mp4","pix_fmt": "yuv420p","crf": 19,"save_metadata": true,"pingpong": false,"save_output": false,"videopreview": {"hidden": false,"paused": false,"params": {"filename": "AnimateDiff_00034.mp4","subfolder": "","type": "temp","format": "video/h264-mp4"}}}},{"id": 12,"type": "musepose","pos": [1465,509],"size": {"0": 315,"1": 246},"flags": {},"order": 7,"mode": 0,"inputs": [{"name": "image","type": "IMAGE","link": 10,"label": "image"},{"name": "video","type": "STRING","link": 9,"widget": {"name": "video"},"label": "video"}],"outputs": [{"name": "IMAGE","type": "IMAGE","links": [11],"shape": 3,"slot_index": 0,"label": "IMAGE"}],"properties": {"Node name for S&R": "musepose"},"widgets_values": ["",512,512,1000,48,4,3,10,12]}],"links": [[3,5,0,4,1,"STRING"],[4,6,0,4,0,"IMAGE"],[5,9,0,10,0,"IMAGE"],[6,10,0,5,0,"VHS_FILENAMES"],[7,4,0,11,0,"IMAGE"],[8,11,0,13,0,"VHS_FILENAMES"],[9,13,0,12,1,"STRING"],[10,6,0,12,0,"IMAGE"],[11,12,0,14,0,"IMAGE"]],"groups": [],"config": {},"extra": {"ds": {"scale": 0.6303940863128529,"offset": {"0": 746.0277438571095,"1": 34.665619475590915}}},"version": 0.4
}