InstantID 介绍

Instant ID 是一个创新的无需调整的风格保持和迁移方法,能够结合了 ControlNet 和 IP-Adapter 来控制扩散过程中的面部特征的风格迁移。Instant ID 的一个独特设计在于将IP-Adapter中投影的面部嵌入作为交叉注意力输入传递给 ControlNet unet,而非使用常规方法:ControlNet unet的交叉注意力输入是提示的文本嵌入。如下图所示:

2024-07-11T16:00:45.png

Instant ID 插件安装

Instant ID安装需要升级对应的sd-webui-controlnet插件,对应版本不低于v1.1.438。

Github仓库地址:https://github.com/Mikubill/sd-webui-controlnet

下载下来直接放到stable-diffusion-webui\extensions目录,目录名为sd-webui-controlnet

模型下载

下载对应模型,并将其放置在stable-diffusion-webui/models/ControlNet目录下。同时需要将模型重命名为ip-adapter_instant_id_sdxl.bincontrol_instant_id_sdxl.safetensors,以便插件能够正确识别这两个模型

可以用迅雷下载,速度比较快

Instant ID 使用

在SD-WebUI 中使用InstantID插件需要设置两个模型。并且,需要牢记:应该始终将 ipadapter 模型始终设置为第一个模型,因为 ControlNet 模型需要接收 ipadapter 模型的输出作为后续输入。

Unit 0 设置

在 ControlNet 单元之前,必须设置 ip-adapter单元。IP-Adapter 单元输出的面部嵌入将作为下一个 ControlNet 单元的输入之一。

2024-07-11T16:04:17.png

Unit 1 设置

ControlNet 单元接受包含面部5个关键点的关键点图,因此需要在Unit 1中使用keypoints选项。在这里可以使用与Unit 0中相同的人物的面部关键点,也可以不使用同一张面部图像作为输入。

2024-07-11T16:04:49.png

另外,在官方文档中建议:将 CFG 设置为 4~5 以获得最佳结果。同时也提到,根据采样方法和基础模型这个数字可能会有所不同,但通常需要使用的 CFG 比例略低于正常的 CFG。同时还提到,如果将宽度x高度设置为1024*1024,那么生成水印、徽标的几率更高。这不能通过在负面提示中添加徽标水印关键词来纠正。可以通过设置其他宽度 x 高度值来避免这个问题。

效果

大致的风格是有了,我电脑比较不行参数调低了,画面比较模糊。

2024-07-11T16:05:38.png

参数

woman,moyou, solo, on side, dress, lying, black hair, blue dress, snow, blue eyes, blue theme, looking at viewer, bare shoulders, lips, hair ornament, bare arms, A Beautiful Chinese Woman,
,(masterpiece:1.2), best quality, masterpiece, highres, original, extremely detailed wallpaper, perfect lighting,(extremely detailed CG:1.2),
Negative prompt: NSFW, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, (ugly:1.331), (duplicate:1.331), (morbid:1.21), (mutilated:1.21), (tranny:1.331), mutated hands, (poorly drawn hands:1.5), blurry, (bad anatomy:1.21), (bad proportions:1.331), extra limbs, (disfigured:1.331), (missing arms:1.331), (extra legs:1.331), (fused fingers:1.61051), (too many fingers:1.61051), (unclear eyes:1.331), lowers, bad hands, missing fingers, extra digit,bad hands, missing fingers, (((extra arms and legs))),
Steps: 20, Sampler: DPM++ 2M, Schedule type: Karras, CFG scale: 7, Seed: 272102459, Size: 512x750, Model hash: 573f4a7d35, Model: leosamsHelloworldXL_helloworldXL70, ControlNet 0: "Module: instant_id_face_embedding, Model: ip-adapter_instant_id_sdxl [eb2d3ec0], Weight: 1.0, Resize Mode: Crop and Resize, Processor Res: 512, Threshold A: 0.5, Threshold B: 0.5, Guidance Start: 0.0, Guidance End: 1.0, Pixel Perfect: True, Control Mode: Balanced", ControlNet 1: "Module: instant_id_face_keypoints, Model: control_instant_id_sdxl [c5c25a50], Weight: 1.0, Resize Mode: Crop and Resize, Processor Res: 512, Threshold A: 0.5, Threshold B: 0.5, Guidance Start: 0.0, Guidance End: 1.0, Pixel Perfect: True, Control Mode: Balanced", Version: 1.9.4

参考

https://blog.csdn.net/A13531922961/article/details/140262392

发表评论