2.2 指南

本节主要参考资料:

2.2.1 Prompt 编写指引

编写 Text-to-Image 模型的 Prompt 时,我们可以从 5 个问题入手:

  1. 想要生成什么类型(format)的图片? - a photo or a oil painting, … ?
  2. 图片的主体(subject)是什么? - a man or a women ? a dog or a cat ? or a landscape ? …
  3. 想要添加哪些细节?
    • 环境(environment) - indoor, outdoor, underwater, city street, supermarket, sky, …
    • 背景(background) - sky, clouds, mountains, trees, buildings, solid color, nebula, forest, …
    • 灯光(lighting) - ring light, neon, cinematic lighting, …
    • 配色方案(color scheme) - monochrome, pastel, vibrant, dark, …
    • 视角(Point of view) - front, overhead, side, …
  4. 图片的风格或艺术类型是什么? - realistic, 3D render, studio ghibli, movie poster, …
  5. 图片质量要求是怎样的? - high resolution, high quality, detailed, …

:::tip 上述问题并不是一个完整的列表,在很多 Prompt 中还会有额外的构成的元素。 另外,对上述问题中例举的概念和词汇不理解也没关系,我们将在在后面的章节中介绍。 :::

比如,针对以上问题,我们的示例回答是:

  1. 想要生成一张油画(a painting)。
  2. 图片的主体是一只狗(a cute dog)。
  3. 图片中要添加的细节元素:
    • 环境(environment) - grass ground
    • 背景(background) - sky, clouds, mountains, trees
    • 灯光(lighting) - cinematic lighting
    • 配色方案(color scheme) - vibrant colors
  4. 图片的风格或艺术类型是写实(studio ghibli)。
  5. 图片质量要求是高清(high resolution)。

依次串连上述信息,我们就可以得到一个的 Prompt 了:

PromptImage
a painting of a cute dog on the grass ground, with sky, clouds, mountains, trees, cinematic lighting, vibrant colors, studio ghibli style, high resolution.
{.table .table-bordered .border-secondary}

怎么样?是不是还挺简单的?😄,除了每个问题中到底有多少可用词汇还不知道外。

需要注意是的,Prompt 中词汇的顺序很重要,越靠前的词汇权重越大,对最终生成图片的影响也就越大(,虽然我们也可以通过参数调整不同词汇的权重)。

2.2.2 Prompt 编写建议

2.2.2.1 介词不可靠,尝试使用其他方式替代

  • 策略 1:使用 形容词+名词 替代介词短语
❌ Not good✅ Better
hair flowing in the windflowing hair
eyes the color of sunsetsunset eyes
a carrot for a nosecarrot nose
{.table .table-bordered .border-secondary}
  • 策略 2:用非常具体的动词代替介词短语。
❌ Not good✅ Better
a girl with a flashlighta girl using a flashlight
a girl with some cakea girl eating cake
a girl feeling sadmourning girl
grieving girl
depressed girl
a girl with a big smile on her facesmiling girl
happy girl
a sword on its sidea discarded sword
{.table .table-bordered .border-secondary}
  • 策略 3:用非常具体的词汇代替介词短语。
❌ Not good✅ Better
a girl in a forest sleepinga forest shelters a sleeping girl
a girl walking on a spaceshipa spaceship corridor contains a striding girl
a girl with a recurve bowa female ranger equipped with a recurve bow
{.table .table-bordered .border-secondary}
  • 策略 4:尝试颠倒句子结构。
❌ Not good✅ Better
rainbows reflected in the pondthe pond reflects rainbows
a bee hovers over a flowera flower visited by a bee
a storm above a shipa ship threatened by a storm
a basket filled with blueberriesblueberries contained by a basket
{.table .table-bordered .border-secondary}

2.2.2.2 尝试减少含义重复的词语

❌ Not good✅ Better
black obsidianobsidian(already mean black)
botanical plantsbotanicals(already mean plants) / plants (already mean botanicals)
{.table .table-bordered .border-secondary}

2.2.2.3 尽可能具体和准确

❌ Not good✅ Better
on a horsea rider
wearing a wedding dressa bride
short hair and boy’s clothinga tomboy
holding a top hat and magic wanda magician
around a table with a pink cake and balloonsbirthday party
{.table .table-bordered .border-secondary}

2.2.2.4 使用类似句子的片段,而不是单词表。

❌ Not good✅ Better
woman, young, walking, campusA young woman walks across campus
{.table .table-bordered .border-secondary}
最后更新于