Aggregation Cross-Entropy for Sequence Recognition

Zecheng Xie, Yaoxiong Huang, Yuanzhi Zhu, Lianwen Jin, Yuliang Liu, Lele Xie · DOI

Sequence recognition—the task of converting images of text or audio snippets into character strings—has traditionally relied on complex alignment-based loss functions. This paper, published in 2019 by researchers at the South China University of Technology, introduces Aggregation Cross-Entropy (ACE), a streamlined alternative that treats sequence recognition as a distribution matching problem rather than a complex alignment task.

The Alignment Problem

Traditional methods like Connectionist Temporal Classification (CTC) and Attention Mechanisms dominate the field but come with significant overhead. CTC uses a complex "forward-backward" dynamic programming algorithm to calculate all possible alignments, making it mathematically sophisticated but computationally expensive. Attention mechanisms, while powerful, are memory-intensive and prone to misalignment on long sequences. ACE was designed to be easier to implement, faster to compute, and flexible enough to handle 2D structures like curved text.

The ACE Framework

The core innovation of ACE is the shift from explicit alignment to character accumulation. Instead of trying to find the exact position of every character during training, ACE simply asks: "Does the total count of each character predicted by the model match the ground truth?"

The ACE framework: Features are extracted via CNN/FCN, aggregated into a distribution, and compared against a normalized ground truth count using cross-entropy.

The process involves four simple steps:

  1. Aggregation: Sum the softmax probabilities for every character class across the entire time (or spatial) dimension.
  2. Normalization: Divide these sums by the total number of time steps ($T$) to create a predicted probability distribution.
  3. Ground Truth Construction: Take the label (e.g., "apple") and count the occurrences of each character (a:1, p:2, l:1, e:1). Normalize these counts by $T$ to create a target distribution.
  4. Cross-Entropy: Calculate the cross-entropy loss between the predicted distribution and the target distribution.

By supervising the accumulation of characters rather than their order, the loss function becomes $O(1)$ parallelizable. The model still learns the correct order because the underlying architecture (like a CNN or LSTM) is naturally biased toward sequential processing.

Versatility and Performance

ACE is not limited to standard 1D text; its design allows it to be a "drop-in" solution for various recognition tasks by simply flattening feature maps.

ACE demonstrates state-of-the-art performance across diverse tasks including regular/irregular scene text, handwriting, and object counting.

The authors evaluated ACE across three distinct domains:

  • Scene Text Recognition: Achieving significant jumps in accuracy for curved text (82.6% on CUTE80).
  • Handwritten Chinese Text (HCTR): Outperforming previous methods on the massive 7,357-character CASIA-HWDB dataset with a 91.68% correct rate.
  • Object Counting: Setting a new state-of-the-art on PASCAL VOC 2007 (m-RMSE of 0.381), proving its utility for general instance counting.

Key Insights

  • Order-Free Supervision: The most counter-intuitive finding is that explicit order supervision is unnecessary if the model architecture is inherently sequential.
  • Speed: ACE is roughly 30 times faster than CTC and Attention during the loss calculation phase, requiring zero additional parameters.
  • 2D Flexibility: Because it doesn't rely on a 1D "forward-backward" pass, it handles irregular or curved text natively by aggregating 2D feature maps.

Conclusion

Aggregation Cross-Entropy proves that "less is more." By discarding the complexity of explicit alignment, the authors created a loss function that is faster, lighter, and more flexible than industry standards. While it still requires a decoding method at inference time to reconstruct the final string, its training efficiency and state-of-the-art performance make it a powerful tool for modern sequence recognition pipelines.

Summary updated

BibTeX
@inproceedings{xie2019aggregation,
  author = {Zecheng Xie and Yaoxiong Huang and Yuanzhi Zhu and Lianwen Jin and Yuliang Liu and Lele Xie},
  title = {{Aggregation Cross-Entropy for Sequence Recognition}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2019},
  doi = {10.1109/cvpr.2019.00670},
}
Figure