TL;DR
This paper introduces a novel two-stage approach for visual text blending, first generating high-quality, text-free backgrounds and then rendering text onto them with a new diffusion model called GlyphOnly. This paradigm addresses the limitations of existing methods in controlling text placement and background diversity, leading to more realistic and versatile text integration.
What Problem Does This Paper Address?
Current visual text generation methods often focus on creating entire images from text prompts. While powerful, this approach offers limited control over the quantity, layout, and specific placement of text. Furthermore, users cannot select a particular background to render text onto, and the generated scenes might unintentionally include unwanted text. Existing visual text blending methods, which aim to seamlessly merge text onto existing backgrounds, struggle with generating diverse and high-fidelity images due to a lack of varied backgrounds for training and limited generalization capabilities of their rendering models. This paper tackles these issues by proposing a new paradigm that separates background creation from text rendering, enabling more precise control and higher quality results.
Methods
The proposed method consists of two main stages:
- Creating Backgrounds: This stage focuses on generating high-fidelity, text-free natural images. It leverages existing expert models in a pipeline involving:
- Synthesis: Using a text-to-image model (DeepFloyd) and automated prompt generation (ChatGPT) to create a large number of diverse natural images.
- Erasing: Employing a pre-trained inpainting model to remove any existing text from the synthesized images, guided by OCR-generated text masks.
- Evaluation: Filtering out low-quality images using PSNR and text residual evaluation metrics.
- Rendering Texts (GlyphOnly): This is a diffusion-based model built upon Latent Diffusion Models (LDMs). Key innovations include:
- Glyph-Based Conditioning: Instead of natural language prompts, GlyphOnly uses glyph images as primary conditions for rendering, leading to more accurate text representation.
- Background Conditioning: It also incorporates background images from Stage 1 as a condition to ensure visual consistency and reduce fusion artifacts.
- Inpainting Architecture: It enhances the LDM framework with auxiliary guidance like masked image references, word-level masks, and character segmentation masks.
- Adaptive Text Block Exploration Strategy: To address the challenge of rendering small-scale texts, which is often hindered by VAE's dimensional compression, this strategy uses text regions as input and employs heuristic rules to expand square regions for better feature representation.
- Loss Functions: It utilizes a combination of denoising loss, character-aware loss (cross-entropy), and text recognition loss (using ABINet) for comprehensive training.
Datasets
- Training Data for GlyphOnly: The paper mentions using several public real scene text datasets: ICDAR2013 (IC13), ICDAR2015 (IC15), MLT17, MLT19, and SCUT-EnsText. The total volume amounts to approximately 60k images.
- Evaluation Data for GlyphOnly: A subset of 500 images with 2,733 text regions from the SCUT-EnsText test set was used. For evaluation, random words from a dictionary of 88,172 words were generated within erased regions.
- Synthetic Dataset for Scene Text Detection: The authors generated a synthetic dataset named "SynthGlyph 10K" using their proposed method for pre-training scene text detectors.
Key Insights and Ideas
- Decoupling Background and Text: Separating the generation of backgrounds from text rendering is a crucial insight. This allows for greater control over both components independently, leading to more realistic and targeted results.
- Glyph-Based Conditioning is Superior: Using actual glyph images as conditions for text rendering, rather than just text prompts, significantly improves accuracy and visual realism. This is attributed to bridging the domain gap between natural language and visual text.
- Background Conditioning Enhances Realism: Incorporating the background image as a condition in the diffusion model helps to seamlessly blend the text, reducing fusion artifacts and style deviations.
- Adaptive Strategy for Small Text: The proposed adaptive text block exploration strategy is a clever way to handle the limitations of VAEs in LDMs when rendering small text, without drastically increasing computational cost.
Key Results
- Quantitative Comparison: GlyphOnly outperforms existing diffusion-based visual text blending methods (TextDiffuser, DiffSTE, AnyText) in text recognition accuracy and normalized edit distance. For instance, it achieves 66.99% accuracy and 72.75% 1-NED on a specific test set.
- Scene Text Detection Improvement: The SynthGlyph 10K dataset, generated by the proposed method, significantly boosts the performance of scene text detectors (e.g., DBNet). When pre-trained on SynthGlyph, detectors achieve state-of-the-art results on benchmarks like IC15 and TotalText.
- Qualitative Results: Visual comparisons show that GlyphOnly generates more realistic text blending, with fewer artifacts and better integration into various backgrounds compared to existing methods. It also demonstrates a strong capability in rendering tiny text effectively.
- Ablation Studies:
- Using backgrounds generated by the proposed method leads to better scene text detection performance than using standard datasets.
- Glyph-based conditioning alone yields higher text generation accuracy than text prompts alone.
- The recognition loss plays a significant role, with an optimal Arec value of 0.03.
- The background condition does not significantly impede text rendering accuracy, with only a slight decrease observed.
Limitations and Future Work
- Speed: The two-stage method results in slower inference speeds (30-40 seconds per image).
- Future Work:
- Optimizing inference speed.
- Extending the method to video text generation.
- Exploring fine-grained object generation and line refinement, inspired by the fine-grained nature of text.
Summary updated