GUI
我将向您展示如何使用 AUTOMATIC1111 GUI 进行操作。请参阅我的快速入门指南以了解如何在 Google 的云服务器中进行设置。
风格化图像的工作流程
基本理念
基本思想是使用 img2img 以文本提示中指定的新样式修改图像。
不是使用随机潜在状态,而是使用原始图像对初始潜在状态进行编码。添加少量由去噪强度控制的随机性,模型根据文本提示构建新图像。
因此,如果您在文本提示中包含铅笔画,合成图像将包含铅笔画的视觉元素,但图像的内容仍沿用原始图像。
分步工作流程
好的,这些理论性的东西已经足够了!这是您实际执行此操作的方法。
我将使用以下通过维多利亚女孩提示生成的起始图像:

要风格化的原始图像。
在 AUTOMATIC1111 GUI 中,转到 img2img 选项卡并选择 img2img 子选项卡。将图像上传到 img2img 画布。

接下来,您需要给出提示。提示应描述新样式和原始图像的内容。它不需要非常详细。以下是我将使用的内容。
一个美丽的女人
将艺术风格插入空白。(例如美女的炭笔素描)
对于风格化图像,您将最常调整两个参数:CFG 比例和去噪强度。
RECAPCFG 比例控制模型应遵循提示的程度。越高越跟随。去噪强度控制图像应该改变多少。越低,变化越少。
如果你想系统化,你可以使用 X/Y plot 脚本来探索 CFG 尺度和去噪强度之间的相互作用。图像由种子值指定。

X/Y 绘图脚本设置。
使用提示:
一个美丽的女人的铅笔素描
以下是您将得到的。

CFG 尺度与去噪强度的 X/Y 图
当去噪强度高时,图像变化太大,失去了原有的内容。当它很低时,变化不大。
CFG 等级越高,风格越强。
50 步的欧拉抽样方法适用于大多数情况。
根据经验,将 CFG 比例设置为 20-30 之间的较高值,并将去噪强度更改为 0.2 到 0.6 之间,以在保留内容的同时实现良好的风格化。
程式化图片示例
本节中的所有风格化图像都是从下面的原始图像生成的,样本为零。仅提供文字提示。

原来的
这里有一些程式化的图像。提示是
一个美丽女人的______
空白由标题填充。

木炭

印象派

流行艺术

艺术装饰

照片

新艺术风格

立体主义

约翰萨金特

格雷格·鲁特科夫斯基

3D角色

石雕

梵高

漫画

现代时尚
也可以将模型切换到不同的种族。

日本人

非洲人

西班牙裔
替代方法
喜欢冒险的读者可以尝试所谓的alternative img2img test,它可以比上述方法更好地保留原始图像的内容。
这个想法是使用原始图像来创建潜在的噪声模式,以便它包含原始内容的信息。
要使用替代噪声,请在脚本下拉菜单中选择 img2img 替代测试。

新用户应该通过功能演示中的示例。与演示相反,我发现增加 CFG 比例很有用,以便遵循提示。有时需要增加样式关键字的权重。
下面是使用替代 img2img 生成的波普艺术风格的示例。

使用替代 img2img 的波普艺术风格。
是否更好将是一个品味问题,但它绝对紧跟原始内容。
将其视为工具箱中的工具。
概括
我已经向您展示了使用 Stable Diffusion 对图像进行风格化是多么容易。您需要做的就是使用 img2img 方法,提供提示,调高 CFG 比例,并调整去噪强度。
我希望这会激发你创作一些新的艺术作品!