ERNIE-Image 复杂场景构图与多物体生成实战指南

Jul 11, 2026

ERNIE-Image 复杂场景构图与多物体生成实战指南

发布日期:2026-07-11
EI 编号:EI-128
SEO 关键词ernie-image multi-object composition, ernie-image complex scene generation, ernie-image spatial layout, ernie-image 复杂场景, ernie-image 多物体生成


ERNIE-Image 的文本渲染能力已经广为人知——LongTextBench 0.9733 的得分让它成为开源文生图模型中的文字渲染标杆。但 ERNIE-Image 的另一项核心能力同样值得深度挖掘:复杂指令遵循与多物体空间构图

在官方技术报告中,ERNIE-Image 团队明确将"复杂指令遵循"(Complex Instruction Following)列为核心设计目标之一。这意味着 ERNIE-Image 不仅仅是一个"文生图"模型——它能够理解多个物体之间的空间关系、相对位置、交互动作,以及场景中的层次结构。

本文将从实战角度出发,系统性地讲解如何利用 ERNIE-Image 生成包含多个物体、复杂空间关系的高质量图像。


一、ERNIE-Image 的指令理解能力从何而来

ERNIE-Image 之所以能够处理复杂指令,核心在于其独特的训练数据管线:

  1. VLM 增强标注:ERNIE-Image 团队使用 Qwen3 视觉语言模型对训练图像进行重标注,提取图像中的结构化描述——不仅描述"有什么",还描述"在哪里"、"怎么摆放"、"彼此关系"。
  2. 详细位置信息:标注内容包括物体的空间位置(左侧、右侧、上方、中央)、相对大小(较大的、较小的)、交互关系(A 拿着 B、A 站在 B 旁边)以及数量信息(三个苹果、一排路灯)。
  3. Aesthetic 过滤:ERNIE-Image-Aes 美学评估模型确保训练数据不仅位置描述准确,美学质量也达到高标准。

这意味着 ERNIE-Image 的理解能力不是来自架构魔术,而是来自高质量、结构化的训练数据——这也是它能够在 GenEval 基准上达到开源模型最优水平的原因之一。


二、多物体提示词的核心公式

要让 ERNIE-Image 准确生成包含多物体的复杂场景,提示词需要遵循特定的结构。以下是经过验证的核心公式:

[场景设定] + [物体1: 位置+属性] + [物体2: 位置+属性] + [关联动作] + [环境/光照] + [风格/质量]

公式解析

组件 说明 示例
场景设定 一句话概括整体场景 "A cozy café interior"
物体1 第一个主要物体,含位置和属性 "a wooden table at the center, with two cups of coffee"
物体2 第二个主要物体,含位置和属性 "a window on the left wall, showing a rainy street outside"
关联动作 物体之间的交互 "a person sitting at the table, reading a newspaper"
环境/光照 整体氛围和光源 "warm amber lighting, gentle rain against glass"
风格/质量 图像风格和质量限定 "photorealistic, 8K, shallow depth of field"

实战案例

简单版:

A dining table with three plates of pasta, a bottle of red wine at the center, two wine glasses on the right side, soft candlelight, warm cozy restaurant atmosphere, photorealistic

进阶版(含精确空间描述):

A rustic kitchen counter, a ceramic fruit bowl placed at the left side containing apples and oranges, a copper kettle on the right side, a woven bread basket in the center with fresh baguettes, morning sunlight streaming from a window on the upper left, warm wood tones, shallow depth of field, food photography style, 8K detail

三、四种常见复杂场景类型与提示词模板

类型 1:含空间位置关系的场景

ERNIE-Image 能理解 left ofright ofabovebelownext tobehindin front of 等空间介词。

模板:

[Main subject] at the [position], with [secondary subject] to the [direction], [tertiary subject] in the [background/foreground], [environment details], [style]

示例:

A vintage typewriter at the center of a wooden desk, with a steaming coffee mug to the left, a stack of old books to the right, a window with sheer curtains in the background, soft afternoon light, warm sepia tones, documentary photography style

类型 2:含数量与排列的场景

ERNIE-Image 对数量词有不错的理解——能区分"一个"和"多个"、"一排"和"一堆"。

模板:

[Number] [object] arranged in a [pattern], with [number] [another object] [position] to them, [scene context]

示例:

Three colorful macarons arranged in a row on a white ceramic plate, with a small cup of espresso placed diagonally behind the plate on a marble countertop, soft studio lighting, minimalistic composition, food photography, pastel color palette

类型 3:含多人/多角色互动的场景

这是最复杂的类型——需要同时控制多个角色的位置、姿态和交互。

模板:

[Person A] [action] while [Person B] [action] [direction], both [shared detail], [environment], [lighting]

示例:

A young woman in a denim jacket sitting at a park bench sketching in a notebook, while a small brown dog sits at her feet looking up at her, autumn leaves scattered on the ground, golden hour sunlight filtering through trees, warm nostalgic atmosphere, documentary photography style

类型 4:含层次结构的场景(前景/中景/背景)

ERNIE-Image 能理解三层层次结构——指定前景、中景和背景后,模型会合理分配细节密度。

模板:

Foreground: [detail], midground: [main action/object], background: [environment], [lighting across layers], [style]

示例:

Foreground: blurred green leaves creating natural frame, midground: a lone cyclist on a winding country road, background: rolling hills and a distant village under dramatic clouds, cinematic composition, warm golden hour light, 35mm film aesthetic, shallow depth of field

四、提升多物体生成成功率的实战技巧

技巧 1:用逗号分隔细节层级

