Enhancing OCR Performance through Post-OCR Models: Adopting Glyph Embedding for Improved Correction

Yung-Hsin Chen, Yuli ZhouarXiv 2023 · DOI

Abstract

Optical Character Recognition (OCR) systems frequently encounter difficulties with degraded or stylistically complex text. Traditional post-OCR correction methods rely solely on linguistic context, ignoring the original visual information. This paper introduces a novel architecture that incorporates "glyph embeddings"—numerical representations of character appearance—alongside semantic embeddings from CharBERT. By fusing visual and linguistic features within a Transformer decoder, the model achieves substantial error reduction. Results show that integrating glyph information can reduce the Character Error Rate (CER) of state-of-the-art models like TrOCR from 0.0478 to 0.0013.

Introduction

While OCR technology has matured, "in-the-wild" scenarios involving blurry images, artistic fonts, or historical document degradation remain significant hurdles. Standard post-OCR correction typically treats the problem as a sequence-to-sequence task where a language model (LM) predicts the most likely word given a noisy input string. However, these "blind" models lack access to the visual evidence that caused the initial misinterpretation. For instance, a language model might struggle to distinguish between "he1lo" and "hello" without knowing if the '1' visually resembled an 'l'. This research bridges that gap by re-introducing visual glyph information into the correction pipeline.

Methodology

The proposed architecture utilizes a dual-encoder system to capture both the meaning and the appearance of text.

Dual-Input Architecture

  1. Semantic Embedding (CharBERT): The model employs CharBERT, a character-aware pre-trained language model. Unlike standard subword-based models, CharBERT is robust against the character-level noise typical of OCR outputs, such as substitutions or deletions.
  2. Glyph Embedding: To capture visual features, the researchers developed a custom embedding using ResNet-18 and ResNet-50 backbones. These models were trained on the Chars74K dataset to recognize the visual structure of characters. A "garbage class" containing characters from unrelated scripts (e.g., Hebrew, Korean) was included during training to improve the model's ability to filter out visual noise.
The proposed post-OCR correction architecture featuring dual semantic and glyph encoders.

Feature Fusion

The outputs from the CharBERT and CNN-based glyph encoders are concatenated and fed into a Transformer decoder. This allows the decoder to cross-reference linguistic probability with visual similarity, effectively "breaking the tie" when multiple words are semantically plausible but visually distinct.

Experimental Results

The model was evaluated on benchmarks including ICDAR 2013 and ICDAR 2023. The inclusion of glyph embeddings led to consistent performance gains across various base OCR engines, including EasyOCR, PaddleOCR, and TrOCR.

Comparison of OCR performance with and without glyph embeddings across different base models.

As shown in the results, the impact on TrOCR was particularly significant. The Character Error Rate (CER) dropped from 0.0478 to 0.0013, and the Word Error Rate (WER) decreased from 0.0859 to 0.0067. The glyph-augmented model proved especially effective at correcting single words where linguistic context is minimal, relying instead on the visual "shape" of the error.

Discussion and Conclusion

A key finding in the development of the glyph encoder was the importance of fine-tuning depth. The researchers observed that unfreezing only the last two layers (L2) of the ResNet model provided the highest accuracy (87.37%), whereas unfreezing more layers introduced noise that degraded performance.

While currently limited to alphanumeric characters in English, this approach demonstrates that visual context is a vital component of robust text recognition. Future work will focus on expanding the character set to include punctuation and special symbols, further enhancing the model's utility for complex document digitization.

Summary updated

BibTeX
@misc{chen2023enhancing,
  author = {Yung-Hsin Chen and Yuli Zhou},
  title = {{Enhancing OCR Performance through Post-OCR Models: Adopting Glyph Embedding for Improved Correction}},
  year = {2023},
  eprint = {2308.15262},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2308.15262},
}
Figure