负面提示词在Stable Diffusion中的作用及书写技巧

在Stable Diffusion中,负面提示(Negative Prompts)作为一种图像生成的引导机制发挥着重要作用。它们使用户能够定义希望从生成的图像中排除的内容,这在避免产生模糊、失真或包含不需要噪声的图像方面特别有用。

Stable Diffusion以及其他类似的AI图像生成技术通常接受文本描述作为输入,以指导生成与描述相符的图像。在这个过程中,文本提示负责界定期望生成的图像特征,而负面提示则专门用来指定那些应当在生成结果中规避或排除的元素。

在Stable Diffusion的工作流程中,首先会对来自正向和负面文本提示的信息进行特征提取。正向特征被用来塑造条件性潜在空间,以引导模型朝向期望的图像风格或内容;而负面特征则作用于非条件性潜在空间,目的是抑制那些与负面提示相对应的图像特征,从而确保生成的图像既接近正向描述的要求,同时又尽可能地不包含负面提示中提到的元素。

随着Stable Diffusion模型不断更新,负面提示的重要性进一步凸显,它为从文本到图像的转化过程增添了更精细的控制维度。例如,在已使用某一随机种子生成了一幅描绘巴黎雨天场景的画作之后,若要生成另一个同一场景却无人物的画面,使用者只需保留相同的随机种子,并在提示中增加负面提示“people”,这样模型就会在生成新图像时避免出现人物形象。

负面提示在提升Stable Diffusion模型中的作用

  1. 细化输出内容负面提示为用户提供了一种强有力的手段,允许他们在不增加额外复杂指令的情况下,明确排除不希望在生成结果中出现的元素。这一特性有助于模型产出更加聚焦、满足用户精细需求的高质量图像。
  2. 提升模型准确性与定制化:通过对模型引入负面提示,研究者们能够更好地调控AI生成图像的过程,从而改善模型的整体表现,使其在应对复杂任务时能够更准确地按用户意图生成定制化视觉内容。
  3. 扩展系统功能:随着AI技术的发展,负面提示成为了强化诸如Stable Diffusion这类高级图像生成模型功能的关键要素。传统正向提示指示模型应该生成什么,而负面提示则为模型提供了一种微调和过滤机制,二者结合使得AI能够创造出高度精准和个性化的视觉作品。

构建有效负面提示的技巧

  • 权重调整策略:在负面提示中赋予不同的权重,例如为了确保生成的森林图像中不出现熊,可以设置“bears:1.3”的高权重负面提示,这将使图像中不出现熊的重要性增加30%,这将显著增加模型排除熊元素的概率。
  • 精确控制图像属性:对于图像的具体属性,比如减弱生成的“红色苹果”中红色的程度,可以使用“red:0.5”作为负面提示,以引导模型生成颜色较淡的苹果。
  • 简洁明了的表述负面提示应当清晰明确,如在生成“夜晚城市天际线”图像时,若要避免汽车和路灯出现,应直接列出“cars”和“street lights”作为负面提示,避免抽象或模糊的表述,如“无城市元素”。
  • 针对特定质量要求的提示:在生成具有特殊品质要求的图像时,如制作一束各不相同的清晰花朵图像,可以采用“no duplicates”和“no blurry pictures”这样的负面提示,确保每朵花的独特性和整体图像的高清质量。

我们以案例来来进行讲解,大家可能更容易理解,比如我想生成一张“校园操场边的女生”的图片

正面提示词:(young female student:1.2), sitting on a bench, school uniform, school campus, green grass field, sports equipment in the background, afternoon sunlight, gentle breeze, anime style illustration, fresh color palette, clear sky

负面提示词:green eyes

通过比较两个生成的图像,我们可以观察到明显的差异。在左图中,女孩是绿色眼睛,通过添加负面提示词,即可避免女孩出现绿色的眼睛。

提示词模板

其实无论是正面还是负面提示词,都有模板可以套用,使用一些基本的提示词模板即可保证出图质量。

正面提示词模板

画面质量通用

best quality,masterpiece,realistic,

真实风格通用

Hyper Real,Photorealistic,16K,high detail,high resolution
负面提示词模板

基础通用

longbody,lowres,bad anatomy,bad hands,missing fingers,pubic hair,extra digit,fewer digits,cropped,worst quality,low quality

人物基础通用

nsfw,logo,text,badhandv4,EasyNegative,ng_deepnegative_v1_75t,rev2-badprompt,verybadimagenegative_v1.3,negative_hand-neg,mutated hands and fingers,poorly drawn face,extra limb,missing limb,disconnected limbs,malformed hands,ugly,

超级负面通用

