2.2 指南
本节主要参考资料:
- Stable Diffusion prompt: a definitive guide
- OpenArt Prompt Book
- DALL.E 2 Prompt Book
- Troubleshooting Midjourney Text Prompts
2.2.1 Prompt 编写指引
编写 Text-to-Image 模型的 Prompt 时,我们可以从 5 个问题入手:
- 想要生成什么类型(format)的图片? - a photo or a oil painting, … ?
- 图片的主体(subject)是什么? - a man or a women ? a dog or a cat ? or a landscape ? …
- 想要添加哪些细节?
- 环境(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, …
- 图片的风格或艺术类型是什么? - realistic, 3D render, studio ghibli, movie poster, …
- 图片质量要求是怎样的? - high resolution, high quality, detailed, …
:::tip 上述问题并不是一个完整的列表,在很多 Prompt 中还会有额外的构成的元素。 另外,对上述问题中例举的概念和词汇不理解也没关系,我们将在在后面的章节中介绍。 :::
比如,针对以上问题,我们的示例回答是:
- 想要生成一张油画(a painting)。
- 图片的主体是一只狗(a cute dog)。
- 图片中要添加的细节元素:
- 环境(environment) - grass ground
- 背景(background) - sky, clouds, mountains, trees
- 灯光(lighting) - cinematic lighting
- 配色方案(color scheme) - vibrant colors
- 图片的风格或艺术类型是写实(studio ghibli)。
- 图片质量要求是高清(high resolution)。
依次串连上述信息,我们就可以得到一个的 Prompt 了:
Prompt | Image |
---|---|
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 wind | flowing hair |
eyes the color of sunset | sunset eyes |
a carrot for a nose | carrot nose |
{.table .table-bordered .border-secondary} |
- 策略 2:用非常具体的动词代替介词短语。
❌ Not good | ✅ Better |
---|---|
a girl with a flashlight | a girl using a flashlight |
a girl with some cake | a girl eating cake |
a girl feeling sad | mourning girl grieving girl depressed girl |
a girl with a big smile on her face | smiling girl happy girl |
a sword on its side | a discarded sword |
{.table .table-bordered .border-secondary} |
- 策略 3:用非常具体的词汇代替介词短语。
❌ Not good | ✅ Better |
---|---|
a girl in a forest sleeping | a forest shelters a sleeping girl |
a girl walking on a spaceship | a spaceship corridor contains a striding girl |
a girl with a recurve bow | a female ranger equipped with a recurve bow |
{.table .table-bordered .border-secondary} |
- 策略 4:尝试颠倒句子结构。
❌ Not good | ✅ Better |
---|---|
rainbows reflected in the pond | the pond reflects rainbows |
a bee hovers over a flower | a flower visited by a bee |
a storm above a ship | a ship threatened by a storm |
a basket filled with blueberries | blueberries contained by a basket |
{.table .table-bordered .border-secondary} |
2.2.2.2 尝试减少含义重复的词语
❌ Not good | ✅ Better |
---|---|
black obsidian | obsidian(already mean black) |
botanical plants | botanicals(already mean plants) / plants (already mean botanicals) |
{.table .table-bordered .border-secondary} |
2.2.2.3 尽可能具体和准确
❌ Not good | ✅ Better |
---|---|
on a horse | a rider |
wearing a wedding dress | a bride |
short hair and boy’s clothing | a tomboy |
holding a top hat and magic wand | a magician |
around a table with a pink cake and balloons | birthday party |
{.table .table-bordered .border-secondary} |
2.2.2.4 使用类似句子的片段,而不是单词表。
❌ Not good | ✅ Better |
---|---|
woman, young, walking, campus | A young woman walks across campus |
{.table .table-bordered .border-secondary} |
最后更新于