Abstract
Modern text recognition systems require vast amounts of labeled data, which is often difficult and expensive to acquire. This paper presents CTIG-DM (Conditional Text Image Generation with Diffusion Models), a novel framework that leverages the stability and diversity of diffusion models to generate highly realistic handwritten and scene text images. By decoupling text content, visual style, and image conditions, CTIG-DM enables high-quality data augmentation and the synthesis of out-of-vocabulary words, significantly boosting the performance of existing recognition models.
Introduction
Optical Character Recognition (OCR) and Handwritten Text Recognition (HTR) have seen significant advances, yet they remain constrained by the availability of diverse, labeled training data. Real-world images feature complex backgrounds, varying fonts, and unique handwriting styles that are hard to replicate. While Generative Adversarial Networks (GANs) and traditional synthetic engines have been used to bridge this gap, they often suffer from training instability, mode collapse, or a lack of realistic texture.
To address these challenges, researchers from Alibaba DAMO Academy introduced CTIG-DM. By utilizing Diffusion Models, known for their superior sample quality and diversity, the framework produces text images that are nearly indistinguishable from real-world samples.
Methodology: The CTIG-DM Framework
The core of CTIG-DM is a specialized Conditional Encoder that extracts three distinct signals to guide a UNet-based diffusion process.
Conditional Signals
- Image Condition ($c_i$): Extracted using a pre-trained text recognizer, this signal captures general visual features like texture and color while filtering out background noise.
- Text Condition ($c_t$): To handle Out-Of-Vocabulary (OOV) words, the model uses character-level classifier weights from a pre-trained recognizer rather than standard word embeddings.
- Style Condition ($c_s$): Specifically designed for handwriting, this captures writer-specific traits such as slant, stroke width, and cursive connectivity.
Generation Modes
By manipulating these conditions, CTIG-DM supports four distinct operational modes:
- Synthesis: Generates text images from a character string.
- Augmentation: Modifies existing images to create variations.
- Recovery: Reconstructs images from text and visual hints.
- Imitation: Mimics a specific writer's style for new, unseen words.
Experimental Results
The model was evaluated on major benchmarks including IAM (English), RIMES (French), and CASIA-HWDB (Chinese).
Visual Quality and Realism
CTIG-DM achieved a state-of-the-art Fréchet Inception Distance (FID) of 9.34 on the IAM dataset, significantly outperforming previous GAN-based models like SLOGAN (12.06) and ScrabbleGAN (20.72). The generated images maintain sharp character structures even in complex cursive styles, avoiding the legibility issues common in GAN outputs.
Recognition Performance
The high-quality synthetic data directly translates to improved recognition accuracy:
- Handwriting: Augmenting the IAM training set with CTIG-DM data reduced the Word Error Rate (WER) by 4.78%.
- Scene Text: On the Real-L dataset, accuracy improved by 4.9% for CRNN and 1.5% for ABINet.
- Domain Adaptation: The model proved effective at bridging the "domain gap" by generating samples that combine the lexicon of a target dataset with the style of a source dataset.
Conclusion and Future Work
CTIG-DM demonstrates that Diffusion Models are a powerful tool for text image generation, offering better content validity and diversity than traditional methods. While the performance gains in Scene Text Recognition are more incremental due to the existing abundance of synthetic data, the framework excels in handwriting and OOV synthesis. Future research will focus on "zero-shot" style imitation from single images and expanding the model's capabilities to more complex scripts like Arabic and Indic languages.
Summary updated