NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Improving handwritten OCR with training samples generated by glyph conditional denoising diffusion probabilistic model

Haisong Ding, Bozhi Luan, Dongnan Gui, Kai Chen, Qiang Huo

TL;DR

This paper introduces a Glyph Conditional Denoising Diffusion Probabilistic Model (GC-DDPM) to synthesize high-quality handwritten text images for training OCR systems. By conditioning the generation on printed glyphs and using a "progressive data filtering" strategy to prune mislabeled synthetic samples, the authors achieved a massive 45% relative reduction in Word Error Rate (WER) on the standard IAM benchmark.

What Problem Does This Paper Address?

Handwritten Optical Character Recognition (OCR) is notoriously difficult because of the infinite variety in human writing styles and the cursive nature of strokes. To build a robust model, you need a mountain of labeled data. However, collecting and labeling real-world handwriting is slow, expensive, and often results in datasets that lack "coverage"—meaning many words are only written by a few people, or certain styles are underrepresented.

While Generative Adversarial Networks (GANs) have been used to "hallucinate" new training data, they often require guidance from an external pre-trained recognizer to stay on track. They also struggle to map raw text strings directly to complex handwritten strokes. This paper explores whether the recent success of Diffusion Models can provide a better path to photo-realistic, style-consistent synthetic data.

Methods

The authors propose a two-pronged approach:

  1. GC-DDPM (The Generator):
    • Glyph Conditioning: Instead of feeding the model a text string (like "hello"), they render that text into a standard printed font image (a glyph). This gives the model a structural "skeleton" to follow, making it easier to learn the mapping to handwritten strokes.
  2. Style Control: The model incorporates writer ID embeddings, allowing it to mimic specific individuals' styles or even interpolate between two writers to create entirely new "synthetic" personas.
  3. Classifier-Free Guidance: They use a guidance scale to balance the trade-off between image quality (how "clean" it looks) and diversity (how much the style varies).
  4. Progressive Data Filtering (The Sanity Check): Diffusion models sometimes "hallucinate" or fail to render the text correctly, leading to a mismatch between the image and its intended label. To fix this, the authors:

  5. Train an initial OCR model on real data.

  6. Use that model to score synthetic images. If the model's prediction for a synthetic image is vastly different from the intended label, that sample is discarded.
  7. They repeat this process iteratively, adding high-confidence synthetic samples to the training set to improve the OCR model, which in turn becomes a better filter.

Datasets

  • IAM Handwriting Database: The primary benchmark, containing ~115,000 word images from 657 writers.
  • English Words Corpus: An external list of ~466,000 unique English words used to generate "out-of-vocabulary" (OOV) synthetic samples to test the model's ability to handle unseen content.

Key Insights and Ideas

  • Glyphs > Text: Using a printed image as a condition provides much richer spatial information than a raw ASCII string. This helps the diffusion model understand character spacing and alignment better than previous GAN-based methods.
  • The "Hallucination" Tax: Diffusion models are great at making things look real, but they aren't perfect at following instructions. The authors realized that adding unfiltered synthetic data can actually hurt OCR performance because the labels are sometimes wrong.
  • Style Interpolation: By mathematically blending the "embeddings" of two different writers, the model can generate a "hybrid" handwriting style, effectively creating an infinite number of synthetic writers to train on.

Key Results

  • Massive Accuracy Gains: On the IAM word-level task, the OCR model's Word Error Rate (WER) dropped from 19.47% (trained on real data only) to 10.72% (trained on real + filtered synthetic data). This represents a 45% relative reduction in error.
  • Superior Realism: The model achieved a Fréchet Inception Distance (FID) score of 86.93, significantly better than previous state-of-the-art methods like ScrabbleGAN (97.81) and GANwriting (125.87), indicating much higher image quality.
  • Zero-Shot Capabilities: Even when generating words that were never seen in the original training set, the GC-DDPM produced high-quality results that significantly boosted the OCR's ability to generalize.

Limitations and Future Work

  • Noise in Unseen Words: The authors noted that synthetic images for "out-of-vocabulary" words (words not in the training set) are noisier and have a higher failure rate than "seen" words, which is why the filtering strategy is so critical.
  • Computational Cost: Diffusion models are notoriously slower to sample from than GANs. While the authors used DDIM (a faster sampling method) with 50 steps, generating millions of images still requires significant compute.
  • Language Models: The current study focuses purely on the visual recognition (OCR) without using external language models (which usually correct spelling). Combining this synthetic data approach with a strong language model could likely push error rates even lower.

Summary updated

BibTeX
@inproceedings{ding2024improving,
  author = {Haisong Ding and Bozhi Luan and Dongnan Gui and Kai Chen and Qiang Huo},
  title = {{Improving handwritten OCR with training samples generated by glyph conditional denoising diffusion probabilistic model}},
  booktitle = {International Conference on Document Analysis and Recognition},
  year = {2024},
  url = {https://openreview.net/forum?id=1DATNrUOla},
}

Loading related content...

Figure