Stable Diffusion - ControlNet 插件中扩展局部重绘 InpaintOnly + LaMa 算法与应用

这篇具有很好参考价值的文章主要介绍了Stable Diffusion - ControlNet 插件中扩展局部重绘 InpaintOnly + LaMa 算法与应用。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

欢迎关注我的CSDN:https://spike.blog.csdn.net/
本文地址:https://spike.blog.csdn.net/article/details/131643131

Stable Diffusion - ControlNet 插件中扩展局部重绘 InpaintOnly + LaMa 算法与应用,大模型(LLM&AIGC),stable diffusion,ControlNet,LaMa,Inpaint

LaMa: https://github.com/advimman/lama

  • Paper: Resolution-robust Large Mask Inpainting with Fourier Convolutions

LaMa: Large Mask inpainting

尽管现代图像修复系统已经取得了显著的进步,但是在处理大面积缺失、复杂的几何结构和高分辨率图像方面,常常面临挑战。其中一个主要的原因是修复网络和损失函数中缺乏有效的接收视野。为了解决这个问题,提出了一种新的方法,称为 大面积 Mask 修复(LaMa),主要基于:

  1. 一种新的修复网络架构,使用快速傅里叶卷积(FFCs),具有全图像的接收视野;
  2. 高接收视野的感知损失;
  3. 大量训练 Mask,释放前两个部分的潜力。

LaMa 修复网络在一系列数据集上改进了最新的技术水平,并且在面临挑战的情况下,例如完成周期性结构,也取得了优秀的性能。LaMa 模型令人惊讶地能够很好地适应训练时未见过的更高分辨率,且在参数和时间成本上比竞争基线更低。

注意:一定要选择 更偏向ControlNet 模式,否则不起作用,

测试效果:

Stable Diffusion - ControlNet 插件中扩展局部重绘 InpaintOnly + LaMa 算法与应用,大模型(LLM&AIGC),stable diffusion,ControlNet,LaMa,Inpaint

1. 基础图像

启动 SD 服务命令:

conda deactivate
source venv/bin/activate
# python launch.py --port 9301 --xformers
nohup python -u launch.py --port 9301 --xformers > nohup.sd.out &

ControlNet 版本:v1.1.231,已升级至最新版本:

cd stable-diffusion-webui/extensions/sd-webui-controlnet
git pull

再重启服务。

模型是墨优人造人,输入定制化的提示词配置

1girl,moyou,best quality,detailed,8k hdr,RAW,intricate details,chiaroscuro,drop shadow,
(cosmetics:1.1),(rim light:1.2),
solo,(face details:1.3),(light green hair:1.1),eyes,hair accessories,
standing on the ground,full body,fashionable clothing,school uniform,
huge chest,lacteal sulcus,sneakers,on the bustling streets,(pinkshoes:1.2),short skirt
Negative prompt: EasyNegative,(badhandv4:1.2)
Steps: 30, Sampler: DDIM, CFG scale: 7, Seed: 777766374, Face restoration: CodeFormer, Size: 512x768, Model hash: 6a226dd292, Model: 墨幽人造人_v1010_完整版, Denoising strength: 0.2, Hires upscale: 2, Hires upscaler: 8x_NMKD-Superscale_150000_G, Version: v1.4.0

默认 512x768 的输出图像:

Stable Diffusion - ControlNet 插件中扩展局部重绘 InpaintOnly + LaMa 算法与应用,大模型(LLM&AIGC),stable diffusion,ControlNet,LaMa,Inpaint

2. 扩展图像

注意:控制模式 一定要选 更偏向ControlNet,才能启用 LAMA 功能。

将图像存储之后,放入 ControlNet 插件,并且启用,配置如下:

  1. 选择: 完美像素模式
  2. 控制类型,选择: 局部重绘(Inpaint)
  3. 预处理器,选择:inpaint_only+lama;模型,选择:control_v11p_sd15_inpaint
  4. 控制模式更偏向ControlNet,可以生成更多细节,更好启用 LAMA 功能。
  5. 缩放模式:缩放后填充空白

Stable Diffusion - ControlNet 插件中扩展局部重绘 InpaintOnly + LaMa 算法与应用,大模型(LLM&AIGC),stable diffusion,ControlNet,LaMa,Inpaint

