TL;DR
Replacing text inside a photograph while matching the exact font, lighting, and wear-and-tear normally requires training AI on fake, computer-generated image pairs—leading to uncanny, "photoshopped-looking" artifacts on real photos. TextRIRO solves this by ditching synthetic training data entirely: it scrambles and crops real photos of text to destroy the words while keeping the visual style, then trains a diffusion model to reconstruct the original photo. The resulting edits are realistic enough to generate millions of new training samples that actively boost downstream text-reading AI.
What Problem Does This Paper Address?
Imagine pointing your camera at a weathered vintage street sign that says "POCKET" and wanting to change it to say "FLASH"—keeping the exact rust, shadows, perspective, and font thickness. This is Scene Text Editing (STE).
To train an neural network to do this, you ideally need paired "before and after" photos: the exact same sign in the exact same lighting, just spelling two different words. Because those pairs don't exist in nature, researchers have historically relied on rendering synthetic text onto background images. Unfortunately, models trained on fake data develop a "synthetic flavor." When applied to messy real-world photos, they leave behind ghosting artifacts from old letters, hallucinate weird spellings, or paste on rigid, unnatural-looking fonts. Inpainting methods (which mask out the text and guess the style from the surroundings) also fail when there isn't similar text nearby to copy.
The authors ask a refreshingly simple question: Is the domain gap in scene text editing actually a data problem rather than an architecture problem? And what happens if we train exclusively on real photos?
Methods
To train on single, unpaired real images without the model simply copying and pasting the input, you have to destroy what the text says (high-level sequential semantics) while preserving how it looks (low-level cues like color, stroke texture, and illumination).
What's New: * Self-Paired "Shuffle&Crop": Given a real image of a word with $L$ characters, TextRIRO slices the image along its longest axis into $L$ vertical strips. With a set probability, it randomly shuffles those strips—scrambling the letters so the model can't read the original word—and then crops a contiguous subset of strips. Shuffling breaks left-to-right word semantics, while cropping preserves local curvature and tilt in wavy or angled text. * Real-Text Conditioning: Instead of encoding target text using synthetic font glyphs or general CLIP embeddings, the authors freeze a lightweight character tokenizer pre-trained directly on real-world Scene Text Recognition (STR)—aligning how text is read with how it is drawn. * Style-Consistent Data Expansion: To help train better OCR/STR models, the authors edit real images with TextRIRO, filter out bad generations using an independent recognizer, and concatenate the original image right next to its edited twin—doubling sequence length while keeping visual style uniform.
What's Standard: The generative backbone is deliberately conventional: a Stable Diffusion 2.1 U-Net and frozen VAE, paired with a Vision Transformer (ViT) style encoder that injects multi-scale style features into the U-Net via ControlNet-style zero-convolutions.
Datasets
- Training Data: Built from U14M-Filter (3.22M labeled real scene text images).
- Evaluation Benchmarks: ScenePair (real-world paired text benchmark), Union14M-Benchmark, and six standard STR datasets (IIIT, SVT, IC13, IC15, SVTP, CUTE).
- Newly Introduced:
- RIROCommon: An upgraded editing benchmark built on the six standard STR datasets evaluating both equal-length and harder variable-length text substitutions.
- TextRIRO-3M: A 3-million-image synthetic dataset created by concatenating real U14M-Filter images with their TextRIRO-edited counterparts to form realistic long-text and multi-word samples.
Key Insights and Ideas
- Shuffle and Crop play complementary geometric roles: Column shuffling dominates on straight text (80.16% accuracy with Shuffle&Crop vs. 77.83% Crop-only on IC13) because it maximally destroys word order. Conversely, cropping shines on curved and angled text (60.93% on CUTE vs. 54.83% for Shuffle-only) because contiguous sub-patches keep local curves intact.
- High OCR accuracy on edited text can be a trap: A competing model (RS-STE) actually scored higher recognition accuracy on ScenePair (91.80%) than real ground-truth photos (88.44%), yet suffered poor visual realism (49.59 FID vs. TextRIRO's 41.53). It was essentially acting like a synthetic stamp—drawing overly crisp, recognizer-friendly letters that clashed with the real background.
- Fine-grained spatial injection beats compact tokens for text: When the authors swapped ControlNet for a modern Diffusion Transformer (DiT) conditioning method (OminiControl), accuracy dropped from 85.23% to 52.89%. Compact token-level conditioning is too coarse for typography, where slight pixel shifts change a letter's identity.
Key Results
- Visual Realism & Accuracy (ScenePair): TextRIRO achieves the best visual fidelity (41.53 FID) among all tested specialized and general editors (including Flux.1 Kontext and Qwen-Image-Edit), alongside 85.23% word accuracy—approaching the real-image upper bound of 88.44%.
- Variable-Length Editing (RIROCommon): TextRIRO hits 79.31% accuracy on equal-length edits (+8.64% over TextCtrl) and 47.64% on variable-length edits—nearly quadrupling TextCtrl (11.98%) and RS-STE (11.73%).
- Downstream STR Boost: Training an STR model purely on raw STE outputs still lags real data by ~10%, though TextRIRO leads all competitors at 86.67% (+9.78% over RS-STE). However, mixing TextRIRO-3M with real data pushes the MAERec recognizer's overall accuracy on Union14M-Benchmark up by +1.91%, and boosts challenging Multi-word recognition by +3.28% (reaching 90.17%).
Limitations and Future Work
- Imperfect Direct Replacement: Because a non-trivial number of edit failures still occur, you cannot yet blindly replace real STR training datasets 1-to-1 with uncurated STE outputs without a ~10.10% accuracy drop.
- Language Bottlenecks: TextRIRO thrives on English text because millions of labeled real-world English scene images exist. Extending this real-data-only paradigm to low-resource, multilingual scripts where real data is scarce remains open future work, alongside developing finer-grained DiT control mechanisms.
Summary updated