TL;DR
HarmonyText is a mask-free scene text editing (STE) framework that achieves superior visual realism by decoupling background preservation from text generation. By combining region-aware optimization, frequency-domain texture guidance, and a novel "Reverse-to-Refined" data synthesis pipeline, it eliminates the common pitfalls of color shifts and blurred textures found in existing instruction-following models.
What Problem Does This Paper Address?
Scene Text Editing (STE) is the task of changing text within a natural image (like a street sign or a product label) while keeping the background, lighting, and texture perfectly intact. While recent "mask-free" models allow users to edit images using simple natural language instructions, they face three major hurdles:
- Background Degradation: Without explicit masks, models often "hallucinate" changes in unedited regions, leading to noticeable color shifts and loss of original detail.
- Texture Smoothing: Standard training objectives (like Mean Squared Error) tend to favor low-frequency information, resulting in edited text that looks blurry or "sticker-like" rather than naturally integrated.
- Data Scarcity: There are no massive datasets of "before and after" real-world photos. Researchers usually rely on synthetic "pseudo-ground truth" data, which often contains artifacts that the model then learns to replicate.
Methods
The authors propose a multi-pronged approach to ensure "harmony" between the edited text and the original scene:
1. Region-Decoupling Optimization (RDO)
Instead of applying a single loss function to the whole image, RDO identifies which parts of the image are being edited in the latent space. It then "anchors" the non-edited regions to the source image to ensure the background remains unchanged, while supervising the edited region against the target text.
2. Cascaded High-Frequency Texture Guidance (CHFTG)
To combat blurriness, the authors introduce a frequency-aware loss. They use a Discrete Wavelet Transform (DWT) to decompose the image into different frequency bands. By specifically supervising the high-frequency subbands, the model is forced to learn sharp text boundaries and fine-grained surface textures (like the grain of wood or the crinkle of paper).
3. Reverse-to-Refined Pair Synthesis (RePair)
This is a clever data generation trick. Since high-quality paired data is rare, the authors take flawed edits from existing models and treat them as "corrupted" inputs. They train a model to reverse the edit—reconstructing the original real image from the flawed one. This teaches the model how to remove artifacts and restore realism. This "refined" model is then used to generate a high-quality training dataset called STE25K.
Datasets
- STE25K: A new, high-quality dataset of 25,000 paired images generated via the RePair pipeline.
- HarmonyText-Bench: A benchmark of 155 high-resolution images with diverse styles and challenging backgrounds.
- Public-STR Generalization Set: 345 images sampled from six public scene text recognition datasets to test real-world performance.
- H2R (Human Harmony Reference): 80,000 images used to train a Harmony Assessment Model (HAM), a new metric for evaluating how well text blends into its surroundings.
Key Insights and Ideas
- Learning from Failure: The "aha" moment of the RePair pipeline is that a model can learn more about realism by fixing a bad edit than by trying to generate a perfect one from scratch. Reversing the process provides a clean, real-world target (the original photo) for supervision.
- Frequency Matters: Most diffusion-based editors struggle with text because text is essentially high-frequency information (sharp edges). Decoupling these frequencies during training is essential for legibility and texture.
- GT-Free Evaluation: The authors introduce Color Distribution Divergence (CDD). By comparing the color histograms of the original text and the edited text in the CIELAB color space, they can objectively measure color consistency without needing a ground-truth image.
Key Results
HarmonyText consistently outperforms state-of-the-art models like AnyText2 and FireRed-Image-Edit:
- Background Fidelity: Achieved a 28.44 dB PSNR, outperforming the strongest open-source baseline by 1.65 dB.
- Color Consistency: Reduced color distribution divergence (CDD) by 19.2% compared to the next best method.
- Human Preference: In a blinded user study, HarmonyText was preferred over baselines in over 82% of cases, and even beat strong commercial competitors like Nano Banana Pro.
Limitations and Future Work
- Dependency on Upstream Models: The framework relies on external tools (like PaddleOCR and HiSAM) for text localization and segmentation. Errors in these components can propagate through the pipeline.
- Complex Layouts: While it handles standard text well, extremely curved, tiny, or low-resolution text remains a challenge.
- Linguistic Scope: The current evaluation primarily covers Chinese and English. Expanding to a wider variety of languages and scripts is a suggested direction for future research.
Summary updated