# VSR: Unifying Vision, Semantics, and Relations for Document Layout Analysis

> Research note on VSR, a multimodal framework combining two-stream visual/semantic feature extraction with GNN-based relation modeling for document layout analysis.

- Authors: Hunter Heidenreich
- Published: 2026-03-14
- Paper: Preprint (arXiv) <https://arxiv.org/abs/2105.06220>
- Paper: Published (ICDAR 2021) <https://doi.org/10.1007/978-3-030-86549-8_8>
- Code: DAVAR-Lab-OCR (VSR) <https://github.com/hikopensource/DAVAR-Lab-OCR>
- Source: Bevaya Labs, <https://labs.bevaya.ai/>

---


## TL;DR

VSR is a multimodal document layout analysis framework that fuses visual features from document images with character-level and sentence-level text embeddings via an adaptive two-stream network, then refines predictions using a GNN-based relation module. It supports both NLP-based (sequence labeling) and CV-based (object detection) paradigms, and achieved first place on the ICDAR 2021 PubLayNet leaderboard with 95.7% AP.

## What kind of paper is this?

**Dominant:** $\Psi\_{\text{Method}}$. The headline contribution is a new multimodal architecture: the two-stream network with adaptive aggregation and GNN-based relation module. The paper devotes most of its pages to describing the architecture, fusion mechanism, and ablation studies.

**Secondary:** None. The paper's thorough ablation studies and cross-paradigm evaluation (testing the same architecture in both detection and sequence labeling modes across three benchmarks) serve the method contribution rather than constituting an independent evaluation or measurement contribution.

## What is the motivation?

Prior document layout analysis methods fall into two camps, each with limitations:

1. **NLP-based (sequence labeling):** Methods like LayoutLM treat layout as token classification. They capture text semantics but have limited spatial modeling, especially for visually rich elements (figures, tables).
2. **CV-based (object detection):** Methods like Faster R-CNN treat the page as an image. They capture visual structure but ignore text semantics and lack explicit modeling of inter-component relationships (e.g., a figure caption should appear near its figure).

Existing multimodal approaches suffer from two additional weaknesses: (a) they use single-granularity text features (either character or sentence, not both), with shallow fusion strategies like concatenation; and (b) they lack explicit relation modeling between detected components.

## What is the novelty?

VSR introduces three architectural contributions:

### 1. Multi-Granularity Semantic Features

Text information is encoded as spatial maps at two granularities. Character-level embeddings are rendered onto the document canvas using character bounding boxes:

$$\text{CharGrid}\_{ij} = \begin{cases} E^c(c\_k) & \text{if } (i, j) \in b\_k^c \\\\ 0 & \text{otherwise} \end{cases}$$

Sentence-level embeddings use BERT to encode full sentences, then paint them onto the canvas at sentence bounding boxes:

$$\text{SentGrid}\_{ij} = \begin{cases} E^s(s\_k) & \text{if } (i, j) \in b\_k^s \\\\ 0 & \text{otherwise} \end{cases}$$

Both are combined via LayerNorm: $S\_0 = \text{LayerNorm}(\text{CharGrid} + \text{SentGrid})$.

### 2. Adaptive Multi-Scale Aggregation

Rather than concatenating visual and semantic features, VSR learns a per-pixel attention map at each FPN scale that adaptively weights the two modalities:

$$AM\_i = h(g([V\_i, S\_i]))$$
$$FM\_i = AM\_i \odot V\_i + (1 - AM\_i) \odot S\_i$$

where $g(\cdot)$ is a $1 \times 1$ convolution, $h(\cdot)$ is a non-linear activation function (likely sigmoid, given the $[0,1]$ weighting), and $\odot$ is element-wise multiplication. This lets the model learn that visual features matter more for figures while semantic features matter more for authors.

### 3. GNN-Based Relation Module

Detected component candidates form a fully-connected graph. Node features combine RoIAlign features with positional encodings:

