TL;DR
StyleTextGen is a novel framework for style-conditioned multilingual scene text generation that precisely replicates fonts, colors, and textures from a reference image onto generated text. By introducing a dual-branch style encoder, a text style consistency loss, and a mask-guided inference strategy, it achieves state-of-the-art performance in transferring complex artistic styles across different languages and cluttered backgrounds.
What Problem Does This Paper Address?
While text-to-image diffusion models have made massive strides in generating photorealistic imagery, rendering stylized scene text remains a significant challenge. Specifically, style-conditioned scene text generation aims to synthesize text that faithfully inherits visual attributes—such as font characteristics, stroke patterns, color gradients, and textures—from a reference image.
Current methods struggle with two main issues:
- Style-Content Entanglement: Extracting text-specific style features from complex, cluttered backgrounds is difficult, often leading to background artifacts bleeding into the generated text.
- Multilingual Inconsistency: Maintaining fine-grained style consistency across characters becomes exceptionally difficult when transferring styles between entirely different writing systems (e.g., applying an English script's style to Chinese characters), where typographic structures and stroke counts vary drastically.
Methods
StyleTextGen operates under a diffusion-based inpainting paradigm built upon a Diffusion Transformer (DiT) backbone. The core architecture introduces three main innovations:
- Dual-Branch Style Encoder: To robustly capture style without background interference, the framework splits style encoding into two branches:
- Textual Style Branch: Uses a text-oriented encoder pretrained on a style-preserving multilingual text segmentation task. This forces the encoder to focus on fine-grained typographic features and stroke textures.
- Visual Prior Branch: Utilizes a generic, text-insensitive vision encoder (SigLIP) to capture holistic scene information, global appearance, and tonal coherence.
- The outputs of both branches are fused via cross-attention to modulate the DiT backbone.
- Text Style Consistency Loss ($\mathcal{L}_{tsc}$): To prevent character style drift, the authors introduce a loss function that computes and aligns the Gram matrices (which capture texture and style statistics) specifically within the segmented text regions of both the generated and reference images.
- Inference-time Style Injection: During the first 10 denoising steps, the model uses mask-based inversion to extract clean key-value feature pairs from the reference image's text regions, applying Adaptive Instance Normalization (AdaIN) to blend them precisely into the target generation area.
Datasets
The authors curated a specialized bilingual stylized dataset for training, leveraging 77 TrueType fonts, 2,218 artistic style prompts, and 10,000 text-free background images.
For evaluation, the paper utilizes:
- AnyWord-Eval: A balanced bilingual benchmark consisting of 1,000 English and 1,000 Chinese samples.
- StyleText-CE (New Benchmark): Introduced in this paper, this dataset contains 2,021 high-quality Chinese and English scene text images. It explicitly supports four evaluation configurations: self-style reference, external-style reference, monolingual generation, and cross-lingual transfer.
Key Insights and Ideas
- Style-Preserving Pretraining over Binary Masking: Instead of training the textual encoder to produce simple binary masks, pretraining it on a style-preserving text segmentation task forces the network to retain layout and typographic details, creating a much more robust style descriptor.
- The Power of Asymmetry: Combining a text-focused encoder with a text-insensitive generic encoder prevents the model from taking "shortcuts" during self-reference training (where the reference and target background are the same), leading to vastly superior generalization when given completely external style images.
- Localized Statistical Alignment: Background clutter often muddies global style losses. Restricting the Gram matrix style loss strictly to localized text masks ensures that the model optimizes for font and texture consistency rather than trying to replicate background noise.
Key Results
StyleTextGen significantly outperforms existing state-of-the-art methods like AnyText, Calligrapher, and TextFlux in both text accuracy and style similarity.
- Higher Text Accuracy: On the AnyWord-Eval benchmark, StyleTextGen improves sentence accuracy (Sen.Acc) over the previous best method (TextFlux) by 5.6% on English and 3.4% on Chinese data.
- Superior Style Adherence: The model achieved a 16.7% reduction in FID scores for English and an 8.21% reduction for Chinese compared to TextFlux, indicating that the generated text is perceptually much closer to the reference style.
- Cross-Lingual Generalization: Quantitative tests on StyleText-CE demonstrated that when transferring styles across languages (e.g., English $\rightarrow$ Chinese), StyleTextGen maintained high legibility and stylistic fidelity where competing models suffered from structural distortions.
Limitations and Future Work
The authors note that FID and LPIPS error metrics are inherently higher in cross-lingual generation settings. This is primarily because the glyph shapes of the reference text (e.g., Latin characters) differ fundamentally from the target text (e.g., Chinese characters), leading to larger baseline distribution discrepancies even when the stylistic texture transfer is visually successful. Future work may explore better evaluation metrics tailored specifically for cross-lingual structural style transfer.
Summary updated