Abstract
Scene Text Removal (STR) aims to erase text from natural images and replace it with visually plausible backgrounds. Traditional methods typically employ complex, multi-stage CNN architectures that are prone to error propagation and struggle with global context. This paper introduces ViTEraser, a novel one-stage Vision Transformer (ViT) framework. By utilizing a hierarchical encoder-decoder structure and a specialized pretraining strategy called SegMIM (Segmentation + Masked Image Modeling), ViTEraser effectively locates text and reconstructs backgrounds simultaneously. Experimental results demonstrate that ViTEraser achieves state-of-the-art performance on major benchmarks, offering superior erasure quality and efficiency.
Introduction
Scene Text Removal is a critical task for privacy protection and image editing. Historically, the field has been dominated by "detect then inpaint" pipelines using Convolutional Neural Networks (CNNs). However, these multi-stage approaches face two significant challenges:
- Error Propagation: Inaccuracies in the initial text detection stage lead to artifacts or "ghost" text in the final output, as the inpainter cannot correct detection failures.
- Limited Receptive Fields: CNNs' local focus makes it difficult to maintain global structural consistency when filling large gaps.
ViTEraser addresses these issues by adopting a one-stage Vision Transformer architecture, leveraging self-attention to capture global dependencies and simplify the overall pipeline.
Methods
Architecture
ViTEraser is built as an end-to-end encoder-decoder architecture using ViT blocks. The Encoder is a hierarchical Transformer that downsamples the input image while capturing broad context. The Decoder mirrors this structure, utilizing a novel Patch Splitting layer—the mathematical inverse of patch embedding—to upsample features back to the original resolution. Lateral connections between the encoder and decoder preserve high-resolution details, ensuring sharp background reconstruction.
SegMIM Pretraining
To overcome the limitations of small STR datasets, the authors introduce SegMIM, a dual-task pretraining strategy applied to large-scale text detection datasets.
SegMIM consists of two components:
- Segmentation (Seg): The encoder is trained to segment text boxes, teaching the model precisely where text is located.
- Masked Image Modeling (MIM): The decoder reconstructs randomly masked image patches, forcing the model to learn how to synthesize missing pixels based on the surrounding environment.
This synergy allows ViTEraser to develop a deep understanding of the relationship between text and its background before fine-tuning on specific STR tasks.
Results and Discussion
ViTEraser was evaluated on the SCUT-EnsText (real-world) and SCUT-Syn (synthetic) benchmarks.
- State-of-the-Art Performance: On SCUT-EnsText, ViTEraser-Base with SegMIM achieved a PSNR of 37.11, significantly outperforming previous leaders like CTRNet (35.20) and EraseNet (32.30).
- Erasure Quality: Detection-based metrics show an f-measure drop to 0.768%, indicating nearly complete and realistic text removal.
- Efficiency: The framework is highly scalable. The "Tiny" variant operates at 24 FPS, making it suitable for real-time applications.
- Robustness: Beyond removal, the model's learned features proved effective for tasks like Tampered Scene Text Detection, showcasing strong generalization.
Conclusion
ViTEraser demonstrates that Vision Transformers are a natural fit for scene text removal. By simplifying the architecture to a single stage and introducing the SegMIM pretraining strategy, the model overcomes the traditional pitfalls of CNN-based methods. Future work may involve extending this framework into a unified model capable of handling various pixel-level OCR tasks, such as text spotting and editing, within a single architecture.
Summary updated