[论文解读] TextDiffuser: Diffusion Models as Text Painters
TextDiffuser 引入了一个两阶段扩散框架,首先使用 Transformer 预测关键字布局,然后在文本提示和生成的布局条件下通过扩散渲染图像;它还发布 MARIO-10M 和 MARIO-Eval 以用于文本渲写研究。
Diffusion models have gained increasing attention for their impressive generation abilities but currently struggle with rendering accurate and coherent text. To address this issue, we introduce TextDiffuser, focusing on generating images with visually appealing text that is coherent with backgrounds. TextDiffuser consists of two stages: first, a Transformer model generates the layout of keywords extracted from text prompts, and then diffusion models generate images conditioned on the text prompt and the generated layout. Additionally, we contribute the first large-scale text images dataset with OCR annotations, MARIO-10M, containing 10 million image-text pairs with text recognition, detection, and character-level segmentation annotations. We further collect the MARIO-Eval benchmark to serve as a comprehensive tool for evaluating text rendering quality. Through experiments and user studies, we show that TextDiffuser is flexible and controllable to create high-quality text images using text prompts alone or together with text template images, and conduct text inpainting to reconstruct incomplete images with text. The code, model, and dataset will be available at \url{https://aka.ms/textdiffuser}.
研究动机与目标
- 提升通过扩散模型生成的图像中文本的准确性和连贯性渲染的动机。
- 创建一个可控、灵活的流水线,在 Transformer 基于布局阶段的帮助下使文本布局与背景对齐。
- 利用同时以提示和字符级布局掩模为条件的扩散模型,在图像中生成高质量文本。
- 引入大规模 OCR 注释数据集 MARIO-10M 和全面的评估基准 MARIO-Eval。
- 通过实验和用户研究证明该方法在文本渲染质量方面优于基线方法。
提出的方法
- Stage 1 (Layout Generation): 使用基于 Transformer 的编码器-解码器从提示中预测关键字边界框,辅以 CLIP 嵌入、关键字/宽度嵌入和位置编码;以相对于真实框的 L1 损失进行训练以获得字符级分割掩模。
- Stage 2 (Image Generation): 通过 VAE 将图像编码到潜在空间,进行下采样并用分割掩模和额外的特征掩模对潜在扩散模型进行条件化;以去噪损失和受固定预训练 U-Net 指导的字符感知损失进行训练,以提升文本区域质量。
- Inference: 允许从带有可编辑布局的提示进行生成,或使用预训练分割掩模从模板图像开始,并支持文本修补以修改或重构文本,同时保持背景连贯性。
- Dataset and Benchmark: 提出 MARIO-10M(10,061,720 图像-文本对,带 OCR 注释)和 MARIO-Eval(5,414 个提示和图像-文本对)以评估文本渲染质量。
- Training Details: 使用 50 次采样步长、无分类器引导,且在 8 个 GPU 上进行单轮/两轮训练;将输入通道从 4 改为 17 以适应布局引导条件。
实验结果
研究问题
- RQ1带有显式文本布局引导的两阶段扩散框架能否在图像中产生可读且与背景协调的文本?
- RQ2结合字符级分割掩模和字符感知损失是否提升扩散模型对多行文本渲染的可行性?
- RQ3TextDiffuser 在文本渲染质量方面相较于现有的基于扩散和文本感知方法的表现如何?
- RQ4一个大型 OCR 注释数据集(MARIO-10M)和专门的 MARIO-Eval 基准是否能为扩散模型中的文本渲染提供可靠评估?
- RQ5在控制文本布局与仅由提示驱动的生成之间,在复杂文本图像(海报、书籍封面等)上有哪些权衡?
主要发现
| 指标 | StableDiffusion | ControlNet | DeepFloyd | TextDiffuser |
|---|---|---|---|---|
| FID | 51.295 | 51.485 | 34.902 | 38.758 |
| CLIPScore | 0.3015 | 0.3424 | 0.3267 | 0.3436 |
| OCR(Accuracy) | 0.0003 | 0.2390 | 0.0262 | 0.5609 |
| OCR(Precision) | 0.0173 | 0.5211 | 0.1450 | 0.7846 |
| OCR(Recall) | 0.0280 | 0.6707 | 0.2245 | 0.7802 |
| OCR(F-measure) | 0.0214 | 0.5865 | 0.1762 | 0.7824 |
- TextDiffuser 在对比方法中达到最佳的 CLIPScore,并且在 FID 上具有竞争力,同时显著提升 OCR 基准指标。
- 在 OCR 精度指标上,TextDiffuser 明显优于基线(如报道结果中最高达到 0.5609 Acc 和 0.7824 F-measure)。
- 字符级分割掩模提供了明确的引导,显著提升文本准确性及与背景的一致性。
- 字符感知损失(lambda_char = 0.01)在消融中提供了最佳 OCR 精度,显示了定向引导的价值。
- 双分支训练,在整体图像与局部图像生成之间取得平衡,提升了文本准确性以及检测/识别的 F-measure。
- TextDiffuser 在 OCR 相关指标和 CLIPScore 上超越 Stable Diffusion、ControlNet 和 DeepFloyd,FID 具有竞争力。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。