Paper commentary
An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition
CRNN reads scene text end to end from word labels alone
- Problem Earlier scene text readers either crop each character or classify whole words from a fixed list, so they cannot be trained end to end.
- Method CRNN stacks convolutional layers, a deep bidirectional LSTM and a transcription layer, then trains all three parts jointly from word labels, with no character boxes.
- Results CRNN scores 97.6 on IIIT5k with a 50-word lexicon, against 97.1 for the prior reader of Jaderberg et al., and it is trained only on synthetic word images.
Why variable-length labels are hard
Text in photographs, handwriting and score notation all appear as sequences, and the number of symbols changes from one image to the next. A standard DCNN classifier produces an output of fixed size, so it cannot emit a label string whose length is decided by the image. Earlier scene text systems either detect and crop each character, which requires a strong character detector, or assign one class to each word, which yields a model with a very large number of classes.
The class-per-word approach uses a list of 90K words and does not carry over to Chinese text or musical scores, because the number of possible combinations grows past one million. Recurrent networks handle sequences of any length, but they usually rely on a separate feature extraction step, so the whole pipeline cannot be optimized as one system.
The question this paper asks is whether a single network can read a word image using only word-level labels, with no character boxes, no hand-made features and no fixed input width.
Three stages in one network
CRNN has three parts stacked from bottom to top: convolutional layers that turn an image into a feature sequence, recurrent layers that predict a label distribution for each frame, and a transcription layer that converts those distributions into a label sequence. Because the three parts share one loss, they are trained together, and the design avoids the separately trained components common in earlier systems.
Before entering the network, each image is scaled to a common height. Testing uses height 32 with widths scaled proportionally and at least 100 pixels, while training images are scaled to 100 by 32. The convolutional part is taken from the VGG-VeryDeep architectures with the fully connected layers removed, and two of its pooling layers use 1 by 2 windows instead of square ones.
Feature vectors are read from the feature maps column by column, so each vector is the concatenation of one column across all maps. Because the column width is one pixel, the number of frames follows the image width, and each frame corresponds to a rectangular receptive field of the input image. Since the convolution, pooling and activation operations act on local regions, these receptive fields keep their left-to-right order, which lets the recurrent layers read the frames as a sequence.
Error differentials leave the transcription layer, pass through the recurrent layers by back-propagation through time, and then reach the convolutional layers through the Map-to-Sequence bridge, so all three parts receive gradients from one objective.
Why a bidirectional LSTM stack sits on the features
The recurrent layers predict a label distribution for every frame, and each prediction can draw on the frames around it. Context helps when a character spans several frames, and it helps to tell apart shapes such as 'il' that look alike when each character is judged on its own.
A plain recurrent unit struggles to keep information over long spans because of the vanishing gradient problem. An LSTM unit addresses this with a memory cell and three gates, the input, output and forget gates, which decide what the cell stores, releases and clears.
A one-directional LSTM only sees past frames, while image-based sequences give useful context from both sides, so a forward and a backward LSTM are paired into a bidirectional LSTM. Several bidirectional layers are then stacked into a deep bidirectional LSTM, which the authors argue gives higher-level abstractions than a shallow stack.
From frame predictions to a label string
Transcription looks for the label sequence with the highest probability given the per-frame predictions, and it runs in one of two modes, lexicon-free or lexicon-based. A lexicon is a set of permitted label sequences, such as a spell checker's word list.
The conditional probability of a label sequence l, given the frame distributions y of length T, sums the probabilities of every frame-level path that the mapping B turns into l. \[ p(l \mid y) = \sum_{\pi : \mathcal{B}(\pi) = l} p(\pi \mid y) \] Each path has probability equal to the product, over the T frames, of the probability of the label that path takes at that frame, and paths are drawn from the labels plus a blank symbol.
B first merges repeated labels and then removes blanks, so a path that repeats a letter over several frames collapses to a single letter, and a blank between two equal letters keeps them apart.
Summing over all paths is exponentially large, so the sum is computed with the forward-backward algorithm. Lexicon-free decoding takes the most probable label at each frame and applies B to the resulting sequence, which is an approximation to the most probable label sequence.
For a lexicon, choosing the entry with the highest conditional probability requires scoring every entry, which is slow for large lexicons such as the 50k-word Hunspell list. The method instead restricts the search to candidates within edit distance δ of the lexicon-free output l′, and then picks the best of those. \[ l^* = \arg\max_{l \in N_\delta(l')} p(l \mid y) \]
The candidate set is retrieved with a BK-tree built offline for each lexicon, and a query returns all sequences at distance at most δ from the query sequence. The authors state the search complexity of a BK-tree as O(log|D|), where |D| is the lexicon size, which they take as the basis for scaling to very large lexicons.
Training from word labels only
Training minimizes the negative log-likelihood of the ground-truth label sequence over all training images, so each sample needs only an image and its word. \[ O = -\sum_{I_i, l_i \in X} \log p(l_i \mid y_i) \] Because the cost is computed directly from the image and its label string, character positions never need to be labelled.
Stochastic gradient descent is used, and the gradients are computed by back-propagation, with the transcription layer using the forward-backward algorithm and the recurrent layers using back-propagation through time. The optimizer is ADADELTA, which sets a learning rate per dimension automatically, so no learning rate needs to be set by hand.
The authors report that ADADELTA converged faster than momentum in their experiments.
Batch normalization layers after the 5th and 6th convolutional layers are reported to greatly accelerate the training of such a deep network. Training on the scene text data took about 50 hours to converge, with ρ set to 0.9 for ADADELTA.
Data and test protocol for scene text
The model is trained once on the Synth dataset of 8 millions synthetic word images and then tested on real benchmarks without fine-tuning on their training data. Four benchmarks are used: IC03, IC13, IIIT5k and SVT.
IC13 contains 1,015 cropped word images, IIIT5k has 3,000 cropped word test images, and SVT has 249 street view images from which 647 word images are cropped.
Each benchmark is evaluated with lexicons of different sizes, labelled 50, 1k, 50k and Full, or with no lexicon at all, labelled None. The 50k lexicon is the Hunspell spell-checking list, and the Full lexicon combines the per-image 50-word lexicons of IC03.
Scene text accuracy against prior readers
With a lexicon, CRNN outperforms most of the compared approaches and, on average, beats the reader of Jaderberg et al. [22]. It is superior to [22] on IIIT5k and SVT, and it is lower than [22] only on IC03 with the Full lexicon.
On IIIT5k, CRNN scores 97.6 with the 50-word lexicon and 94.4 with the 1k lexicon, against 97.1 and 92.7 for [22]. On SVT with the 50-word lexicon, CRNN scores 96.4, against 95.4 for [22].
Without a lexicon, CRNN scores 80.8 on SVT, marginally above the 80.7 reported for [22], and this is the one unconstrained setting where it leads. On IC03 and IC13 without a lexicon, CRNN scores 89.4 and 86.7, while [22] scores 93.1 and 90.8, and both of those [22] entries carry an asterisk because its outputs are limited to a 90k dictionary.
The authors contrast this with PhotoOCR, which was trained on 7.9 millions of real word images with character-level annotations, whereas CRNN uses only synthetic word-labelled data. The authors also argue that CRNN can read strings such as telephone numbers, sentences and other scripts, which the class-based reader of [22] cannot do.
Parameter count and storage
The comparison table lists CRNN at 8.3M parameters, against 490M for Jaderberg et al. [22] and 304M for Jaderberg et al. [21]. The authors attribute the difference to CRNN having no fully connected layers and to its weight-sharing connections.
The authors convert the 8.3 million parameters into about 33MB of RAM, assuming 4-byte single-precision floats for each parameter. From this they suggest the model could be ported to mobile devices, although no mobile measurement is reported.
Edit distance bound and lexicon search cost
A larger δ admits more candidates, which can make lexicon-based transcription more accurate, but it also lengthens the BK-tree search and enlarges the candidate set to test. The authors choose δ = 3 as the compromise between accuracy and speed.
Figure 4 plots IC03 accuracy with the 50k lexicon over δ from 0 to 5, together with the lexicon search time per sample, which rises from under 1 ms to 2420 ms across that range. The accuracy values in that sweep are plotted with the bars and are not assigned to individual δ values in the text.
With δ set to 3, a test sample takes 0.16 s on IC03 without a lexicon and 0.53 s on average with the 50k lexicon.
Music score data and augmentation
The training data comes from 2650 score images collected from one source, each showing a fragment of 3 to 20 notes, and these were labelled with pitch sequences by hand. Augmentation by rotation, scaling, noise and background replacement expands them to 265k training samples.
Three test sets are used: Clean with 260 images from the same source, Synthesized with 200 samples built from Clean with the same augmentation, and Real-World with 200 score fragments photographed with a phone camera. The task is limited to pitches, chords are ignored and all scores are assumed to be in C major.
Because the training data is small, the network is reduced by removing the 4th and 6th convolution layers and by replacing the two-layer bidirectional LSTM with a two-layer single-directional LSTM. Results are measured by fragment accuracy and average edit distance, and the same three sets are run through Capella Scan and PhotoScore.
Pitch recognition against commercial engines
On the Clean set, CRNN reaches 74.6% fragment accuracy with an average edit distance of 0.37, against 51.9% with 1.75 for Capella Scan and 55.0% with 2.34 for PhotoScore.
On Synthesized, CRNN reaches 81.5% with an average edit distance of 0.30, while Capella Scan reaches 20.0% with 2.31 and PhotoScore reaches 28.0% with 1.85. On Real-World, CRNN reaches 84.0% with an average edit distance of 0.30, while Capella Scan reaches 43.5% with 3.05 and PhotoScore reaches 20.4% with 3.00.
The authors attribute the commercial engines' drop to their reliance on robust binarization, which fails under poor lighting, noise and cluttered backgrounds. They argue that the convolutional features tolerate such noise and that the recurrent layers use neighbouring notes as context, so a note can be judged against its neighbours.
Limits of the evidence
On the Full IC03 lexicon CRNN is lower than [22], and in the unconstrained settings it is behind [22] on IC03 and IC13.
The music experiments cover pitch only, assume C major and ignore chords, and use three sets of 260, 200 and 200 test images. The authors describe their CRNN-based music system as still preliminary and missing many functions.
The 0.53 s per-sample figure applies to IC03 with the 50k lexicon and δ set to 3, and no other dataset or lexicon size is timed in the text. Chinese character recognition is named as a possible application, but no experiment in the paper tests it.
Paper info
- Authors
- Baoguang Shi, Xiang Bai, Cong Yao
- Venue
- arXiv · Preprint
- First published
- 2015-7-21
- Added
- 2026-11-12
- Updated
- 2015-7-21
- Version
- v1
- arXiv
- 1507.05717
- Category
- cs.CV
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Baoguang Shi, Xiang Bai, Cong Yao (2015). An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition. arXiv:1507.05717v1. https://arxiv.org/abs/1507.05717v1
BibTeX
@misc{shi2015trainable,
title = {{An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition}},
author = {Baoguang Shi and Xiang Bai and Cong Yao},
year = {2015},
eprint = {1507.05717},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1507.05717v1}
}