NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

SwinDocSegmenter: An End-to-End Unified Domain Adaptive Transformer for Document Instance Segmentation

Ayan Banerjee, Sanket Biswas, Josep Lladós, Umapada Pal

Introduction

Document Layout Analysis (DLA) is a critical component of document digitization, involving the identification and categorization of structural regions such as text blocks, tables, and figures. While traditional Convolutional Neural Networks (CNNs), such as Mask R-CNN, served as the industry standard for years, they often struggle with generalization across diverse document domains. Recent advancements in Transformer-based models have improved performance, yet two primary challenges remain: the lack of unification between detection and segmentation tasks, and significant domain bias when transitioning from scientific papers to more complex layouts like magazines or historical archives.

To address these limitations, we present SwinDocSegmenter, an end-to-end unified Transformer architecture designed for robust document instance segmentation. By leveraging a Swin Transformer backbone and novel training strategies, SwinDocSegmenter achieves state-of-the-art results across multiple benchmarks without requiring optical character recognition (OCR) input.

Methodology

Unified Encoder-Decoder Framework

Unlike traditional models that treat detection and segmentation as decoupled steps, SwinDocSegmenter utilizes a unified framework. The architecture is built upon a Swin Transformer (Swin-L) backbone, which provides hierarchical feature representations. A key innovation is the generation of a Pixel Embedding Map (PEM), created by fusing high-resolution features from the backbone with enhanced features from the encoder. This shared representation allows the model to perform both tasks simultaneously, enabling detection and segmentation to mutually inform one another.

Mixed Query Selection and Denoising

To improve the initialization of the decoder, the model employs Mixed Query Selection. This process uses the encoder's output to intelligently initialize positional queries (anchors), providing the decoder with a more accurate starting point for object localization.

Furthermore, the authors implement Contrastive Denoising Training (CDN), inspired by the DINO detection model. By adding controlled noise to ground-truth boxes during training, the model learns to "denoise" these inputs into accurate masks. This technique significantly accelerates convergence and enhances the model's ability to identify smaller, low-level document elements that are often overlooked by standard Transformers.

Domain Adaptation

To mitigate domain shift—the performance drop observed when a model trained on one dataset (e.g., scientific papers) is applied to another (e.g., historical documents)—SwinDocSegmenter uses Hybrid Bipartite Matching. This strategy allows the model to leverage pre-trained weights from general object detection datasets (like MS-COCO) and effectively adapt them to the specific structural nuances of document layouts.

Experimental Evaluation

Datasets

The model was rigorously evaluated on five major benchmarks representing a wide spectrum of document types:

  • PubLayNet: Large-scale scientific articles.
  • PRIMA: Complex magazine layouts.
  • Historical Japanese (HJ): Vertical text and unique historical formatting.
  • TableBank: Specialized table detection.
  • DocLayNet: Diverse industrial documents including reports and manuals.

Key Results

SwinDocSegmenter achieved impressive Mean Average Precision (mAP) scores, setting new benchmarks in several categories:

  • PubLayNet: 93.72 AP (outperforming the visual-only performance of LayoutLMv3).
  • PRIMA: 54.39 AP (a significant improvement over previous baselines).
  • TableBank: 98.04 AP.
  • Historical Japanese: 84.55 AP.

Discussion and Insights

Mutual Task Cooperation

A core finding of this research is that predicting masks early in the pipeline actually assists the model in refining bounding boxes. In the context of document analysis, the precise shape of a region (segmentation) provides vital geometric clues that improve the accuracy of boundary detection.

Visual-Only Performance

Notably, SwinDocSegmenter achieves competitive results using only visual information. While many state-of-the-art models, such as LayoutLMv3, rely heavily on OCR-extracted text, this model demonstrates that a sufficiently powerful visual transformer can interpret complex layouts without the computational overhead or error propagation associated with OCR.

Limitations

Despite its performance, the model faces challenges with the "Others" category in datasets like PRIMA, which lacks a consistent visual structure. Additionally, the Swin-L backbone's 223 million parameters present a high computational cost, suggesting that further optimization or model distillation may be required for real-time or mobile applications.

Conclusion

SwinDocSegmenter represents a significant step forward in document instance segmentation. By unifying detection and segmentation within a domain-adaptive Transformer framework, it provides a robust solution for processing diverse document types. Its ability to achieve state-of-the-art results using purely visual features makes it a versatile tool for large-scale document analysis tasks where OCR may be unavailable or unreliable.

Summary updated

BibTeX
@inproceedings{banerjee2023swindocsegmenter,
  author = {Ayan Banerjee and Sanket Biswas and Josep Lladós and Umapada Pal},
  title = {{SwinDocSegmenter: An End-to-End Unified Domain Adaptive Transformer for Document Instance Segmentation}},
  booktitle = {ICDAR},
  year = {2023},
  doi = {10.1007/978-3-031-41676-7\_18},
}
Figure