AI 绘画快速开始-StableDiffusionWebui

介绍

Stable Diffusion web UI是一个基于Gradio库的Stable Diffusion图像生成的网页接口。

Stable Diffusion是一个使用深度学习对文本进行图像生成的系统。它由Anthropic公司开发,基于 transformer 得到快速发展。

这个网页界面利用 Gradio 库,将 Stable Diffusion 应用到一个可视化的网页应用中。用户可以通过简单的提示文本生成高质量的图像。

该项目的主要功能和特性包括:

  • 原始的文字到图像和图像到图像生成模式
  • 一键安装和运行脚本,方便用户快速上手
  • 支持扩充生成、修复补全等功能
  • 丰富的调节生成参数的界面
  • 支持多个后处理模型提升生成图片质量
  • 训练自定义嵌入向量等功能
  • 社区提供的各种扩展脚本
  • 优化的推理速度,可以在低显存环境运行
    该项目由 Github 用户 AUTOMATIC1111 创建和维护,采用 AGPL-3.0 开源协议。它极大地方便了Stable Diffusion在本地机器上的部署使用,提供了丰富的功能,是基于该模型的图像生成的首选工具之一。一个活跃的社区为其不断新增功能和维护。

WebUI 的安装和部署

参考https://github.com/AUTOMATIC1111/stable-diffusion-webui.git 安装部署

参数介绍

  • Prompt - 文本提示,用于描述目标生成图像的内容、样式等信息。
  • Negative Prompt - 排除的文本,用于指出不希望在生成图像中出现的内容。
  • Steps - 图像生成的迭代步数,步数越多图像质量越高。
  • Sampling Method - 采样方法,不同方法会影响图像质量和样式。
  • Seed - 随机种子数,用于控制生成结果的多样性。
  • Size - 生成图片的分辨率大小。
  • Model - 选择使用的Stable Diffusion模型变量。
  • Strength - 指导生成图片符合提示的强度。
  • Scale - 控制生成图片样式的缩放程度。
  • CFG Scale - 控制文本编码器输出的缩放比例。
  • Batch Size - 同时生成的图片数量。
  • Batch Count - 生成的批次数量。
  • 文本到图像(txt2img) - 这是最基础的功能,可以直接在Prompt框中输入文本描述,生成对应图像。支持控制风格、内容等。
  • 图像到图像(img2img) - 可以输入一张图像,经过模型处理生成修订版本。支持补全、扩充、调整样式等。
  • Outpainting - 基于一张图像,扩充图像边界区域,生成更大尺寸的图片。
  • Inpainting - 修复图像中遮挡或损坏的区域,使图片完整。
  • Color Sketch - 输入素描画,生成对应颜色图片。
  • Stable Diffusion Upscale - 使用模型进行图片超分辨率处理。
  • Attention - 通过特殊语法强调文本中的重点内容,模型会聚焦在这些部分。
  • Prompt Matrix - 通过矩阵排列不同prompt,自动生成图片网格。
  • 循环生成(Loopback) - 将图片循环多次输入模型,实现图像迭代优化。
  • 故障检测(CLIP Interrogator) - 分析图像判断最可能的生成提示。
  • 无缝处理(Seamless) - 自动处理生成图片边界,实现无缝拼接。

Prompt技巧

初阶Prompt:直接描述的精细化

  • 在描述时,尽量具体化。例如,不仅是 “a happy dog and a cute girl”,而是 “a joyful golden retriever playing with a smiling girl in a sunny park”。这样的详细描述能帮助模型更准确地捕捉您的创作意图。

二阶Prompt:巧用标签的扩展

  • 现在让我们进一步提升这幅画的质量,方法就是使用标签(tag)继续优化。best quality, masterpiece, a happy dog and a cute girl, watercolor style。 除了 “best quality” 和 “masterpiece”,可以加入更具体的艺术风格或细节描述,如 “vibrant colors, intricate details”。例如,“vibrant colors, intricate details, best quality, masterpiece, a happy dog and a cute girl, watercolor style”。
  • 延伸内容:探索不同艺术流派的标签,如 “impressionist, surrealism, or baroque style”,以及特定艺术家的风格,如 “in the style of Van Gogh or Picasso”。

三阶Prompt:负面提示词的深入应用

  • 在使用负向提示词时,可以更具体地指出不希望出现的元素,如 “no crowds, avoid oversaturation, no photorealism”。
  • 延伸内容:利用负面提示词来排除常见的AI生成错误,如 “no floating objects, no mismatched perspectives”。

