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 \textbf{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, \textbf{MARIO-10M}, containing 10 million image-text pairs with text recognition, detection, and character-level segmentation annotations. We further collect the \textbf{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}.
翻译:扩散模型因其令人印象深刻的生成能力而日益受到关注,但目前在渲染准确且连贯的文本方面仍存在困难。为解决此问题,我们引入了 \textbf{TextDiffuser},专注于生成与背景协调、视觉上吸引人的文本图像。TextDiffuser 包含两个阶段:首先,一个 Transformer 模型生成从文本提示中提取的关键词的布局;然后,扩散模型根据文本提示和生成的布局条件生成图像。此外,我们贡献了首个带有 OCR 注释的大规模文本图像数据集 \textbf{MARIO-10M},包含 1000 万图像-文本对,并带有文本识别、检测和字符级分割注释。我们进一步收集了 \textbf{MARIO-Eval} 基准,作为评估文本渲染质量的综合工具。通过实验和用户研究,我们展示了 TextDiffuser 灵活且可控,能够仅使用文本提示或结合文本模板图像创建高质量文本图像,并执行文本修复以重建带有文本的不完整图像。代码、模型和数据集将在 \url{https://aka.ms/textdiffuser} 提供。