其他参数配置:

  1. 采样方法,选择: DDIM,即模型推荐方法。
  2. 迭代步数,选择: 30~50
  3. 宽度和高度:注意,如果要生成图像较宽,即 宽度:高度 > 2:1,建议拆分2次进行,以避免生成多个人像。即原图512x768 - 1024x768 - 1536x768,重复2次操作,即可。

即:

Stable Diffusion - ControlNet 插件中扩展局部重绘 InpaintOnly + LaMa 算法与应用,大模型(LLM&AIGC),stable diffusion,ControlNet,LaMa,Inpaint

通过 2 次扩展,即512x768 - 1024x768 - 1536x768,输出 1536x768 的图像:

Stable Diffusion - ControlNet 插件中扩展局部重绘 InpaintOnly + LaMa 算法与应用,大模型(LLM&AIGC),stable diffusion,ControlNet,LaMa,Inpaint

3. 提升细节

使用 ControlNet 的 Tile 模式,可以有效去除边缘过渡。

将图像转换至 图生图 模式,配置参数:

  1. 提示词保持不变。
  2. 选择 面部修复,因为重绘,就要选择 面部修复
  3. 重绘尺寸倍数,选择:2倍,即从1536x768 - 3072x1536
  4. 重绘幅度,选择:0.6
  5. 其余默认或与模型相关。

即:

Stable Diffusion - ControlNet 插件中扩展局部重绘 InpaintOnly + LaMa 算法与应用,大模型(LLM&AIGC),stable diffusion,ControlNet,LaMa,Inpaint

ControlNet 插件的 Tile 功能的配置:

  1. 启用:完美像素模式
  2. 控制类型,选择 Tile (分块)
  3. 预处理器,选择:tile_resample;模型,选择 control_v11f1e_sd15_tile
  4. 其余保持默认。

即:

Stable Diffusion - ControlNet 插件中扩展局部重绘 InpaintOnly + LaMa 算法与应用,大模型(LLM&AIGC),stable diffusion,ControlNet,LaMa,Inpaint

最终效果:

Stable Diffusion - ControlNet 插件中扩展局部重绘 InpaintOnly + LaMa 算法与应用,大模型(LLM&AIGC),stable diffusion,ControlNet,LaMa,Inpaint

其中,绿色手提包的局部细节对比,如下:

Stable Diffusion - ControlNet 插件中扩展局部重绘 InpaintOnly + LaMa 算法与应用,大模型(LLM&AIGC),stable diffusion,ControlNet,LaMa,Inpaint

4. 其他测试

模型:Dreamshaper_7

4.1 提示词

修改提示词,去除人物部分,增加场景描述,即:

((masterpiece)),raw photo,(photo realistic:1.2),(extremely detailed),high detail,
sharp focus,
streets full of sense of crisis,modern buildings with a sense of science and technology,
detailed buildings,detailed streets,
cyberpunk,halo,cyberpunk art,holography,
[(colorful explosion psychedelic paint colors:1.25)::0.25],
lora:more_details:1.2,lora:ClothingAdjuster2:-0.65,

负向提示词,可以保持不变,即:

UnrealisticDream,BadDream,
ng_deepnegative_v1_75t,bad_prompt_version2-neg,EasyNegative,(badhandv4:1.2),
logo,watermark,signature,username,letterbox,symbol,text box,censored,
multiple girls,2 girls,2 females,2 women,
missing toes,too many toes,extra fingers,missing fingers,fused fingers,too many fingers,mutated hands,malformed hands,poorly drawn hands,bad hands,
extra limbs,malformed limbs,floating limbs,disconnected limbs,missing arms,missing legs,extra arms,extra legs,mutated legs,long neck,
bad anatomy,bad proportions,disfigured,long body,
mutated,deformed,dehydrated,ugly,
naked,nipples,cleavage,
door frame,window frame,mirror frame,out of frame,
cropped,blurry,out of focus,monochrome,worst quality,low quality,jpeg artifacts,

4.2 配置缩放

