DocSegTr: An Instance-Level End-to-End Document Image Segmentation Transformer

Sanket Biswas, Ayan Banerjee, Josep Lladós, Umapada PalarXiv 2022

Abstract

DocSegTr introduces a novel transformer-based framework for instance-level document image segmentation. By integrating CNN-based local feature extraction with a computationally efficient "twin attention" transformer for global reasoning, the model achieves state-of-the-art performance on complex document layouts. Unlike traditional top-down approaches, DocSegTr operates in a bottom-up, box-free manner, effectively handling multi-column text, overlapping figures, and nested tables across diverse benchmarks including PubLayNet, PRIMA, and TableBank.

Introduction

Automated information extraction from documents with rich layouts—such as scientific papers, magazines, and historical archives—remains a significant challenge. Traditional Document Layout Analysis (DLA) typically follows a two-stage "top-down" approach: first detecting bounding boxes for layout elements and then performing segmentation. This methodology often suffers from high computational costs and "context blindness," where standard Convolutional Neural Networks (CNNs) fail to capture the global semantic relationships necessary for understanding complex page structures.

Methodology

DocSegTr addresses these limitations through a hybrid "bottom-up" architecture that eliminates the need for bounding box detection. The framework consists of four primary components:

  1. Backbone and FPN: A ResNeXt-101 backbone coupled with a Feature Pyramid Network (FPN) extracts multi-scale local features.
  2. Twin Attention Transformer: To capture long-range dependencies without the $O(N^2)$ memory cost of standard self-attention, the authors implement a "Twin Attention" module. This module computes attention for rows and columns independently, significantly reducing complexity while maintaining global context.
  3. Layerwise Feature Aggregation Module (LFAM): This module fuses high-level global context from the Transformer with fine-grained local details from the CNN, ensuring that the generated masks are both contextually grounded and pixel-precise.
  4. Dynamic Mask Generation: Inspired by SOLOv2, the model predicts category-specific kernels that are applied to the aggregated features to produce final segmentation masks directly.
The DocSegTr architecture featuring the CNN backbone, Twin Attention Transformer, and Layerwise Feature Aggregation Module.

Datasets and Experimental Results

The model was rigorously evaluated on four major benchmarks representing distinct document challenges:

  • PubLayNet: Modern scientific medical articles.
  • PRIMA: Diverse and complex magazine and technical layouts.
  • Historical Japanese (HJ): Challenging multi-column layouts with dense objects.
  • TableBank: Large-scale dataset focused on table detection.

DocSegTr achieved competitive or superior results compared to state-of-the-art (SOTA) models, reaching 89.4 mAP on PubLayNet and 93.3 mAP on TableBank. Qualitative analysis demonstrates the model's ability to produce sharp, precise masks for large and complex objects, as the Transformer successfully identifies entire objects as single semantic entities.

Qualitative segmentation results of DocSegTr across PubLayNet, PRIMA, Historical Japanese, and TableBank datasets.

Discussion and Key Insights

Ablation studies highlight the critical role of the Transformer component. On the PRIMA dataset, removing the transformer layers caused the Average Precision (AP) to drop from 40.31 to 5.21, underscoring that global context is essential for complex layout analysis. Furthermore, the box-free nature of DocSegTr provides inherent flexibility in handling overlapping layout elements, a common failure point for traditional object detectors. By utilizing Twin Attention, the architecture remains computationally efficient enough for large-scale industrial applications.

Conclusion

DocSegTr represents a significant step forward in document layout analysis by successfully adapting Transformers for high-resolution image segmentation. While the model excels at large-scale semantic reasoning, the authors noted it currently performs slightly worse on very small objects compared to some CNN-only baselines. Future work will focus on refining the architecture for these smaller regions and exploring its utility in extremely crowded or ambiguous document environments.

Summary updated

BibTeX
@misc{biswas2022docsegtr,
  author = {Sanket Biswas and Ayan Banerjee and Josep Lladós and Umapada Pal},
  title = {{DocSegTr: An Instance-Level End-to-End Document Image Segmentation Transformer}},
  year = {2022},
  eprint = {2201.11438},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2201.11438},
}
Figure