$$z\_j = \text{LayerNorm}(f\_j + e\_j^{pos}(b\_j))$$

A multi-head self-attention mechanism (16 heads, 2 layers, 1024 dimensions) models pairwise relations:

$$\hat{O} = \text{Attention}(Q, K, V) = \text{softmax}\left(\frac{QK^T}{\sqrt{d\_k}}\right)V$$

The relation module refines both class predictions and bounding box coordinates. Crucially, the same relation module design works for both detection candidates and token-level sequence labeling.

### Combined Loss

For the detection variant:

$$\mathcal{L} = \mathcal{L}\_{\text{DET}} + \lambda \mathcal{L}\_{\text{RM}}$$

where $\lambda = 1$ and both terms include cross-entropy (classification) and smooth L1 (regression) losses.

## What experiments were performed?

VSR is evaluated on three benchmarks spanning both detection and sequence labeling formats:

### Article Regions (822 pages, 9 classes, mAP)

| Method | mAP |
| :--- | ---: |
| Faster RCNN (reimpl.) | 87.3 |
| Faster RCNN + context (reimpl.) | 87.8 |
| **VSR** | **94.5** |

VSR improves mAP by +7.2 points. The largest per-class gains are on Author (+42.9 pp over the Faster RCNN baseline) and Table Caption (+17.5 pp), both classes that benefit heavily from semantic and relational cues.

### PubLayNet (360K pages, 5 classes, AP@[0.50:0.95])

| Method | AP (val) | AP (test) |
| :--- | ---: | ---: |
| Mask R-CNN | 91.0 | 90.7 |
| SiliconMinds | -- | 95.03 |
| **VSR** | **95.7** | **95.69** |

VSR ranked first on the ICDAR 2021 PubLayNet leaderboard, outperforming the Mask R-CNN baseline by +5.0 AP on the test set.

### DocBank (500K pages, 12 classes)

**Sequence labeling (F1):**

| Method | Macro F1 |
| :--- | ---: |
| `LayoutLM_large` | 93.50 |
| `X101 + LayoutLM_large` | 94.88 |
| **VSR** | **95.59** |

VSR achieves the highest score on 10 of 12 classes.

**Object detection (mAP):**

| Method | mAP |
| :--- | ---: |
| Faster RCNN | 86.3 |
| **VSR** | **87.6** |

### Ablation Studies (Article Regions)

The ablation studies on Article Regions isolate each component's contribution:

| Configuration | mAP |
| :--- | ---: |
| Vision only (Faster RCNN) | 87.3 |
| + CharGrid | 90.7 (+3.4) |
| + SentGrid | 90.0 (+2.7) |
| + CharGrid + SentGrid | 92.3 (+5.0) |
| + Adaptive fusion + Relation Module (full VSR) | 94.5 (+7.2) |

The relation module alone adds +5.3 mAP to the Faster RCNN baseline, with the most dramatic improvement on Author (51.1 $\rightarrow$ 88.4, +37.3 pp). Character-level semantics help identify components requiring less context (Author), while sentence-level semantics better capture contextual components (Figure Caption).

## What are the outcomes/conclusions?

**Strengths:**

- The unified framework genuinely supports both NLP-based and CV-based paradigms with the same core modules, which is a practical design contribution.
- The ablation studies are thorough and clearly demonstrate that each module (multi-granularity semantics, adaptive aggregation, relation module) contributes meaningful gains.
- Strong results across three diverse benchmarks, including a first-place leaderboard result on PubLayNet at the time of publication.
- The relation module addresses a real structural gap: document components have strong spatial relationships (caption near figure, columns aligned) that detection-only models cannot exploit.

**Limitations:**

