Show, Attend and Read: A Simple and Strong Baseline for Irregular Text Recognition
- Publication
- AAAI 2019Conference
- First submitted to arXiv
- arXiv:1811.00751
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{textrecognitionsar2018,
title = {{Show, Attend and Read: A Simple and Strong Baseline for Irregular Text Recognition}},
author = {Hui Li and Peng Wang and Chunhua Shen and Guyu Zhang},
year = {2018},
eprint = {1811.00751},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1811.00751}
}
Recognizing heavily distorted or curved text is a significant challenge for text recognition models. Although some previous approaches have tried to address this issue, such as using spatial transformation networks (STN) for geometric correction, these methods have had limited success.
Problem Definition
When tackling irregular text recognition, we can categorize previous approaches into three main directions:
-
Correction Algorithms: A representative method in this category is RARE, which uses STN to apply geometric corrections. However, severely distorted text remains difficult to handle.
-
Attention Mechanisms: These methods allow the model to focus on localized 2D features while decoding the text. The prior method cited here requires character-level supervision during training, making the training data more restrictive.
-
Multi-Directional Encoding: This approach encodes text from four different orientations to handle arbitrarily oriented text. However, it requires a more complex architecture.
The authors prefer a simpler method.
Returning to an attention-based encoder-decoder framework, they propose a model based on ResNet and LSTM, combined with a custom 2D attention module to tackle irregular text recognition.
The attention module is trained with word-level text labels alone; it needs no extra character boxes or pixel-level annotations.
Solution
Model Architecture
As shown in the architecture diagram, the authors use ResNet-31 as the feature extractor. The resulting 2D feature map is retained for the decoder's attention. One max-pooling layer uses a 1×2 window, preserving more information along the horizontal axis.
Encoder
Once the feature map is obtained, the model uses an LSTM to encode the image.
We know that LSTM is designed for processing one-dimensional sequential data, so here, the authors apply max pooling along the "height" of the feature map to compress it into a one-dimensional sequence, which is then fed into the LSTM.
The LSTM consists of two layers, each with 512 hidden units, and from the diagram, it appears to be a unidirectional LSTM.
Decoder
The decoder also uses an LSTM.
As shown in the diagram, the main contribution of the authors is this: if you remove the "2D convolution feature map V" part, it becomes a basic LSTM decoder.
The decoder first receives the encoder's final hidden state. At each decoding step, it uses its current hidden state to compute attention weights over the original 2D convolutional feature map and select the local features it needs.
The LSTM in the decoder also has two layers with 512 hidden units each. The parameters between the encoder and decoder are not shared. During training, teacher forcing is used, but during inference, the model relies on the predictions from the previous timestep.
2D Attention Mechanism
To compensate for the limitations of traditional 2D attention mechanisms, the authors propose a novel attention mechanism that takes into account the spatial relationships in 2D space:
For each position , the attention score incorporates information from neighboring positions. These neighboring positions are from the 8-connected neighborhood of .
The attention score is calculated using the following formula:
Where:
- is the local feature vector at position .
- represents the 8-connected neighborhood around position .
- is the hidden state of the decoder LSTM at time step , which serves as the attention guide.
- , and are learnable weight matrices.
The attention weights are computed using the softmax function:
The attention-weighted sum (glimpse) at time step is computed as:
Where and are the height and width of the feature map, respectively.
Compared to traditional attention mechanisms, this approach adds a weighted sum term for the 8-connected neighborhood, allowing the model to capture spatial relationships between local features.
Discussion
Comparison with Other Methods
Across the irregular-text datasets in the table (IC15, SVTP, CT80, and COCO-T), SAR has the highest accuracy in every listed setting. The following examples use the no-lexicon columns:
- On SVTP-None, SAR's 86.4% exceeds the 78.9% of Liu, Chen, and Wong (2018) by 7.5 percentage points; the asterisk on that comparator denotes extra character annotations.
- On CT80-None, SAR's 89.6% exceeds the 79.5% of Shi et al. (2018) by 10.1 percentage points.
SAR is also competitive on regular text datasets such as IIIT5K, SVT, and IC13: its no-lexicon IIIT5K score is 95.0%, while its 91.2% on SVT and 94.0% on IC13 are not the highest in the table.
Without a lexicon, SAR has the highest listed scores on IIIT5K and SVTP, at 95.0% and 86.4%. Methods marked with an asterisk also use character-level annotations, which matters when comparing their training data.
Visualization
The authors compare the SAR 2D attention model with a traditional 2D attention model.
The decoded characters appear to the left of their attention maps, with incorrect characters marked in red. In the two examples shown, SAR's attention locations and recognition results are more accurate than those of traditional 2D attention.
Conclusion
SAR shows strong performance on both regular and irregular text recognition tasks. It also leaves room for further work, especially on speeding up training and handling more complex text structures.
Several later studies use SAR as a baseline for comparison, which we'll explore in future discussions.