赞
踩
少年侠客【InsCode Stable Diffusion美图活动一期】
没有绘画能力、摄影能力也能随心所欲的创作出自己的作品!
但是很多人因为高昂的硬件和繁琐的安装对它望而却步。
lnscode提供了学习和使用Stable Diffusion的环境,已经安装了相关软件和组件库,可直接启动Stable Diffusion WebUI进行创作
一、 Stable Diffusion 模型在线使用地址:
https://inscode.csdn.net/@inscode/Stable-Diffusion
二、模型版本及相关配置:
模型:primemix_v21.safetensors [b79a4f7283]
采样方法(Sampler):DPM++ 2M Karras
采样迭代步数(steps): 28
宽度(Width): 521
高度(Height): 768
生成批次(Batch count):1
每批数量(Batch size): 1
提示词相关性(CFG Scale):7
三、图片提示词与反向提示词:
正向提示词:
official art, unity 8k wallpaper, (high detail), beautiful and aesthetic, masterpiece, best quality,realistic, mage, feathered fan, wind spell, mountain, hanfu Delicate Illumination, Soft Highlights, Understated Depth, <lora:JPKniji5 oc_v10:0.2> lora:LowRA:0.8 lora:CAMERALora_v20:0.6 lora:JPKKKKKK3dCGStyleRealistic_v10:0.3 lora:xiaorenshu:0.35,lightonface,cinemalights,professionallighting,photonmapping,radiosity,.
反向提示测:
,wings,(Monotonous color:1.2),sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, (outdoor:1.6), manboobs, backlight,(ugly:1.331), (duplicate:1.331), (morbid:1.21), (mutilated:1.21), (tranny:1.331), mutated hands, (poorly drawn hands:1.331), blurry, (bad anatomy:1.21), (bad proportions:1.331), extra limbs, (disfigured:1.331), (more than 2 nipples:1.331), (missing arms:1.331), (extra legs:1.331), (fused fingers:1.61051), (too many fingers:1.61051), (unclear eyes:1.331), bad hands, missing fingers,(Four fingers:1.331), (six fingers:1.331),(extra hand:1.331), (extra leg:1.4),extra digit, (Pseudo Niang:1.1),(Ladyboy:1.4) ,bad body,(Watermark:1.4) ,(An incoherent picture:1.2),(No logic:1.331),(Less hair:1.2),(A gloomy picture:1.1) ,NG_DeepNegative_V1_75T, glans, refraction, diffusion, diffraction, (worst quality, low quality:1.4)…
种子:258369
模型版本及相关配置:
模型:primemix_v21.safetensors [b79a4f7283]
采样方法(Sampler):DPM++ 2M Karras
采样迭代步数(steps): 35
其他设置同图1
图片提示词与反向提示词:
正向提示词:(Clear face),Exquisite details,(Realistic clothing texture),Real ambient light,Clear skin texture,.Depth of Field, Scatter, Halo,Black Soft Filter, Nikon D850,Lens spot,VSCO,high-level,.Best quality, masterpiece,Photos, photography works, masterpieces, DHR, 8K,Complex details,High resolution, high detail RAW, wallpaper,Film texture,Real, (real person),.A handsome young man, Xiake, with an extremely long black ponytail and a red dot mark between his eyebrows. In the palace of the dark night, he fights against masked enemies in a battle posture, with the light of a torch illuminating the falling snowflakes. The long sword emits a faint silver white halo, and in movie stills, all body,.
反向提示词:watermark, painting, cartoons, sketch, (worst quality:2), (low quality:2), (normal quality:1), lowers, bad.anatomy, bad hands, ((monochrome)), ((grayscale)), ugly, duplicate, mutilated, extra fingers, mutated hands, poorly.drawn hands, mutation, bad anatomy, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing.arms, extra arms, extra legs, fused fingers, too many fingers, (nipples:1.5),Strange face,…
种子:258371
模型版本及相关配置:
模型:primemix_v21.safetensors [b79a4f7283]
采样方法(Sampler):DPM++ 2M Karras
采样迭代步数(steps): 35
其他设置同图1
图片提示词与反向提示词:
正向提示词:(Clear face),Exquisite details,(Realistic clothing texture),Real ambient light,Clear skin texture,.Depth of Field, Scatter, Halo,Black Soft Filter, Nikon D850,Lens spot,VSCO,high-level,.Best quality, masterpiece,Photos, photography works, masterpieces, DHR, 8K,Complex details,High resolution, high detail RAW, wallpaper,Film texture,Real, (real person),.A handsome young man, Xiake, with an extremely long black ponytail and a red dot mark between his eyebrows. In the palace of the dark night, he fights against masked enemies in a battle posture, with the light of a torch illuminating the falling snowflakes. The long sword emits a faint silver white halo, and in movie stills, all body,.
反向提示词:watermark, painting, cartoons, sketch, (worst quality:2), (low quality:2), (normal quality:1), lowers, bad.anatomy, bad hands, ((monochrome)), ((grayscale)), ugly, duplicate, mutilated, extra fingers, mutated hands, poorly.drawn hands, mutation, bad anatomy, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing.arms, extra arms, extra legs, fused fingers, too many fingers, (nipples:1.5),Strange face,…
种子:258371
模型版本及相关配置:
模型:primemix_v21.safetensors [b79a4f7283]
采样方法(Sampler):DPM++ 2M Karras
采样迭代步数(steps): 35
其他设置同图1
图片提示词与反向提示词:
正向提示词:(8k, RAW photo, best quality, masterpiece:1.2), (realistic, photo-realistic:1.37),(feiwangzi,1boy),fly,building, castle, city, cityscape, cloud, cloudy_sky,standing,
反向提示词:(EasyNegative:1.2), ng_deepnegative_v1_75t, paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), bad anatomy,(long hair:1.4),DeepNegative,(fat:1.2),facing away, looking away,tilted head,lowres,bad anatomy,bad hands, text, error, missing fingers,extra digit, fewer digits, cropped, worst quality, low quality, normal quality,jpegartifacts,signature, watermark, username,blurry,bad feet,cropped,poorly drawn hands,poorly drawn face,mutation,deformed,worst quality,low quality,normal quality,jpeg artifacts,signature,watermark,extra fingers,fewer digits,extra limbs,extra arms,extra legs,malformed limbs,fused fingers,too many fingers,long neck,cross-eyed,mutated hands,polar lowres,bad body,bad proportions,gross proportions,text,error,missing fingers,missing arms,missing legs,extra digi
种子:258373
模型版本及相关配置:
模型:primemix_v21.safetensors [b79a4f7283]
采样方法(Sampler):DPM++ 2M Karras
采样迭代步数(steps): 35
其他设置同图1
图片提示词与反向提示词:
正向提示词:(8k, RAW photo, best quality, masterpiece:1.2), (realistic, photo-realistic:1.37),(3Drender,octane render),kai,1boy,solo,(upper body,night,standing,40 old)
反向提示词:(EasyNegative:1.2), ng_deepnegative_v1_75t, paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), bad anatomy,(long hair:1.4),DeepNegative,(fat:1.2),facing away, looking away,tilted head,lowres,bad anatomy,bad hands, text, error, missing fingers,extra digit, fewer digits, cropped, worst quality, low quality, normal quality,jpegartifacts,signature, watermark, username,blurry,bad feet,cropped,poorly drawn hands,poorly drawn face,mutation,deformed,worst quality,low quality,normal quality,jpeg artifacts,signature,watermark,extra fingers,fewer digits,extra limbs,extra arms,extra legs,malformed limbs,fused fingers,too many fingers,long neck,cross-eyed,mutated hands,polar lowres,bad body,bad proportions,gross proportions,text,error,missing fingers,missing arms,missing legs,extra digi,((holding_weapon,holding,weapon,sword))
种子:258376
模型版本及相关配置:
模型:chilloutmix-Ni.safetensors[7234b76e42]
采样方法(Sampler):DPM++ 2M Karras
采样迭代步数(steps): 50
其他设置同图1
图片提示词与反向提示词:
正向提示词:Masterpiece, 1girl, close up, wear blue hanfu, Chinese Traditional cloth, ((holding a water sword,)) long black hair, hair braid, blue wave background, water effect, ink painting style, dynamic pose, battle pose
反向提示词:EasyNegativeV2, ng_deepnegative_v1_75t, (low_quality:1.4), (worst_quality:1.4), (badhandv4:1.1),collage, artist_name, signature, artist_logo, watermark
种子:258370
按照提示步骤即可启动环境
打开Stable Diffusion WebUI
界面
输入文章开头的正向词,反向词及其他参数设置如下图,生成精美的图片
生成速度很快哈哈,比自己老年机
本地部署生成图片要快很多
步骤参照如何在InsCode给Stable Diffusion安装Lora
模型使用的数据集和标签对于效果影响非常重要,在使用之前要先了解数据来源。
Stable Diffusion 模型适用于生成与照片、艺术品类似的图像。基于 LAION 数据集训练。
更多的迭代步数可能会有更好的生成效果,更多细节和锐化,但是会导致生成时间变长。而在实际应用中,30 步和 50 步之间的差异几乎无法区分。
太多的迭代步数也可能适得其反,几乎不会有提高。
进行图生图的时候,正常情况下更弱的降噪强度需要更少的迭代步数(这是工作原理决定的)。你可以在设置里更改设置,让程序确切执行滑块指定的迭代步数。
目前好用的有 Euler
,Euler a
(更细腻),和 DDIM
。
推荐 Euler a
和 DDIM
,新手推荐使用 Euler a
Euler a
富有创造力,不同步数可以生产出不同的图片。调太高步数 (>30) 效果不会更好。
DDIM
收敛快,但效率相对较低,因为需要很多 step 才能获得好的结果,适合在重绘时候使用
LMS
和 PLMS
是 Euler
的衍生,它们使用一种相关但稍有不同的方法(平均过去的几个步骤以提高准确性)。大概 30 step 可以得到稳定结果
PLMS
是一种有效的 LMS(经典方法),可以更好地处理神经网络结构中的奇异性
DPM2
是一种神奇的方法,它旨在改进 DDIM,减少步骤以获得良好的结果。它需要每一步运行两次去噪,它的速度大约是 DDIM 的两倍。但是如果你在进行调试提示词的实验,这个采样器效果不怎么样
Euler
是最简单的,因此也是最快的之一
cfg scale
是图像与提示词的契合度,该值越高,提示词对最终生成结果的影响越大,契合度越高。
过高的 CFG Scale 体现为粗犷的线条和过锐化的图像。
出图尺寸太宽时,图中可能会出现多个主体。
要匹配好姿势,镜头和人物才不畸形,有时候需要限定量词,多人物时要处理空间关系和 prompt 遮挡优先级。人数->人物样貌->环境样式->人物状态
1024 之上的尺寸可能会出现不理想的结果!推荐使用 小尺寸分辨率 + 高清修复(下方介绍)。
通过勾选 txt2img(文生图) 页面上的 “Highres. fix” 复选框来启用。
默认情况下,txt2img(文生图) 在高分辨率下会生成非常混沌的图像。该选项会使得模型首先生成一张小图片,然后通过 img2img 将图片分辨率扩大,以实现高清大图效果。
Batch Count(生成批次)
指定共生成几个批次。Batch Size(每批数量)
指定每个批次并行生产多少张图片。大的 Batch Size 需要消耗巨量显存。若您的显卡没有超过 12G 的显存,请不要调节 Batch Size。
对于显存极大的显卡而言,一次生成一张图片无法充分利用显卡计算容量,此时可将 Batch Size
提高以充分压榨算力。
理论上,种子决定模型在生成图片时涉及的所有随机性。
实际的种子数值并不重要。它只是初始化一个定义扩散起点的随机初始值。
在应用完全相同参数(如 Step、CFG、Seed、prompts)的情况下,生产的图片应当完全相同。(不使用 xformers
等会带来干扰的优化器)
不同显卡由于微架构不同,可能会造成预料之外的不同结果。主要体现在 GTX 10xx 系列显卡上。
Denoising strength
仅在 img2img(图生图)或 高清修复 时被应用,其表征最后生成图片对原始输入图像内容的变化程度。通过调整该值,可以降低对画风的影响,但也会弱化 img2img 能力。值越高 AI 对原图的参考程度就越低 (同时增加迭代次数)。
对于图生图来说,低 denoising
意味着修正原图,高 denoising
就和原图就没有大的相关性了。一般来讲阈值是 0.7 左右,超过 0.7 和原图基本上无关,0.3 以下就是稍微改一些。
实际执行中,具体的执行步骤为 Denoising strength * Sampling Steps。
下一章节内容:文字生成图片如何写提示词
站外发布
掘金:https://juejin.cn/post/7256302444387795005
51CTO:https://blog.51cto.com/u_15067771/6741182
支付宝开发者社区:https://open.alipay.com/portal/forum/post/131301015
阿里云社区:https://developer.aliyun.com/article/1276080
info社区:https://xie.infoq.cn/article/d88497eb5644c10ea3dc82b47
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。