选择:缩放后填充空白,同时调整宽高 2048x1024,长图,即:
Stable Diffusion - ControlNet 插件中扩展局部重绘 InpaintOnly + LaMa 算法与应用,大模型(LLM&AIGC),stable diffusion,ControlNet,LaMa,Inpaint

4.3 ADetailer

脸部:

detailed face,perfect face,portrait,close up,

手部:

detailed hands,detailed fingers,detailed nail, hands close up,

注意,在 LAMA 模式下,ADetailer 不起作用。

4.4 使用 Inpaint Only + LAMA 扩展

注意:一定要选择 更偏向ControlNet 模式,否则不起作用,即:

Stable Diffusion - ControlNet 插件中扩展局部重绘 InpaintOnly + LaMa 算法与应用,大模型(LLM&AIGC),stable diffusion,ControlNet,LaMa,Inpaint

4.5 使用 Tile 模式精修

控制模式:选择 更偏向ControlNet 模式,即:
Stable Diffusion - ControlNet 插件中扩展局部重绘 InpaintOnly + LaMa 算法与应用,大模型(LLM&AIGC),stable diffusion,ControlNet,LaMa,Inpaint
提示词,包括人物和场景的融合:

((masterpiece)),raw photo,(photo realistic:1.2),(extremely detailed),high detail,
sharp focus,
beautiful eyes,detailed eyes,detailed face,perfect facial details,perfect mouth,detailed lips,
solo,1girl,woman,asian girl,violet hair,long hair,
a girl with long hair and a blue dress and bling pantyhose standing in front of a neon background with stars and circles,
streets full of sense of crisis,modern buildings with a sense of science and technology,
detailed buildings,detailed streets,
more clothes,detailed clothes,colorful clothes,exquisite clothes,detailed shoes,perfect shoes,exquisite shoes,
focus on shoes detail,focus on fingers detail,
full body,full body photo,standing,
cyberpunk,halo,cyberpunk art,holography,
[(colorful explosion psychedelic paint colors:1.25)::0.25],
lora:more_details:1.2,lora:ClothingAdjuster2:-0.65,

效果对比,细节更多:

Stable Diffusion - ControlNet 插件中扩展局部重绘 InpaintOnly + LaMa 算法与应用,大模型(LLM&AIGC),stable diffusion,ControlNet,LaMa,Inpaint

其他

miaoshouai-assistant (喵手助理) 插件

添加 miaoshouai-assistant,安装链接,扩展 - 从网址安装

https://ghproxy.com/https://github.com/miaoshouai/miaoshouai-assistant.git

遇到 Bug,TypeError: 'type' object is not subscriptable

File "stable-diffusion-webui/extensions/miaoshouai-assistant/scripts/runtime/msai_prelude.py", line 116, in MiaoshouPrelude
        def ENV_EXCLUSION(self) -> list[str]:
    TypeError: 'type' object is not subscriptable

源码:miaoshouai-assistant/scripts/runtime/msai_prelude.py,返回类型错误,修改即可:

# def ENV_EXCLUSION(self) -> list[str]:
def ENV_EXCLUSION(self) -> list:

暂时并未使用。文章来源地址https://www.toymoban.com/news/detail-564091.html

