嚴華 发表于 2024-9-5 04:43:37

少年侠客【InsCode Stable Diffusion美图运动一期】

少年侠客【InsCode Stable Diffusion美图运动一期】


爆火的Ai生图你体验到了吗?
没有绘画能力、摄影能力也能随心所欲的创作出本身的作品!
但是很多人因为高昂的硬件和繁琐的安装对它望而却步。
lnscode提供了学习和使用Stable Diffusion的环境,已经安装了相干软件和组件库,可直接启动Stable Diffusion WebUI进行创作
Stable Diffusion 模子在线使用地点

   一、 Stable Diffusion 模子在线使用地点:
https://inscode.csdn.net/@inscode/Stable-Diffusion
第一张图

   二、模子版本及相干配置:
模子:primemix_v21.safetensors
采样方法(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
https://i-blog.csdnimg.cn/blog_migrate/b4b63da485b1a5b1114617482623180f.png
   第二张图

   模子版本及相干配置:
模子:primemix_v21.safetensors
采样方法(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
   https://i-blog.csdnimg.cn/blog_migrate/a119310f4795e5dc35358f072d7130cb.png
    第三张图

   模子版本及相干配置:
模子:primemix_v21.safetensors
采样方法(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
   https://i-blog.csdnimg.cn/blog_migrate/4164c2da46ef53e951418d7d99a7c790.png
    第四张图

   模子版本及相干配置:
模子:primemix_v21.safetensors
采样方法(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
   https://i-blog.csdnimg.cn/blog_migrate/93de0494fc5fac3e85d48f05df7ad53c.png
    第五张图

   模子版本及相干配置:
模子:primemix_v21.safetensors
采样方法(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
   https://i-blog.csdnimg.cn/blog_migrate/c364ebed3be84fc8303a7f9e9be96bf0.png
    第六章图

   模子版本及相干配置:
模子:chilloutmix-Ni.safetensors
采样方法(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
   https://i-blog.csdnimg.cn/blog_migrate/0f6930bdb5dc527114100f312bbf077d.png
    一、InsCode Stable Diffusion 体验

1.1 界面很友好

按照提示步骤即可启动环境
https://i-blog.csdnimg.cn/blog_migrate/9f1d4691c3b10a5f5cce77222c5a3247.png
1.2 小小体验一下

打开Stable Diffusion WebUI界面
https://i-blog.csdnimg.cn/blog_migrate/832ec2a013aefc02e2c458c71910708d.png
输入文章开头的正向词,反向词及其他参数设置如下图,生成精美的图片
https://i-blog.csdnimg.cn/blog_migrate/a4bd9d8355d29a1a7cd31179bedec470.png
1.3 体验感受

生成速度很快哈哈,比本身老年机本地部署生成图片要快很多
二、如安在InsCode给Stable Diffusion安装Lora

步骤参照如安在InsCode给Stable Diffusion安装Lora
三、Stable Diffusion 调参基础

3.1 模子选择

模子使用的数据集和标签对于效果影响非常重要,在使用之前要先了解数据来源。
3.2 Stable Diffusion 模子

Stable Diffusion 模子适用于生成与照片、艺术品雷同的图像。基于 LAION 数据集练习。
3.3 常用参数介绍



[*]Prompt(提示词):对你想要生成的东西进行笔墨形貌。
[*]Negative prompt(反向提示词):用笔墨形貌你不希望在图像中出现的东西。
[*]Sampling Steps(采样步数):扩散模子的工作方式是从随机高斯噪声向符合提示的图像迈出小步。这样的步骤应该有多少个。更多的步骤意味着从噪声到图像的更小、更精确的步骤。增加这一点直接增加了生成图像所需的时间。回报递减,取决于采样器。
[*]Sampling method(采样器):使用哪种采样器。Euler a(ancestral 的简称)以较少的步数产生很大的多样性,但很难做小的调整。随着步数的增加,非 ancestral 采样器都会产生根本雷同的图像,如果你不确定的话,可以使用 LMS。
[*]Batch count/n_iter:每次生成图像的组数。一次运行生成图像的数量为 Batch count * Batch size。
[*]Batch size:同时生成多少个图像。增加这个值可以提高性能,但你也需要更多的 VRAM。图像总数是这个值乘以批次数。除 4090 等高级显卡以外通常保持为 1。
[*]CFG Scale(无分类引导规模):图像与你的提示的匹配程度。增加这个值将导致图像更接近你的提示(根据模子),但它也在一定程度上低落了图像质量。可以用更多的采样步骤来抵消。
[*]Width:图像的宽度,像素。要增加这个值,你需要更多的显存。大尺度的图像划一性会随着分辨率的提高而变差(模子是在 512x512 的基础上练习的)。非常小的值(比方 256 像素)也会低落图像质量。这个值必须是 8 的倍数。
[*]Height:图像高度。
[*]Seed:随机数的起点。保持这个值不变,可以多次生成雷同(或几乎雷同,如果启用了 xformers)的图像。没有什么种子天生就比其他的好,但如果你只是轻微改变你的输入参数,从前产生好效果的种子很可能仍然会产生好效果。
3.4 Sampling steps 迭代步数

更多的迭代步数可能会有更好的生成效果,更多细节和锐化,但是会导致生成时间变长。而在实际应用中,30 步和 50 步之间的差别几乎无法区分。
太多的迭代步数也可能适得其反,几乎不会有提高。
进行图生图的时间,正常情况下更弱的降噪强度需要更少的迭代步数(这是工作原理决定的)。你可以在设置里更改设置,让程序确切执行滑块指定的迭代步数。
3.5 Samplers 采样器

现在好用的有 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 是最简单的,因此也是最快的之一
3.6 CFG Scale 提示词相干性

cfg scale 是图像与提示词的契合度,该值越高,提示词对最终生成效果的影响越大,契合度越高。
过高的 CFG Scale 体现为粗犷的线条和过锐化的图像。
3.7 留意尺寸

出图尺寸太宽时,图中可能会出现多个主体。
要匹配好姿势,镜头和人物才不畸形,有时间需要限定量词,多人物时要处理惩罚空间关系和 prompt 遮挡优先级。人数->人物样貌->环境样式->人物状态
1024 之上的尺寸可能会出现不理想的效果!保举使用 小尺寸分辨率 + 高清修复(下方介绍)。
3.8 Highres. fix 高清修复

通过勾选 txt2img(文生图) 页面上的 “Highres. fix” 复选框来启用。
默认情况下,txt2img(文生图) 在高分辨率下会生成非常混沌的图像。该选项会使得模子起首生成一张小图片,然后通过 img2img 将图片分辨率扩大,以实现高清大图效果。
3.9 Batch Count 与 Batch Size



[*]Batch Count(生成批次) 指定共生成几个批次。
[*]Batch Size(每批数量) 指定每个批次并行生产多少张图片。
大的 Batch Size 需要消耗巨量显存。若您的显卡没有超过 12G 的显存,请不要调节 Batch Size。
对于显存极大的显卡而言,一次生成一张图片无法充分利用显卡计算容量,此时可将 Batch Size 提高以充分压榨算力。
3.10 随机种子

理论上,种子决定模子在生成图片时涉及的全部随机性。
实际的种子数值并不重要。它只是初始化一个界说扩散起点的随机初始值。
在应用完全雷同参数(如 Step、CFG、Seed、prompts)的情况下,生产的图片应当完全雷同。(不使用 xformers 等会带来干扰的优化器)
不同显卡由于微架构不同,可能会造成预料之外的不同效果。主要体如今 GTX 10xx 系列显卡上。
3.11 Denoising strength 降噪强度

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

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: 少年侠客【InsCode Stable Diffusion美图运动一期】