上一篇StableDiffusion文生图我们了解了基本概念,本篇文章详细介绍下prompt(提示词)。本篇文章如果无特殊说明,演示使用sd_xl_base_1.0.safetensors的基础模型,这个模型可以更好的理解自然语言,尺寸 1024 * 1024,固定随机种子(Seed)。

提示词

prompt,提示词,简单说就是你对图片的描述(这个很重要),我们从最简单的开始,不断修改提示词展示不同提示词的效果:

a cat

a running cat

a cat running inside the house

a close-up shot of a cat running inside the house

可以看到对自然语言的理解已经很好了,基本能够满足我们的需要,我们给一些更复杂的提示词,看看效果。

a 3D-rendered cat bathing

a 3D-rendered cat bathing with continuous flowing water, while nearby flowers bloom

a 3D-rendered cat wearing a crown, bathing with water flowing continuously, while nearby flowers are blooming.

可以发现已经很友好了,你需要什么效果直接写提示词,基本能够满足我们的需要

接下来看看多个物体的提示词,看看效果。

Two cats, a kitten, and an adult cat playing inside the room

Two cats, one kitten, frolicking in a room, captured in a candid, portrait-style photograph

多个物体的数量控制不是太准,这个需要使用反向提示词进行修正。

反向提示词

negative prompt,反向提示词,即你不希望画面中出现的元素。

上面的两只小猫的prompt,出现了4只,你就可以在反向提示词中加入 four cats ,禁止出现四只。

prompt:Two cats, one kitten, frolicking in a room, captured in a candid, portrait-style photograph

Negative prompt:four cats

Negative prompt:four cats, running

Negative prompt:four cats, three cats, running

上面这两个是基本文生图的基本概念,好理解但是需要大量的实验来验证我们的描述。

实战文生图

我们可以对提示进行加强(提示词:N),N就是你要加强的倍数,比如下面的提示中我加强了王冠:(crown:2)

我们通过山海经中的描述来生成图片

有兽焉,其状如禺而白耳,伏行人走,其名曰狌狌,食之善走——出自南山经

这里的狌狌同猩猩

译文:In the mountains, there is a creature resembling a macaque but with white ears. It moves by crawling on its belly and can also walk upright like a human. This creature is called the "Qian Qian". Eating its meat allows one to run faster

prompt(提示词):In the mountains, there is a creature resembling a macaque but with white ears. It moves by crawling on its belly and can also walk upright like a human.

prompt(提示词):In the mountainous wilderness, a creature resembling a macaque, yet distinguished by its white ears, gracefully moves with a posture akin to crawling, yet also possesses the remarkable ability to stand erect like a human. Adorned with a majestic (crown:2), it sprints through the rugged terrain, its regal bearing and extraordinary form commanding attention amidst its natural habitat.

prompt(提示词):In the vast expanse of space, a creature reminiscent of a (macaque:2), yet distinguished by its (white ears:2), gracefully navigates the cosmic void. With a curious gait resembling crawling, it seamlessly transitions into walking upright like a human. Clad in a sleek spacesuit, it dashes through the weightless environment.

今天先说到这里,其实学习是一个过程,不可操之过急,需要循循善进!