姿态驱动的人像生成模型HumanSD

我要开发同款
匿名用户2024年07月31日
32阅读
所属分类aipytorch、人像生成、文生图、cv
开源地址https://modelscope.cn/models/iic/Pose-driven-image-generation-HumanSD
授权协议Apache License 2.0

作品详情


功能概述

输入一段英文文本,和一张图片,生成符合文本描述和图片中人物姿态的人物图片

输入示例:

文本描述":a woman standing by the sea"

图片:)

输出示例:

输出为:

环境准备

从github下载代码:

git clone https://github.com/ZcyMonkey/HumanSD_for_modelscope.git

进入文件夹

cd HumanSD_for_modelscope

配置HumanSD环境

conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch
pip install -r requirements.txt

配置MMpose环境

按照 MMPose 配置MMPose环境,推荐安装0.29.0版本的MMPose

运行代码

在根目录下运行 test_HumanSD.py 即可

示例代码

from modelscope.models import Model
from modelscope.pipelines import pipeline
import ms_wrapper
import os
model = "damo/Pose-driven-image-generation-HumanSD"
image_dir = "fff1daa9ef182b86387d802dba686426e7feb396_19692096.jpg"
prompt = "a woman standing by the sea"
neg_prompt = "lmonochrome, lowres, bad anatomy, worst quality, low quality"
inference = pipeline('Pose-driven-image-generation', model = model,model_revision="v1.0.1")
inputs = {"image_dir":image_dir,"prompt":prompt,"neg_prompt": neg_prompt,"sample_steps":30,"seed":None,"guidance_scale":10.0,"num_samples":2 }
output = inference(input=inputs)
output_dir = 'test'
if not os.path.exists(output_dir):
    os.mkdir(output_dir)
for i in range(len(output)):
    output[i].save(os.path.join(output_dir,str(i).zfill(4)+'.jpg'))

其中

inputs = {"image_dir":image_dir,"prompt":prompt,"neg_prompt": neg_prompt,"sample_steps":30,"seed":None,"guidance_scale":10.0,"num_samples":2 }

为输入参数,可以根据需求更改。

引用

@article{ju2023humansd,
  title={Human{SD}: A Native Skeleton-Guided Diffusion Model for Human Image Generation},
  author={Ju, Xuan and Zeng, Ailing and Zhao, Chenchen and Wang, Jianan and Zhang, Lei and Xu, Qiang},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
  year={2023}
}

```

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论