multiple breasts, (mutated hands and fingers:1.5 ), (long body :1.3), (mutation, poorly drawn :1.2) , black-white, bad anatomy, liquid body, liquid tongue, disfigured, malformed, mutated, anatomical nonsense, text font ui, error, malformed hands, long neck, blurred, lowers, lowres, bad anatomy, bad proportions, bad shadow, uncoordinated body, unnatural body, fused breasts, bad breasts, huge breasts, poorly drawn breasts, extra breasts, liquid breasts, heavy breasts, missing breasts, huge haunch, huge thighs, huge calf, bad hands, fused hand, missing hand, disappearing arms, disappearing thigh, disappearing calf, disappearing legs, fused ears, bad ears, poorly drawn ears, extra ears, liquid ears, heavy ears, missing ears, fused animal ears, bad animal ears, poorly drawn animal ears, extra animal ears, liquid animal ears, heavy animal ears, missing animal ears, text, ui, error, missing fingers, missing limb, fused fingers, one hand with more than 5 fingers, one hand with less than 5 fingers, one hand with more than 5 digit, one hand with less than 5 digit, extra digit, fewer digits, fused digit, missing digit, bad digit, liquid digit, colorful tongue, black tongue, cropped, watermark, username, blurry, JPEG artifacts, signature, 3D, 3D game, 3D game scene, 3D character, malformed feet, extra feet, bad feet, poorly drawn feet, fused feet, missing feet, extra shoes, bad shoes, fused shoes, more than two shoes, poorly drawn shoes, bad gloves, poorly drawn gloves, fused gloves, bad cum, poorly drawn cum, fused cum, bad hairs, poorly drawn hairs, fused hairs, big muscles, ugly, bad face, fused face, poorly drawn face, cloned face, big face, long face, bad eyes, fused eyes poorly drawn eyes, extra eyes, malformed limbs, more than 2 nipples, missing nipples, different nipples, fused nipples, bad nipples, poorly drawn nipples, black nipples, colorful nipples, gross proportions. short arm, (((missing arms))), missing thighs, missing calf, missing legs, mutation, duplicate, morbid, mutilated, poorly drawn hands, more than 1 left hand, more than 1 right hand, deformed, (blurry), disfigured, missing legs, extra arms, extra thighs, more than 2 thighs, extra calf, fused calf, extra legs, bad knee, extra knee, more than 2 legs, bad tails, bad mouth, fused mouth, poorly drawn mouth, bad tongue, tongue within mouth, too long tongue, black tongue, big mouth, cracked mouth, bad mouth, dirty face, dirty teeth, dirty pantie, fused pantie, poorly drawn pantie, fused cloth, poorly drawn cloth, bad pantie, yellow teeth, thick lips, bad cameltoe, colorful cameltoe, bad asshole, poorly drawn asshole, fused asshole, missing asshole, bad anus, bad pussy, bad crotch, bad crotch seam, fused anus, fused pussy, fused anus, fused crotch, poorly drawn crotch, fused seam, poorly drawn anus, poorly drawn pussy, poorly drawn crotch, poorly drawn crotch seam, bad thigh gap, missing thigh gap, fused thigh gap, liquid thigh gap, poorly drawn thigh gap, poorly drawn anus, bad collarbone, fused collarbone, missing collarbone, liquid collarbone, strong girl, obesity, worst quality, low quality, normal quality, liquid tentacles, bad tentacles, poorly drawn tentacles, split tentacles, fused tentacles, missing clit, bad clit, fused clit, colorful clit, black clit, liquid clit, QR code, bar code, censored, safety panties, safety knickers, beard, furry ,pony, pubic hair, mosaic, excrement, faeces, shit, futa, testis,

简单写实

childlike,child,clipping,3d,cartoon,3dcg,doll,illustration,render,lowres,bad anatomy,bad hands,text,error,missing fingers,extra
digit,fewer digits,cropped,worst quality,low quality

二次元通用

sketch,duplicate,ugly,huge eyes,text,logo,monochrome,worst face,(bad and mutated hands:1.3),(worst quality:2),(low quality:2),(blurry:2),horror,geometry,
bad_prompt,(bad hands),(missing fingers),multiple limbs,bad anatomy,(interlocked fingers:1.2),Ugly Fingers,(extra digit and hands and fingers and legs and
arms:1.4),((2girl)),(deformed fingers:1.2),(long fingers:1.2),(bad-artist-anime),bad-artist,bad hand,extra legs

建筑通用

text,word,cropped,low quality,normal quality,username,watermark,signature,blurry,soft,soft line,curved line,sketch,ugly,logo,pixelated,lowres

手脚强化

text,word,cropped,low quality,normal quality,username,watermark,signature,blurry,soft,soft line,curved line,sketch,ugly,logo,pixelated,lowres
0

评论0

没有账号?注册  忘记密码?