Stable Diffusion 是一款开源软体,得益于全球许多工程师的共同努力和贡献,它的功能不断完善和优化。最初,使用 Stable Diffusion 可能需要在电脑上拥有高阶显示卡,并消耗大量机器资源才能运作。然而,现在的情况已经有所改变。
由于 Google Colab 这种免费的云端运算平台的出现,使用者现在可以直接在浏览器上运行 Stable Diffusion,而无需担心硬体需求和资源消耗。Google Colab 提供了一个方便的环境,让任何人都可以轻松地在云端运行 AI 模型,而无需自己配置硬体设备。以下是在Google Colab上使用Stable Diffusion流程:
- 选择 Github 上面开源的笔记本档案
- 使用 Google Colab 架设 Stable Diffusion WebUI 环境
- 进入 Stable Diffusion WebUI 内提供 Prompt 关键字咒语以及设计图片参数
- 产生数张不同的 AI 图片
这意味著,无论您使用的是什么装置,甚至是手机,您都可以免费使用 Stable Diffusion 进行 AI 绘图。这大大降低了使用门槛,让更多人能够享受到 AI 绘图带来的便捷和创意乐趣。如果你还不认识Stable Diffusion,可以参考 Stable Diffusion教学:深度解析ai绘图
看完本篇可以學到:
利用Google colab免费使用Stable Diffusion
Time needed: 12 minutes
4步骤部属Stable Diffusion到Google Colab
- 从Colab笔记本清单进行挑选
在 Github 会有很多已经写好档案可以直接一键使用,camenduru制作的stable-diffusion-webui-colab是目前最多模型可供选择的地方:
训练好的Stable Diffusion模型ChilloutMix是目前亚洲最多人使用的,作出来的图片成效非常逼近真人,也因为里面都是用韩星进行训练好的模型,偏向亚洲人的喜好;可在Github页面直接搜寻ChilloutMix。
这边是一些我用Chillout做出来的图片
另一个推荐的是Perfect World,做出来的效果也很棒
- 云端安装Stable Diffusion WebUI
找到『chillout_mix_webui_colab 』,点中间那个写stable的小图示后会自动跳转到Google Colab 页面,不止Stable Diffusion直接可以一键部属,连进阶plugin ControlNet都安装到位。
- 执行Colab笔记本
到Google Colab页面,点选画面左上方的执行按钮
点下开始运行后会需要确认执行,确认后Stable Diffusion就开始在 Google Colab部属啰,大约10分钟以内就可以完成。
- 开启Stable Diffusion网页版页面(WebUI)
判断完成的方式很简单,看到页面下方出现两行网址就是安装完成啰!两个网址都能点击,都会一样到运行于Google Colab的Stable Diffusion网页版页面(WebUI)。
*注意,每个Google帐号每天有做图运算额度限制,超过使用量可以换另一个帐号马上继续用,或是维持原帐号等24小时后再用。
Stable Diffusion 的 WebUI 教学
我们会在Stable Diffusion 的 WebUI 介面,输入关键字、咒语与调整调整参数来产图。以下教学使用Perfect World模型当案例。
Stable Diffusion 的 WebUI 介面说明
当 Stable Diffusion 网页版介面建立好,首先左上角可以看到现在使用的模型,接著中间是让我们能够跟Ai沟通的核心区域:关键字咒语输入区。Stable Diffusion关键字,英文是Prompt,又称为Stable Diffusion咒语。用Ai绘图的人称为Ai咏唱师,可以参考 Ai咏唱师3种赚钱技能
这边有两个区块:
- Prompt在上半部,是我们要Ai绘图的各种指示
- Negative Prompt在下半部,是我们要Ai绘图时必须避开的各种指示
下方的叙述则是图片宽度、高度、产生几张图等设定,如果你算出来的人物坏掉再勾选 Restore Face即可,我通常不用这个功能
CFG Scale则是告诉Ai他绘图的自由度,数字越小表示越自由创作,越大则表示需要更遵守你的咒语关键字,我通常会使用6.5,而当灵感枯竭时会调整到3:建议Stable Diffusion的CFG Scale使用3~7即可。
Stable Diffusion WebUI的Ai电绘实作教学
提供两个我画的图片使用的咒语prompt与Negative Prompt
prompt
realistic 8k, picture-perfect face, flawless, clean, masterpiece, professional artwork, famous artwork, cinematic lighting, cinematic bloom, perfect face, beautiful face, beautiful eyes, ((perfect female body, narrow waist)), fantasy, dreamlike, unreal, science fiction,1girl, intricate detail, delicate pattern, sexy, charming, alluring, seductive, erotic, enchanting,
smiling, looking away, pink hair, undercut, apron, amazing body, 1girl, corset, cinematic, (portrait), sideface, foreshortening, breasts, cleavage, full_body, high_heels, long_hair, solo, depth_of_field, outdoors, realistic, photo_\(medium\), photorealistic, (ultra-detailed:1.2), ((high ornamented dress)), detailed light, HDR, Empire_dress, (awaitingtongue:1.2), ((realistic)), photo referenced, highest quality, high quality, (detailed face and eyes:1.1), ((goth)), golden hour, freckles, queen dress, green royalty, green eyes, full body, red dress,((crown)), thin lips, victorian clothes, highly detailed clothes, green engravings on clothes,on the street, (embarrassed laughing:1.2),
emphasizing her curves and sex appeal, The overall tone of the image is dark.
- 这段咒语,第一段描述图片大方向,包含professional artwork, famous artwork和描述女主角身材特征并用括弧强调((perfect female body, narrow waist))
- 第二段说明女主角细节,例如服装要是维多利亚风并带有刺绣 victorian clothes, green engravings on clothes、发型是undercut、发色是粉红色pink hair,皇冠发饰((crown))
- 第三段说明图片风格是展示女主角的线条和性感,并用暗色风格dark呈现。
Negative Prompt
Negative Prompt直接复制贴上即可,说明不要出现一些刺青、品牌、标语、丑脸和6根手指头等等。
(deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers:1.4), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation. tattoo,lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, out of focus, censorship, ugly, old, deformed, amateur drawing, odd, bad hands
接著按下执行「Generate」产生图片:
工作区右下角,点击任何一张就会显示大图,你可以直接右键存到电脑里,也可以透过下方的 Download 按钮下载,图片只会保存一小段时间喔。
Stable Diffusion修改咒语教学
如果你想看Ai女主角的背面,用一样的咒语单纯加上动作,例如:
wearing red skirt, panties ,showing buttocks, skirt above ass, wearing skirt, back to viewer(穿裙子,露出屁股,背对镜头),女主角有一样风格但画面呈现结果完全不同。
以发型、发色与头饰为案例,以下是一个表格,用来说明可以将英文中括弧标示的文字进行替换。以发型为例,您可以将 “undercut” 替换成其他发型,如 “ponytail”。
hair style[undercut], [red] hiar, [crown],dress style [Goth], [in a classroom],下表列出于括弧内可供替换的关键字
类别 | 替换选项 |
---|---|
发型 | undercut, ponytail, bob, pixie, braid, mohawk, dreadlocks, bun, shag, wavy, straight, curly, pompadour, slicked back, side part, quiff, top knot, mullet |
发色 | red, black, brown, blonde, gray, green, blue, purple, pink, orange, balayage, highlights, pastel, burgundy, ombre, ash blonde |
头饰 | crown, hat, headband, beret, baseball cap, beanie, fedora, turban, veil, bonnet, hairpin, headscarf, fascinator, tiara, bow |
服装风格 | Goth, casual, business formal, vintage, athletic, hip hop, rock, mori girl, military, bohemian, country, beachwear, retro, kimono, hanfu, ethnic |
地点/背景 | in a classroom, in a studio, at the beach, in a forest, on a mountain, in a city, in a park, in a garden, at a party, in a cafe, in a library, at home |
以上表格展示了一些可以替换的选项。在使用时,只需将英文中括弧内的文字替换成您希望使用的选项即可;更多跟Ai沟通的方式可以参考 成为Ai沟通师不用懂程式,学会用精准指令prompt跟ai沟通能拿千万年薪
如果你想加上更多画风条件,一样prompts再加上一些情色形容词,例如:intricate detail, delicate pattern, sexy, charming, alluring, seductive, erotic, enchanting
以上教学模型是Perfect World,比较偏向电脑画作,而模型到ChilloutMix是真人,如果把一样Stable Diffusion咒语关键字放到ChilloutMix中能得到的结果是?….依照这篇教学自己操作一次就知道了。
下方放小图案例供您参考。P.S.我把发型从undercut改成绑马尾ponytail
更多 Stable Diffusion 生成的 AI 图参考与结论
Stable Diffusion 是一个非常实用的 AI 图片生成工具。您可以透过 Civitai.com 网站查看其他人分享的作品和相应的参数设定,以提供更多灵感和选择;只要网站上图片有 i 的标示,就可以点进去看他下周与,可以直接复制并且贴到 Stable Diffusion WebUI 编辑器即可使用。当然别忘了还可以利用 ChatGPT 来产生适合 Stable Diffusion 使用的 Prompt 指令。
再复习一次本篇文章提到的使用步骤:
- 选择 Github 上面开源的笔记本档案
- 使用 Google Colab 架设 Stable Diffusion WebUI 环境
- 进入 Stable Diffusion WebUI 内提供 Prompt 关键字咒语以及设计图片参数
- 产生数张不同的 AI 图片
虽然使用 Stable Diffusion 的过程看似复杂,但经过一两次的尝试后,您将熟悉操作流程。此工具不仅可以生成美女图,还能根据您使用的指令和算法创建具有电影风格的画面。您可以在现有参数的基础上加入自己的创意,如穿著运动服、比基尼或洋装。此外,建议多尝试使用其他模型。