[Paper Review] TextDiffuser: Diffusion Models as Text Painters
TextDiffuser introduces a two-stage diffusion framework that first predicts keyword layouts with a Transformer and then renders images via diffusion conditioned on text prompts and the generated layouts; it also releases MARIO-10M and MARIO-Eval for text rendering research.
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}.
Motivation & Objective
- Motivation to improve rendering of accurate and coherent text within images produced by diffusion models.
- Create a controllable, flexible pipeline that aligns text layout with backgrounds using a Transformer-based layout stage.
- Leverage a diffusion model conditioned on both prompts and character-level layout masks to produce high-quality text in images.
- Introduce a large-scale OCR-annotated dataset MARIO-10M and a comprehensive evaluation benchmark MARIO-Eval.
- Demonstrate via experiments and user studies that the approach outperforms baselines in text rendering quality.
Proposed method
- Stage 1 (Layout Generation): Use a Transformer-based encoder-decoder to predict keyword bounding boxes from the prompt, aided by CLIP embeddings, keyword/width embeddings, and positional encoding; train with an L1 loss against ground-truth boxes to obtain character-level segmentation masks.
- Stage 2 (Image Generation): Encode the image via a VAE to a latent space, downsample and condition a latent diffusion model with the segmentation masks and additional feature masks; train with a denoising loss and a character-aware loss guided by a fixed pre-trained U-Net to improve text region quality.
- Inference: Allow generation from prompts with editable layouts, or start from a template image using pre-trained segmentation masks, and enable text inpainting to modify or reconstruct text while keeping background coherence.
- Dataset and Benchmark: Propose MARIO-10M (10,061,720 image-text pairs with OCR annotations) and MARIO-Eval (5,414 prompts and image-text pairs) to evaluate text rendering quality.
- Training Details: train the diffusion stage with 50 sampling steps, classifier-free guidance, and a single-epoch/2-epoch setup on 8 GPUs; modify input channels from 4 to 17 to accommodate layout-guided conditioning.
Experimental results
Research questions
- RQ1Can a two-stage diffusion framework with explicit text layout guidance produce readable and background-coherent text in images?
- RQ2Does incorporating character-level segmentation masks and a character-aware loss improve affordance for multi-line text rendering in diffusion models?
- RQ3How does TextDiffuser perform on text rendering quality compared to existing diffusion-based and text-aware methods?
- RQ4Can a large OCR-annotated dataset (MARIO-10M) and a dedicated MARIO-Eval benchmark provide reliable evaluation for text rendering in diffusion models?
- RQ5What are the trade-offs in controlling text layout versus purely prompt-driven generation for complex text images (posters, book covers, etc.)?
Key findings
- TextDiffuser achieves best CLIPScore among compared methods and has competitive FID while substantially improving OCR-based metrics.
- On OCR accuracy metrics, TextDiffuser significantly outperforms baselines (e.g., up to 0.5609 Acc and 0.7824 F-measure in reported results).
- Character-level segmentation masks provide explicit guidance that substantially improves text accuracy and coherence with backgrounds.
- The character-aware loss (lambda_char = 0.01) yields the best OCR accuracy in ablations, showing the value of targeted guidance.
- Two-branch training with balanced whole-image and part-image generation improves both text accuracy and detection/spotting F-measures.
- TextDiffuser outperforms Stable Diffusion, ControlNet, and DeepFloyd on OCR-related metrics and CLIPScore, with competitive FID.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.