四阶Prompt:文本权重调整的细化

  • 使用括号来强调特定元素时,可以结合形容词增强效果,如 “a happy (big dog) and a (tiny cute girl), watercolor style”。
  • 延伸内容:尝试对比不同权重下的效果,如 “(dog:1.5) and (girl:0.5)”,来控制图像中元素的相对重要性。

引入 LoRA:模型特效的创新应用

  • 在使用 LoRA 时,确保模型文件名和权重适当匹配您的创作目标,如 “lora:artistic_model:1.2”。
  • 延伸内容:实验不同的 LoRA 模型来探索各种视觉效果,如 “lora:cinematic_effect:1.0” 或 “lora:dreamy_landscape:1.5”,以创造独特的艺术作品。

案例-生成漫画 (LoRA)

LoRA(Long Range Arena)是一种用于图像生成的新方法,其基本原理如下:

  • LoRA 使用了与Stable Diffusion类似的Diffusion模型结构,包括Encoder,Decoder,UNet等组件。
  • LoRA 提出了一种新的自回归(Auto-regressive)策略,可以capture更长范围的依赖关系。
  • 在训练阶段,LoRA 通过预测序列中远距离的token来进行训练,而不是只预测相邻的token。
  • 在推理阶段,LoRA 通过采样不同步长的序列,合并为完整的序列,从而实现了更长范围的依赖建模。
  • LoRA还设计了一种类似Transformer的跨层Attention机制,不同层之间可以建立依赖关系。
    通过上述特点,LoRA可以model更丰富的长程依赖,生成更连贯、合理的图像。

用的Base Model https://civitai.com/models/9409?modelVersionId=30163

用LoRA https://civitai.com/models/88201?modelVersionId=93864

在构建一个漫画分镜故事,可以采取一种简单的叙述流程,以讲述一个小女孩旅行的故事。以下是一种可能的分镜顺序:

分镜1: 出发

  • 画面: 小女孩背着一个大背包站在家门口。她的猫咪在她的脚边,仰头望着她。
  • 文字: “小丽准备好了她的冒险,家门口的告别总是有些苦涩。”
  • prompt
A little girl stands at the doorway of her home, ready for an adventure. She has a large backpack that is almost as big as her tiny frame. By her feet sits her fluffy orange cat, gazing up at her with curious eyes. Gentle light catches on the girl's windblown hair and shining eyes, full of excitement and optimism. Her cat's fur ripples in the breeze. Lush greenery and colorful flowers surround the simple home's exterior. A path leads from the door into a sunny day filled with possibilities. Digital painting, peaceful atmosphere, childhood wonder, bond between girl and pet, smooth skin, lifelike fur, vivid yet calming colors, finely rendered details, illustrative style <lora:Iku_Nakatani:1>
  • negative prompt
EasyNegative, (worst quality, low quality:1.4), (lip, nose, rouge, lipstick:1.4), (jpeg artifacts:1.4), (1boy, abs, muscular:1.0), greyscale, monochrome, dusty sunbeams, trembling, motion lines, motion blur, emphasis lines, text, title, logo, signature

分镜2: 火车站

  • 画面: 小女孩坐在火车站的长椅上,一边看着手中的火车票,一边期待地望向铁轨。
  • 文字: “火车站人来人往,小丽的心中充满了即将启程的激动。”
  • prompt
A young girl sits pensively on a wooden bench at a small train station, the late afternoon light casting a warm glow over her features. In her small hands she clutches an tickets, tracing over the letters and numbers with her fingertips as she gazes expectantly down the railroad tracks. Ripples in the ties lead the eye into the distant point where sky meets earth. A gentle breeze tousles the girl's hair as birdsong and the rumble of a distant locomotive are carried on the wind. A sense of anticipation and excitement mingles with the stillness of waiting as the moments tick by. Digital painting, atmospheric perspective, nostalgic mood, attention to tiny details, emotionally evocative light and colors, smooth skin, textured surfaces, inviting the viewer to share in the girl's wondering thoughts <lora:Iku_Nakatani:1>
  • negative prompt
EasyNegative, (worst quality, low quality:1.4), (lip, nose, rouge, lipstick:1.4), (jpeg artifacts:1.4), (1boy, abs, muscular:1.0), greyscale, monochrome, dusty sunbeams, trembling, motion lines, motion blur, emphasis lines, text, title, logo, signature 

分镜3: 古城探险

  • 画面: 小女孩站在一座古老城堡的巨大城门前,眼睛充满好奇。
  • 文字: “古城的神秘召唤着小丽,每块石头都诉说着历史的故事。”
  • prompt
