Stable Diffusion: 生成人物不同的表情和姿态的各种方法

原文:百度安全验证https://baijiahao.baidu.com/s?id=1763013481665368406&wfr=spider&for=pc

使用较大的宽高比,配合Prompt: multiple views of the same character in the same outfit

(masterpiece), (high quility), (detailed skin), (photorealistic), best quality, ultra high res, intricate details, a russian 18 years old girl wearing school uniform, buttoned shirt,  jeans,  necktie, full body,  (multiple views of the same character in the same outfit:1.6)

有的时候,绘制多个人物,眼睛等部位可能渲染不好,解决方法:增加细节描述,比如detailed face, detailed eyes, detailed mouth

a Korean 18 year old girl wearing school uniform,  perfect face, buttoned shirt, shorts,  necktie, full body,  multiple views of the same character in the same outfit,  photorealistic,best quality, masterpiece, high resolution

人物表情控制

注意:使用强度控制,这里smile强度加大到1.6倍。

a portrait of a Korean girl, 18 year old,  (perfect face), (smile:1.6), photorealistic,best quality, masterpiece, high resolution

Prompt S/R

smile, happy, blush, screaming, crying

输出结果

使用ControlNet,一次生成人物多种姿态

需要配合使用embeddings插件charturnerv2:这是一个civitAI上面已经训练好了的embedding。直接get下来使用即可。

Prompt样例:

charturnerv2, a character turnaround of a [ Eun-Young Yeong-Suk |  Ji-Won Ji-Soo |  Seong-Hyeon Yeong-Suk ], a 18 years old beautiful girl, (perfect face), wearing long dress, (multiple views of the same character in the same outfit:1.1)

输出

使用ControlNet,控制人物单个姿态

使用ControlNet,具体如何配置在之前的文章中已经介绍过了

比如使用一种半跪着的姿势

输出结果

你还可以将表情与姿态结合,创作出你所希望的形象。具体这里就不画出来了。

注意:上面介绍的方法在大概90%的情况下,生成的是同一个人物的照片,如果想要达到100%,只要通过模型训练。比如下面的快速训练方法Textual Inversion Embedding。

训练自己的Textual Inversion Embedding

Textual Inversion是一种训练现有神经网络的一小部分的方法,可以用来教会它新的概念,例如绘制特定的人物,或者某种绘画风格。

具体怎么训练的,看这篇文章Stable Diffusion: 训练特定人物模型

### 使用 Stable Diffusion 生成保持角色特征一致的图片 为了确保使用 Stable Diffusion 生成的角色图像具有一致性,主要方法之一是训练一个 LoRA 模型。这种方法特别适用于需要精确控制角色外观的情况,在训练过程中重点在于捕捉面部特征,其次是体型、服装配饰等细节[^2]。 #### 训练 LoRA 模型的具体流程如下: 1. **准备数据集** 收集大量目标角色的不同姿态角度的照片作为训练样本。这些照片应尽可能覆盖各种可能的姿态变化,以便模型能够学习到全面的角色特征。 2. **预处理数据** 对收集的数据进行必要的清理标注工作,比如裁剪、调整大小以及标记关键点位置等操作,使输入更加统一标准化。 3. **构建网络结构** 基于现有的 Stable Diffusion 架构基础上增加特定层用于提取并强化个性化的视觉元素,从而形成新的分支——即所谓的“LoRA”。 4. **微调参数设置** 调整超参数以优化性能表现,包括但不限于批量大小(batch size),迭代次数(epochs),初始学习率(initial learning rate)等等因素的影响。 5. **评估与测试** 完成初步训练之后,需对生成的结果进行全面检验,对比原始素材确认相似度水平是否达到预期标准;必要时还需返回前几步继续改进直至满意为止。 ```python import torch from diffusers import StableDiffusionPipeline, EulerAncestralDiscreteScheduler model_id = "path_to_your_trained_lora_model" scheduler = EulerAncestralDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler") pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler) prompt = "A portrait of a character with consistent features." image = pipe(prompt).images[0] image.show() ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值