Abstract
This paper presents a novel end-to-end neural network for Online Handwritten Mathematical Expression Recognition (OHMER). By employing a Gated Recurrent Unit (GRU) based encoder-decoder architecture with a specialized coverage-based attention mechanism, the system eliminates the need for complex, manually-defined grammars. The model achieves state-of-the-art performance on the CROHME 2014 benchmark, reaching an expression recognition accuracy of 52.43%.
Introduction
Recognizing handwritten mathematical expressions is significantly more challenging than standard text recognition due to the two-dimensional nature of math. A system must not only identify individual symbols (e.g., $x$, $2$, $\pi$) but also interpret their spatial relationships, such as superscripts, subscripts, fractions, and nested radicals.
Traditionally, this problem was addressed using multi-stage pipelines involving symbol segmentation, recognition, and structural analysis based on Stochastic Context-Free Grammars (SCFGs). However, these methods are often brittle, requiring extensive prior knowledge and manually-defined rules. This research proposes replacing these pipelines with a single, data-driven "image-to-LaTeX" framework.
Methodology
System Architecture
The proposed system follows an end-to-end encoder-decoder paradigm. The process begins with raw handwritten input and concludes with a generated LaTeX sequence, as illustrated in the pipeline below.
The Encoder
The encoder processes the input sequence of 2D ink trajectory points. These points are converted into 8-dimensional feature vectors capturing coordinates, offsets, and pen status. A stack of bi-directional GRUs is used to capture context from both the beginning and the end of the stroke sequence. Pooling layers are implemented to reduce sequence length, facilitating more effective decoding.
Decoder and Coverage-based Attention
The decoder is a unidirectional GRU that generates a LaTeX string one token at a time. The core innovation is the coverage-based attention mechanism. Standard attention mechanisms often suffer from "losing their place," leading to over-translation (repeating symbols) or under-translation (skipping symbols). The authors introduced a "coverage vector" that tracks the history of attention, ensuring the model knows which parts of the handwritten trajectory have already been processed.
Experimental Results
The model was evaluated using the CROHME 2014 dataset, consisting of 8,836 training expressions and 986 test expressions. The proposed approach significantly outperformed previous state-of-the-art systems.
| System | Expression Accuracy (ExpRate) |
|---|---|
| Previous Best (System I) | 37.22% |
| Proposed P1 (No Coverage) | 42.49% |
| Proposed P2 (With Coverage) | 46.86% |
| Proposed P3 (Ensemble of 5 models) | 52.43% |
Beyond perfect matches, the system showed high resilience, with over 72% of expressions having three or fewer errors. Visual analysis of attention weights confirmed that the model implicitly learns structural rules, such as looking at the upper-right of a base symbol when generating superscript tokens.
Conclusion
The transition to an end-to-end, grammar-free model represents a significant advancement in OHMER. The coverage-based attention mechanism provides a robust foundation for structural analysis, though challenges remain in handling highly irregular stroke orders or messy handwriting. Future work will focus on refining the attention mechanism to improve robustness against varying writing styles.
Summary updated