局部重绘
本系列博客笔记主要参考B站nenly同学的视频教程,传送门:B站第一套系统的AI绘画课!零基础学会Stable Diffusion,这绝对是你看过的最容易上手的AI绘画教程 | SD WebUI 保姆级攻略_哔哩哔哩_bilibili
我们使用SD生成一张整体满意但是某些细节存在问题的时候(比如手没有画好),此时我们不需要舍弃这张画重新生成,而是可以使用局部重绘对一张图片的细节进行修补。
局部重绘流程
让我们从一个具体的例子入手,看看如何操作局部重回的每一步,使用局部重绘,使下面的一张图中女孩的眼睛闭上
A girl, walking in the forest, the sun fell on her body, (masterpiece:1.2), best quality, highres, original, extremely detailed wallpaper, perfect lighting,(extremely detailed CG:1.2), looking at viewer, close-up, upper body,
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++ SDE Karras, CFG scale: 8, Seed: 1315345756, Face restoration: GFPGAN, Size: 800x450, Model hash: 038ba203d8, Clip skip: 2, ENSD: 31337
点击【图生图】,然后进入【局部重绘】,在其中上传我们的原始图像
局部重绘和图生图最大的不同就是右上角的一些关于画笔的操作,包括画笔粗细的调节,擦除和回撤功能
在进行重绘的时候,有一些地方需要注意,比如模型应该和原画保持一致,画面大小应该保持一致等。然后使用画笔作画覆盖需要调整的地方,且在提示词中进行相应的修改。
局部重绘参数
局部重绘和图生图相比多出了这些参数,让我来一一讲解一下这些参数的含义
蒙版边缘模糊:蒙版区域在重绘后拼接回去的时候,会和原图产生一些硬接触的边缘,这个数值通常在10以下就能获得较好的效果,过大可能影响到周围区域的读取
蒙版模式很简单,字面意思
蒙版区域内容处理,涉及到对蒙版区域进行重新绘制的时候使用的加噪方法等,和放大算法类似,这四种方法其实并没有很明显的优劣之分
重绘区域:整张图片的重绘通常更加自然。仅蒙版的话对蒙版区域的刻画更加细致,但在拼接的时候容易出现明显的过度边缘
预留像素类似于放大算法中的过度区域,在蒙版较大时可以适当增大
涂鸦重绘
涂鸦重绘相比于局部重绘给了画笔更高的自由度,很像我们之前使用过的图生图中的涂鸦生成图画的功能,让我们使用涂鸦重绘功能,让下面图片中的人物戴上一个黑色的口罩
(masterpiece:1.3), (8k, photorealistic, RAW photo, best quality: 1.4), 1girl, beautiful face, (realistic face), (black hair, short hair:1.3), beautiful hairstyle, (realistic eyes), beautiful detailed eyes, long eyelashes, (realistic skin), beautiful skin, [medium breasts:0.2], (perfect body:1.3), (detailed body:1.2), (necktie), (collared shirt, pleated skirt:1.3), absurdres, attractive, ultra high res, ultra realistic, highly detailed, soft lightning, golden ratio,
(black face mask:1.5)
Negative prompt: NSFW, painting, sketches, text, cropped, jpeg artifacts, ((monochrome)), ((grayscale)), (worst quality, low quality, normal quality, blurry:1.4), (ugly, morbid, mutation, disfigured:1.3), (more than 1 person), out of frame, long neck, age spot, skin blemishes, mole, acnes, cross-eyed, unbalanced eyes, different eyes color, extra fingers, mutated hands, bad anatomy, long nails, bad proportions, extra limbs, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, twisted legs, fused legs, long neck, username, watermark, poor facial details, bad composition, deformed body features, easynegative, bad-hands-5, ng_deepnegative_v1_75t, bad-picture-chill-75v, bad-image-v2-39000
Steps: 20, Sampler: DPM++ SDE Karras, CFG scale: 7, Seed: 3702691778, Size: 512x768, Model hash: 038ba203d8, Model: 二次元:AbyssOrangeMix2_sfw, Denoising strength: 0.8, Clip skip: 2, ENSD: 31337, Mask blur: 10