Self-Supervised Text Erasing with Controllable Image Synthesis

Gangwei Jiang, Shiyao Wang, Tiezheng Ge, Yuning Jiang, Ying Wei, Defu Lian · DOI

Introduction

Scene text erasing—the process of removing text from an image and plausibly inpainting the background—is a critical task for privacy protection, such as blurring license plates, and for graphic design applications. Despite its utility, the field faces a significant bottleneck: the scarcity of paired training data. Training robust models typically requires "before" and "after" image pairs, where the "after" images (ground truth) must be manually inpainted by experts to ensure high quality. This process is labor-intensive and difficult to scale.

To circumvent this, researchers often rely on synthetic data. However, a massive distribution divergence exists between standard computer-generated text and real-world text, which often features complex shadows, artistic borders, and perspective shifts. Models trained on simple synthetic data frequently fail when applied to complex, high-resolution real-world images like advertisements and posters. This paper introduces STE (Self-supervised Text Erasing), a framework designed to eliminate the need for manual labels by jointly learning to synthesize realistic training data and erase real-world text.

Methodology

The STE framework bridges the "style gap" between synthetic and real domains through two primary modules: a Controllable Synthesis Module and an Erasing Module.

1. Controllable Synthesis Module

Rather than randomly placing text, this module learns to generate training samples that mimic the specific style of the target domain. It utilizes two distinct mechanisms:

  • Customization: Renders text using a variety of fonts and colors.
  • Replication: Uses Maximally Stable Extremal Regions (MSER) to "copy-paste" actual text strokes from real images. This preserves authentic textures and artistic styles that are difficult to simulate programmatically.

To manage these mechanisms, an LSTM-based Policy Network acts as a director, selecting style parameters such as font, blur, and shadow. This network is trained via Reinforcement Learning (the REINFORCE algorithm) using a dual-reward system. A Realistic Reward is provided by a discriminator that evaluates how closely the synthetic text resembles real-world examples, while a Difficulty Reward encourages the synthesis of challenging examples that the current erasing model struggles to process. This creates an evolving curriculum for the model.

2. Erasing Module

The erasing network utilizes a coarse-to-fine architecture. To address the common problem of "ghost" text—faint, blurry outlines left behind after erasure—the authors introduce the Triplet Erasure Loss (TEL). Unlike standard losses that only minimize the distance between the output and the ground truth, TEL explicitly pushes the refined output away from the blurry coarse output. This "push-pull" dynamic incentivizes the model to recover fine-grained background textures rather than settling for the blurred approximations produced in the initial stage.

Datasets and Evaluation

The authors evaluated STE on several benchmarks, including the widely used SCUT-Enstext (~3,500 images). Furthermore, they introduced PosterErase, a new and significantly more challenging dataset containing 60,000 high-resolution posters. PosterErase features complex Chinese typography and diverse artistic backgrounds, providing a rigorous test for text erasing models.

Key Results and Insights

  • Performance Gains: On the PosterErase dataset, the unsupervised STE framework achieved a Frechet Inception Distance (FID) of 5.07. This outperformed supervised baselines, such as EraseNet, by a relative 20.9%.
  • Domain Adaptation: STE demonstrated a 3.8% to 7.5% improvement in FID across various datasets compared to standard synthetic-to-real methods like DANN, proving that controllable synthesis is more effective than simple feature alignment.
  • Qualitative Sharpness: Visual analysis indicates that STE is particularly effective at removing shadows and borders—artifacts that typically plague other models.

Conclusion and Future Work

STE represents a significant step forward in self-supervised image editing. By using Reinforcement Learning to close the loop between data synthesis and model training, the framework effectively addresses the distribution gap that limits traditional synthetic training. While the reliance on MSER for text replication can be a limitation in extremely cluttered or low-contrast environments, the overall approach offers a scalable solution for high-fidelity text removal. Future research may explore integrating more sophisticated text detection models into the synthesis loop to further refine the placement and realism of synthetic training samples.

Summary updated

BibTeX
@inproceedings{jiang2022self,
  author = {Gangwei Jiang and Shiyao Wang and Tiezheng Ge and Yuning Jiang and Ying Wei and Defu Lian},
  title = {{Self-Supervised Text Erasing with Controllable Image Synthesis}},
  booktitle = {ACM Multimedia},
  year = {2022},
  url = {https://openreview.net/forum?id=GFuw-JAw0Z},
}
Figure