- VSR requires text positions and content in addition to document images, making it dependent on an upstream OCR or PDF parsing step. This limits applicability to scanned documents without reliable OCR.
- Code and trained model weights were released through the DAVAR-Lab-OCR repository (Apache-2.0). However, the implementation depends on older framework versions (mmdetection 2.11.0, mmcv 1.3.4), and trained weights are hosted on Hikvision's internal file sharing rather than a standard model hub, which may limit long-term accessibility.
- The DocBank detection results show only a modest +1.3 mAP improvement, and VSR slightly underperforms Faster RCNN on some individual classes (Equation, Footer, Title), suggesting the relation module can occasionally hurt when the graph structure does not match the document's actual layout.
- The paper uses ResNeXt-101 as the backbone, which is large. No efficiency analysis (inference speed, VRAM) is provided, making it hard to assess practical deployment cost.
- Results on only three datasets, two of which (PubLayNet, DocBank) are scientific documents. Generalization to diverse document types (forms, invoices, historical) is not evaluated.

## Reproducibility

### Models

- **Backbone:** ResNeXt-101, initialized from a Mask R-CNN model pretrained on COCO (backbone weights copied to both visual and semantic streams). No parameter count reported for the full model.
- **Semantic stream:** Character embedding layer (dimension $C\_S = 64$) + pretrained BERT-base-uncased for sentence embeddings (dimension reduced to 64).
- **Relation module:** 2 layers of multi-head self-attention, 16 heads, 1024 hidden dimensions.
- **Weights available.** Trained checkpoints for PubLayNet (AP 95.8) and DocBank (F1 95.25) are hosted on Hikvision's file sharing with access codes. Pretrained backbone (Mask R-CNN on COCO) and BERT-base-uncased are also linked.

### Algorithms

- **Optimizer:** SGD, momentum 0.9, weight decay $10^{-4}$
- **Learning rate:** $10^{-3}$, divided by 10 every 10 epochs (Article Regions) or every 3 epochs (PubLayNet, DocBank)
- **Batch size:** 2
- **Epochs:** 30 (Article Regions), 6 (PubLayNet, DocBank)
- **RPN anchor ratios:** 0.02, 0.05, 0.1, 0.2, 0.5, 1.0, 2.0
- **Loss trade-off:** $\lambda = 1$
- **Framework:** PyTorch (mmdetection 2.11.0, mmcv 1.3.4)
- **Test scale:** (1300, 800) for PubLayNet; (600, 800) for DocBank

### Data

- **Article Regions:** 822 documents, 9 classes. Detection format.
- **PubLayNet:** 360K documents, 5 classes. Detection format. COCO-style AP.
- **DocBank:** 500K documents, 12 classes. Token-level annotations (sequence labeling) and bounding-box annotations (detection).
- All three datasets are publicly available.
- VSR requires character-level bounding box annotations extracted from PDF parsing, which is a non-trivial preprocessing step. The DAVAR-Lab-OCR repo provides datalist format examples for PubLayNet and DocBank.

### Evaluation

- **Metrics:** mAP (Article Regions, DocBank detection), AP@[0.50:0.95] COCO format (PubLayNet), macro F1 (DocBank sequence labeling).
- **Baselines:** Faster RCNN, Mask RCNN, BERT/RoBERTa/LayoutLM variants, and ICDAR 2021 leaderboard entries.
- No error bars, significance tests, or multi-run analysis reported.
- The paper does not discuss inference speed or computational overhead from the relation module.

### Hardware

- **Training:** Tesla V100 GPUs (count not specified).
- No inference speed, VRAM, or cost figures reported.

## BibTeX

```
```bibtex
@inproceedings{zhang2021vsr,
  title={VSR: A Unified Framework for Document Layout Analysis Combining Vision, Semantics and Relations},
  author={Zhang, Peng and Li, Can and Qiao, Liang and Cheng, Zhanzhan and Pu, Shiliang and Niu, Yi and Wu, Fei},
  booktitle={Document Analysis and Recognition -- ICDAR 2021},
  pages={115--130},
  year={2021},
  publisher={Springer},
  doi={10.1007/978-3-030-86549-8_8}
}
```

```