到了这里,关于Stable Diffusion - ControlNet 插件中扩展局部重绘 InpaintOnly + LaMa 算法与应用的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Stable DIffusion系统教程 | 局部重绘,增删修改的魔法棒

    目录 1. 基本操作 1.1 步骤1 补充提示词 1.2 步骤2 绘制蒙版 1.3 步骤3 参数设置 2.局部重绘其他应用 2.1 手绘蒙版 2.2 删除某些东西 之前我们熟悉了AI绘画的各类模型,提示词写法,图像放大等技巧。但我们目前所有的操作都是针对整张图片的。 但是我们有些时候会遇到这样一种

    2024年02月09日
    浏览(34)
  • Stable Diffusion - 高清局部重绘 (Inpaint) 调整脸部和手部细节

    欢迎关注我的CSDN:https://spike.blog.csdn.net/ 本文地址:https://spike.blog.csdn.net/article/details/131775232 在 Stable Diffusion 中,局部重绘(Inpaint)功能是一种可以让你在图像上删除不想要的区域,并用周围的像素自动填充的功能。这样,你可以轻松地修复瑕疵,去除干扰物,或者创造新的效

    2024年02月16日
    浏览(25)
  • 【stable diffusion】保姆级入门课程04-Stable diffusion(SD)图生图-局部重绘的用法

    目录 0.本章素材 1.什么是局部重绘 2.局部重绘和涂鸦有什么不同 3.操作界面讲解 3.1.蒙版模糊 3.2.蒙版模式 3.3.蒙版蒙住的内容 3.4.重绘区域 4.局部重绘的应用(面部修复) 5.课后训练 局部重绘是不改变整体图片的构图的情况下,对图片的某个区域进行重绘,局部重绘是利用蒙

    2024年02月16日
    浏览(35)
  • Stable Diffusion局部重绘功能,如何完美抹掉不想要的物体?

    网上一堆文生图教程,这种抽卡式东西玩几天就没有意思了,怎么按照自己的意愿生成自己的图是非常有意思的东西,所以我对局部重绘特别感兴趣,借助 SD 的扩散算法,如何利用它的扩散算法来向着自己期望的方向上呈现,就有一种成就感 局部重绘,B站一堆教程,不行就

    2024年02月09日
    浏览(44)
  • AI绘图:Stable Diffusion ComfyUI局部重绘与智能扩图全面教程

    在数字艺术创作中,局部重绘和智能扩图是两个非常重要的功能。局部重绘允许我们在保留原有图像的基础上,对特定区域进行修改或创新。而智能扩图则能够帮助我们在图像的边缘添加新的元素,从而扩展图像的内容。本文将详细介绍如何在Stable Diffusion ComfyUI中实现这两个

    2024年04月12日
    浏览(40)
  • AI 绘画用 Stable Diffusion 图生图局部重绘功能给美女换装(这是我能看的嘛)

    昨天带大家一起装好了 Stable Diffusion 的环境,今天就来带大家一起体验一下 Stable Diffusion 的 局部重绘 功能。 没装好环境的可以看上一篇:AI 绘画基于 Kaggle 10 分钟搭建 Stable Diffusion(保姆级教程) Stable Diffusion 的局部重绘使用非常简单,大家按图一步步操作即可: 点击“图

    2024年02月11日
    浏览(39)
  • 仅做笔记用:Stable Diffusion 通过 ControlNet 扩展图片 / 扩图

    发觉之前的 Outpainting 脚本效果仍旧不是很理想。这里又找了一下有没有效果更好的途径来扩图。于是就找到了通过 ControlNet 的方式来实现效果更好的扩图。这里临时记录一下在 Stable Diffusion 怎么使用 ControlNet 来扩展图片。 下载 control_v11p_sd15_inpaint_fp16.safetentors ,放到 SD 目录

    2024年02月06日
    浏览(44)
  • Stable Diffusion中的ControlNet插件

    ControlNet 的中文就是控制网,本质上是Stable Diffusion的一个扩展插件,在2023年2月份由斯坦福大学的研究人员开发出来的,能够使创作者轻松地控制AI图像和视频中的对象。它将根据边缘检测、草图处理或人体姿势等各种条件来控制图像生成。ControlNet可以概括为一种简单的稳定

    2024年02月09日
    浏览(37)
  • Stable Diffusion 准确绘制人物动作及手脚细节(需ControlNet扩展)

    目前AI绘图还是比较像开盲盒,虽然能根据语义提供惊艳的图片,但是与设计师所构思的目标还是有一定距离。 那像我们这种没有绘画功底的程序员想要制作出心中的人物(尤其手脚)姿态,该怎样减少随机开盒的次数呢? 本文提供几种精确控制人物动作的方法。 安装及其

    2023年04月08日
    浏览(41)
  • 精讲stable diffusion的controlNet插件

    controlNet插件是stable diffusion的一个重要插件,甚至可以说正是因为有了controlNet插件,stable diffusion才会具有midjourney所不具备的独特魅力! 我们今天就一起来学习下controlNet插件的安装和每个模型的用法 插件主页 独立的controlNet程序(可独立运行,不依赖于stable diffusion)主页:

    2024年02月06日
    浏览(29)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包