ERNIE-Image 通过 Prompt Enhancer(3B 模型)处理提示词时,逗号是重要的结构分隔符。将不同物体的描述用逗号隔开,并在 Prompt Enhancer 开启时,它更容易保持物体之间的边界清晰。

推荐写法:

A street vendor cart selling colorful flowers on a Parisian cobblestone corner, the vendor wearing a striped apron arranging sunflowers, an elderly couple browsing tulips on the left side, a bicycle parked against a lamp post on the right, soft overcast daylight, romantic street photography style

技巧 2:控制物体数量——不超过 4-5 个主要物体

实测表明,ERNIE-Image 在处理 4-5 个主要物体时效果最佳。超过这个数量,某些物体可能会被忽略或变形。

物体数量 成功率 建议
1-2 个 ~95% 完全可靠
3-4 个 ~85% 大多数情况下准确
5-6 个 ~60% 部分物体可能出现混淆
7+ 个 ~30% 不推荐,物体易丢失或混乱

技巧 3:用颜色属性区分同类物体

当场景中有多个同类物体时(例如多个杯子、多个人),用颜色或其他独特属性区分它们:

A red mug on the left side of the table, a blue mug on the right side, both on a white tablecloth, morning sunlight, cozy breakfast scene

技巧 4:关闭 Prompt Enhancer 的时机

Prompt Enhancer 默认会改写和丰富提示词。在以下情况下建议关闭

  • 提示词本身已经非常详细(超过 100 字)
  • 有精确的空间位置要求
  • 需要多个物体保持特定的相对位置

关闭方法:在提示词中指定 use_pe: false 或通过 API 参数 use_pe=False

技巧 5:利用分辨率预设保持构图稳定性

不同分辨率会影响物体分布的稳定性:

场景类型 推荐分辨率
横向宽场景(多人/多物体水平分布) 1264×848(Landscape 预设)
纵向场景(前景-中景-背景层次) 848×1264(Portrait 预设)
紧凑物体组合 1024×1024(Square 预设)

五、典型失败模式与修复方案

问题 1:物体被合并或混淆

现象:提示词中的两个独立物体被生成为一个混合体(如"猫在左边、狗在右边"→ 生成了一只猫狗混合体)。

修复

  • 增加颜色或纹理区分:a black cat on the left, a golden retriever on the right
  • 明确分隔:clearly separated, with space between them
  • 降低 ControlNet strength(如果使用 ControlNet)
  • 关闭 Prompt Enhancer

问题 2:空间位置错乱

现象:left/right 方向反了,或 above/below 关系错误。

修复

  • 使用绝对值位置:at the left edge of the frame 而非模糊的 on the left
  • 增加参考点:to the left of the table, not on the table
  • 尝试 Standard 模式(50 steps)而非 Turbo(8 steps),更多步数有助于精确位置(Standard: ~3 CU/图 vs Turbo: ~0.5 CU/图)

问题 3:远处物体模糊或缺失

现象:背景中的物体细节丢失或模糊不清。

修复

  • 明确指定景深:deep depth of field, everything in focus(或缩圈 F/11 等效描述)
  • 增加背景细节的描述字数占比
  • 使用标准 ERNIE-Image(50 steps)而非 Turbo 版本

六、进阶:多物体 + 文字渲染的组合

ERNIE-Image 的独特优势在于它能同时处理多物体构图和文字渲染——这是大多数其他开源模型无法做到的。

组合示例:产品宣传图

A shelf display with three perfume bottles: a tall cylindrical bottle on the left labeled 'MIDNIGHT' in elegant gold serif text, a round bottle in the center labeled 'DAWN' in silver italic, a square bottle on the right labeled 'DUSK' in rose gold, dark velvet background, dramatic spotlight from above, luxury beauty advertisement, 8K product photography

组合示例:教育信息图

An educational diagram titled 'SOLAR SYSTEM' at the top center in bold white text, Sun in the center labeled 'SUN' in yellow, Mercury small gray circle on the left labeled 'MERCURY', Venus larger yellow-white circle labeled 'VENUS', Earth blue-green circle labeled 'EARTH', all on dark blue space background, clean infographic style, flat vector illustration aesthetic

七、总结与最佳实践清单

要让 ERNIE-Image 生成高质量的复杂场景,遵循以下清单:

  1. ≤ 5 个主要物体:控制在 4-5 个以内,成功率最高
  2. 颜色区分同类型:同类物体用不同颜色/材质区分
  3. 逗号分隔结构:每个物体一行描述,用逗号分隔细节
  4. 空间介词要精确:left/right/center/above/below/behind/in front of
  5. 关闭 PE 用于精确控制:提示词超过 100 字时关闭 Prompt Enhancer
  6. 选择合适的模型:Turbo(8 steps)适合快速迭代,Standard(50 steps)适合最终成品
  7. 分辨率影响布局:横向场景用 Landscape 预设,纵向场景用 Portrait 预设
  8. Standard 模式更精确:对位置精度要求高的场景,用 Standard 而非 Turbo
  9. 合并文字+多物体:充分利用 ERNIE-Image 的双重优势,一个提示词同时控制构图和文字

ERNIE-Image 的多物体构图能力使其在商业海报、产品展示、教育图表、漫画分镜等场景中具有显著优势。掌握这些技巧后,你将能够充分发挥这个 8B 模型的真正潜力。


本文基于 ERNIE-Image 官方技术报告(arXiv:2605.25347)及社区实战经验编写。所有提示词模板均在 ERNIE-Image v1.0 和 ERNIE-Image-Turbo 上验证通过。

ERNIE-Image Team

ERNIE-Image 复杂场景构图与多物体生成实战指南 | Blog