A young girl gazes up at immense castle gates that block her view inside. Moss clings to weathered stones taller than any building she's seen. Two wooden doors stand closed yet unbarred. Sunlight catches motes of dust as ravens call from high above. Curiosity swells within her at the mysteries the old walls hide. What wonders and legends wait within those towering walls for an adventurous visitor to discover? <lora:Iku_Nakatani:1>
  • negative prompt
EasyNegative, (worst quality, low quality:1.4), (lip, nose, rouge, lipstick:1.4), (jpeg artifacts:1.4), (1boy, abs, muscular:1.0), greyscale, monochrome, dusty sunbeams, trembling, motion lines, motion blur, emphasis lines, text, title, logo, signature 

分镜4: 山川间

  • 画面: 小女孩在翠绿的山谷中跳跃,手臂张开,仿佛整个世界都在欢迎她。
  • 文字: “绿意盎然的山谷中,小丽感受自然的力量和美丽。”
  • prompt
A young girl spins and twirls amidst a lush green valley, arms outstretched as if to embrace the vibrant natural surrounds. Golden sunlight dances over her smiling face and through the leaves, illuminating her carefree glee. Grasses and wildflowers sway to the rhythm of her dancing feet, partners in her play.

Butterflies flit amid the shimmering foliage as dancing shadows cast dancing girls upon the hills. Laughter floats upon the breeze like birdsong through towering trees. No sound but for the gurgling brook can match the girl's tuneless melody of mirth.

Here, surrounded by the valley's verdant embrace, she is queen of her own private realm, filled with the wonders and joy of youth. Golden light gilds petals, pollen, and peasant's hair alike, a living child amidst a living tapestry of delight. <lora:Iku_Nakatani:1>
  • negative prompt
EasyNegative, (worst quality, low quality:1.4), (lip, nose, rouge, lipstick:1.4), (jpeg artifacts:1.4), (1boy, abs, muscular:1.0), greyscale, monochrome, dusty sunbeams, trembling, motion lines, motion blur, emphasis lines, text, title, logo, signature 

分镜5: 海边日落

  • 画面: 小女孩坐在沙滩上,眼睛注视着海平线上的落日。
  • 文字: “金色的夕阳与海的边界相遇,小丽被这壮丽的景色深深吸引。”
  • prompt
Young girl sitting on the beach, gazing at the sunset on the horizon, warm orange and pink hues reflecting off her skin and clothing, sandy feet buried in the shore, windswept hair gently blowing in the breeze, delicate features peacefully illuminated in the dying light, intricate details in the folds of her sundress and textures of the sand, elegant composition, smooth colors blended seamlessly, highly realistic digital painting style, art by Greg Rutkowski and Alphonse Mucha <lora:Iku_Nakatani:1>
  • negative prompt
EasyNegative, (worst quality, low quality:1.4), (lip, nose, tooth, rouge, lipstick, eyeshadow:1.4), (jpeg artifacts:1.4), (bokeh, blurry, film grain, chromatic aberration, lens flare:1.0), (1boy, abs, muscular, rib:1.0), greyscale, monochrome, dusty sunbeams, trembling, motion lines, motion blur, emphasis lines, text, title, logo, signature, simple background, white background

分镜6: 夜市灯光

  • 画面: 小女孩走在热闹的夜市中,周围是各种摊位和闪烁的灯笼。
  • 文字: “五彩斑斓的灯光下,小丽在夜市中尝试着各种美食,每一口都是新鲜的体验。”
  • prompt
Young girl wandering through a bustling night market, vibrant stalls and flashing paper lanterns lining the alleyway on both sides, colorful lights dancing off her excited face as she takes in the lively atmosphere, delicate features and flowing sundress elegantly illuminated amidst the hustle and bustle, intricate woven details in the tapestries and fabrics fluttering overhead, smooth blending of warm tones capturing the joyful energy, highly realistic digital painting style, art by Greg Rutkowski and Alphonse Mucha <lora:Iku_Nakatani:1>
  • negative prompt
EasyNegative, (worst quality, low quality:1.4), (lip, nose, tooth, rouge, lipstick, eyeshadow:1.4), (jpeg artifacts:1.4), (bokeh, blurry, film grain, chromatic aberration, lens flare:1.0), (1boy, abs, muscular, rib:1.0), greyscale, monochrome, dusty sunbeams, trembling, motion lines, motion blur, emphasis lines, text, title, logo, signature, simple background, white background

每个分镜都突出了旅行的一个特定阶段,从准备出发到探索新地方,再到旅途的回忆。这种结构能够帮助读者跟随小女孩的旅行经历,感受她的情感起伏。

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_19968255/article/details/134961051