Boosting CNN-based Handwriting Recognition Systems with Learnable Relaxation Labeling

Sara Ferro, Alessandro Torcinovich, Arianna Traviglia, Marcello PelilloarXiv 2024 · DOI

Introduction

Handwritten Text Recognition (HTR) remains a formidable challenge in computer vision due to the immense variability in individual writing styles and the physical degradation of historical manuscripts. A central technical hurdle in this field is capturing long-range contextual dependency. To accurately identify a character in a messy or degraded sequence, a system must understand the characters surrounding it—the context.

While modern architectures typically employ Transformer-based "attention mechanisms" to solve this, these models are often computationally expensive and parameter-heavy. This research proposes a more "principled" alternative: integrating Relaxation Labeling (RL)—a classical computer vision technique from the 1970s—into modern deep learning pipelines. By treating RL as a learnable module, the authors demonstrate that grounded mathematical theory can help standard Convolutional Neural Networks (CNNs) and Recurrent Neural Networks (RNNs) outperform much larger, modern architectures.

Methodology

The core innovation of this work is the Learnable Relaxation Labeling (RL) module, which bridges the gap between classical consistency algorithms and modern gradient-based optimization.

The RL Process

Originally developed in 1976, RL is an iterative process that refines label assignments (e.g., character identities) based on "compatibilities" between neighboring objects. It ensures that the labels assigned to a sequence of characters are mathematically consistent with one another.

End-to-End Learning and Sparsification

Unlike the original version of RL, which used handcrafted rules, this paper makes the compatibility matrix ($R$) learnable. Using Backpropagation Through Time (BPTT), the RL module is trained alongside the neural network backbone.

A key technical contribution is the application of $\ell_1$ regularization to this compatibility matrix. This sparsification forces the model to ignore irrelevant or noisy contextual relationships. This not only improves accuracy but also solves the classic "slow convergence" problem of relaxation algorithms, allowing the module to reach a consistent state in fewer than five iterations.

Integration Strategy

The RL module is placed between the encoder (feature extractor) and the decoder. The authors suggest that RL is particularly powerful as a regularizer during training. By forcing the network to reach a consistent state during the learning phase, the underlying CNN/RNN backbone becomes more robust. In some configurations, the module can even be removed during inference to save computational time while retaining the performance benefits gained during training.

Experimental Evaluation

The study evaluated the RL-enhanced models across four diverse benchmarks representing different eras and languages:

  • Saint Gall: 9th-century Latin manuscripts.
  • Parzival: 13th-century German manuscripts.
  • Washington: 18th-century English letters.
  • IAM: A modern English dataset featuring 657 different writers.

Key Results

The integration of RL consistently lowered both the Character Error Rate (CER) and Word Error Rate (WER) across all tested architectures.

  • State-of-the-Art Performance: On the Parzival dataset, the baseline improved from a 1.24% CER to 1.17%. On the modern IAM dataset, the RL-enhanced model achieved a 5.40% CER, outperforming several Transformer-based architectures (such as Kang et al., which sits at 7.62% CER).
  • Out-of-Vocabulary (OOV) Success: The RL module significantly improved the identification of words not present in the training vocabulary. This indicates that the system learned a generalized linguistic "common sense" rather than just memorizing a fixed dictionary.
  • Efficiency: Despite being substantially smaller than state-of-the-art Transformers, the RL-enhanced models achieved superior results, proving that clever algorithmic constraints can be more effective than raw parameter count.

Conclusion and Future Work

By revisiting and modernizing Relaxation Labeling, the authors have provided a formal framework for "consistent labeling" that complements modern deep learning. This approach offers a computationally efficient way to handle context in sequence-to-sequence tasks.

Future research will look to expand this framework from text-line level recognition to broader contexts, such as full paragraphs or entire pages, where contextual dependencies are even more complex. Additionally, the authors suggest further study into hybridizing RL processes with self-attention modules to combine the strengths of both approaches.

Summary updated

Abstract

The primary challenge for handwriting recognition systems lies in managing long-range contextual dependencies, an issue that traditional models often struggle with. To mitigate it, attention mechanisms have recently been employed to enhance context-aware labelling, thereby achieving state-of-the-art performance. In the field of pattern recognition and image analysis, however, the use of contextual information in labelling problems has a long history and goes back at least to the early 1970's. Among the various approaches developed in those years, Relaxation Labelling (RL) processes have played a prominent role and have been the method of choice in the field for more than a decade. Contrary to recent transformer-based architectures, RL processes offer a principled approach to the use of contextual constraints, having a solid theoretic foundation grounded on variational inequality and game theory, as well as effective algorithms with convergence guarantees. In this paper, we propose a novel approach to handwriting recognition that integrates the strengths of two distinct methodologies. In particular, we propose integrating (trainable) RL processes with various well-established neural architectures and we introduce a sparsification technique that accelerates the convergence of the algorithm and enhances the overall system's performance. Experiments over several benchmark datasets show that RL processes can improve the generalisation ability, even surpassing in some cases transformer-based architectures.
BibTeX
@misc{ferro2024boosting,
  author = {Sara Ferro and Alessandro Torcinovich and Arianna Traviglia and Marcello Pelillo},
  title = {{Boosting CNN-based Handwriting Recognition Systems with Learnable Relaxation Labeling}},
  year = {2024},
  eprint = {2409.05699},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.05699},
}
Figure