# SEMv2: Table Separation Line Detection Based on Instance Segmentation

> An instance segmentation approach to table separation line detection with a conditional convolution splitter, parallel merger, and the iFLYTAB dataset for diverse table structure recognition

- Authors: Hunter Heidenreich
- Published: 2023-03-08
- Updated: 2026-03-16
- Paper: Preprint (arXiv) <https://arxiv.org/abs/2303.04384>
- Paper: Published (Pattern Recognition 2024) <https://doi.org/10.1016/j.patcog.2024.110490>
- Code: SEMv2 <https://github.com/ZZR8066/SEMv2>
- Dataset: iFLYTAB <https://github.com/ZZR8066/SEMv2>
- Source: Bevaya Labs, <https://labs.bevaya.ai/>

---


## TL;DR

SEMv2 reformulates the "split" stage of split-and-merge table structure recognition as an instance segmentation task, using conditional convolution to predict individual masks for each table separation line. The paper also introduces the iFLYTAB dataset, which covers wired and wireless tables across digital and camera-captured scenarios. SEMv2 achieves competitive results on SciTSR and PubTabNet, and substantially outperforms its predecessor SEM on the more challenging iFLYTAB benchmark.

## What kind of paper is this?

**Dominant:** $\Psi\_{\text{Method}}$. The central contribution is a new approach to table separation line detection: replacing semantic segmentation with instance segmentation via conditional convolution. The paper devotes the majority of its technical content to the splitter architecture (Gather modules, kernel/feature branch decoupling, mask-to-line post-processing) and the parallel merger design.

**Secondary:** $\Psi\_{\text{Resource}}$. The authors release iFLYTAB, a 17,291-image dataset spanning wired/wireless tables in both digital and camera-captured settings. This fills a gap left by prior datasets that focus exclusively on digital documents or only wired tables.

## What is the motivation?

Split-and-merge methods for table structure recognition first divide a table into a basic grid of rows and columns, then merge grid cells that span multiple rows or columns. Prior approaches (SEM, SPLERGE, RobusTabNet) handle the "split" stage using semantic segmentation: they predict a single binary mask for all row separation lines and another for all column separation lines. This creates two problems:

1. **Limited receptive field.** Pixel-wise semantic segmentation struggles to capture long-range dependencies across an entire table image, producing noisy or incomplete masks, especially for camera-captured images with distortion or complex backgrounds.
2. **Complex post-processing.** Extracting individual separation lines from a single semantic mask requires heuristic mask-to-line algorithms that make strong assumptions (e.g., straight, axis-aligned lines) and fail on distorted or curved tables.

In addition, existing TSR datasets are concentrated on clean, axis-aligned tables from digital PDF documents. The WTW dataset introduced camera-captured tables but only covers wired tables. There was no public benchmark covering both wired and wireless tables across digital and photographic scenarios.

## What is the novelty?

### Instance segmentation for table separation line detection

SEMv2 treats each row or column separation line as a distinct instance. The architecture decouples mask generation into two branches:

- **Kernel branch:** Produces per-instance convolution kernels $\theta^{\text{col}} \in \mathbb{R}^{1 \times \frac{W}{4} \times C}$ (or $\theta^{\text{row}}$ for rows). Each kernel corresponds to one separation line instance.
- **Feature branch:** Generates feature maps $\mathbf{F}^{\text{col}} \in \mathbb{R}^{\frac{H}{4} \times \frac{W}{4} \times C}$ (or $\mathbf{F}^{\text{row}}$) to be convolved with the instance kernels.

Dynamic 1$\times$1 convolution between a selected kernel and the feature map produces a per-instance separation line mask. The final line shape is extracted by finding the maximum-scoring position in each row (for column lines) or each column (for row lines), yielding a simple and robust mask-to-line conversion.

### Gather module

To give the kernel branch a receptive field spanning the full table image, the authors introduce the Gather module. It uses repeated downsampling followed by two spatial CNN modules that propagate information top-to-bottom and bottom-to-top (for columns) or left-to-right and right-to-left (for rows). The output is reduced to a 1D representation $G^{\text{col}} \in \mathbb{R}^{1 \times \frac{W}{4} \times C}$ via row-mean pooling, capturing global structural context along the relevant axis.

### Parallel merger

The merger in the original SEM used a sequential decoder, whose inference time grew with the number of cells. SEMv2 replaces this with a parallel decoder based on conditional convolution. For each grid cell $(i, j)$, a kernel $e^{k}\_{i,j}$ is convolved with the shared feature map $E^{f}$ to predict which other grid cells belong to the same table cell. This runs in parallel across all grid positions, increasing throughput from roughly 3 FPS to over 7 FPS on SciTSR.

### Overall loss

The training objective combines five terms:

$$
O = \mathcal{L}\_{s}^{\text{row}} + \mathcal{L}\_{s}^{\text{col}} + \mathcal{L}\_{\text{inst}}^{\text{row}} + \mathcal{L}\_{\text{inst}}^{\text{col}} + \mathcal{L}\_{m}
$$

where $\mathcal{L}\_{s}$ terms are sigmoid focal losses on the separation line masks, $\mathcal{L}\_{\text{inst}}$ terms are binary cross-entropy losses on the instance detection heads, and $\mathcal{L}\_{m}$ is the focal loss on the merge maps.

### iFLYTAB dataset

The iFLYTAB dataset contains 17,291 table images (12,104 train, 5,187 test) collected from four categories: digital wired (3,664), digital wireless (4,125), camera-captured wired (4,155), and camera-captured wireless (5,347). Annotations include cell polygons (735,781), text line polygons (1,207,709), row information polygons (207,972), and column information polygons (112,820). Each polygon is labeled with four-vertex coordinates.

## What experiments were performed?

### Datasets

Experiments cover five benchmarks:

- **SciTSR:** 15,000 tables from scientific literature (12,000 train / 3,000 test), with a hard subset SciTSR-COMP (716 complex tables). The authors note annotation errors in the test set, which they manually corrected following RobusTabNet.
- **PubTabNet:** 500,777 training and 9,115 validation tables from scientific articles.
- **cTDaR TrackB1-Historical:** 600 training and 150 testing samples of historical handwritten documents.
- **WTW:** 10,970 training and 3,611 testing images of wired tables from wild scenes.
- **iFLYTAB:** The proposed dataset (12,104 train / 5,187 test).

### Metrics

- **F1-Measure:** Percentage of correctly detected adjacent cell pairs.
- **TEDS / TEDS-Struct:** Tree-edit-distance-based similarity (structure-only variant ignores OCR content).
- **WAvg.F1:** Weighted average F1 across IoU thresholds [0.6, 0.7, 0.8, 0.9].
- **GriTS:** Grid table similarity metric comparing predicted and ground truth tables in matrix form.

### Ablation studies

Six system variants (T1 through T6) isolate the contributions of three components:

| Comparison | Finding |
|---|---|
| Instance segmentation splitter (T1) vs. semantic segmentation splitter (T2) | Marginal difference on clean digital tables (SciTSR: 99.3 vs. 98.8 F1), large gap on camera-captured tables (iFLYTAB: 93.5 vs. 77.0 F1) |
| With Gather (T1) vs. without Gather (T3) | F1 improves from 90.4 to 93.5 on iFLYTAB; 98.4 to 99.3 on SciTSR |
| Parallel merger (T1) vs. sequential merger (T5) | Similar accuracy (99.3 vs. 99.2 F1 on SciTSR), but 7.3 FPS vs. 2.9 FPS |
| No merger (T4) | Accuracy drops sharply (98.2 F1 on SciTSR) since spanning cells are ignored |

### Comparison with prior methods

- **SciTSR:** 99.3 F1, matching or close to TSRFormer (99.4) and RobusTabNet (99.3).
- **SciTSR-COMP:** 98.7 F1, comparable to TSRFormer (98.9).
- **PubTabNet:** 97.5 TEDS-Struct, tied with TSRFormer for the top reported result.
- **cTDaR TrackB1-Historical:** 67.5 WAvg.F1, outperforming prior competition participants by a large margin.
- **WTW:** 93.6 F1, slightly ahead of TSRFormer (93.4).
- **iFLYTAB:** 93.5 F1 and 92.0 TEDS-Struct, compared to SEM's 78.0 F1 and 75.9 TEDS-Struct.

## What are the outcomes/conclusions?

The results suggest that instance segmentation provides a more robust approach to table separation line detection than semantic segmentation, particularly for tables with non-rigid deformation and complex backgrounds. The instance-level formulation simplifies post-processing: instead of applying heuristic mask-to-line algorithms to a global mask, the method extracts each line directly from its own mask via a row-wise or column-wise argmax.

The Gather module contributes meaningfully by propagating structural context across the full image, which is important for long separation lines that span the entire table. The parallel merger achieves roughly 2.5$\times$ the throughput of the sequential decoder with no meaningful loss in accuracy.

### Limitations

The authors identify several failure modes:

- **Rotated tables.** SEMv2 performs poorly when tables exhibit significant angular rotation. On the "overlaid" subset of WTW (which includes many rotated tables), it falls well behind polygon detection methods (75.1 vs. 84.1 F1).
- **Multi-line cell content.** Without a textual branch (removed from the SEM baseline for efficiency), SEMv2 sometimes mis-splits cells containing multiple text lines.
- **Moire patterns.** Screen-captured images with pronounced moire artifacts degrade recognition quality.
- **No text content annotations.** iFLYTAB does not include OCR-level text annotations, which limits its use for end-to-end table recognition evaluation.

## Reproducibility

### Models

- **Backbone:** ResNet-34 pretrained on ImageNet, with FPN producing four feature levels ($P\_2$ through $P\_5$ at scales 1/4 to 1/32).
- **Feature channels:** $C = 256$ (FPN/splitter), $D = 512$ (embedder/merger).
- **RoIAlign pool size:** $3 \times 3$.
- **Embedder transformer:** Used to capture long-range dependencies among grid-level features. The paper does not specify the number of layers or heads.
- **Weights:** The GitHub repository provides pretrained models, though the specific format and completeness are not documented in the paper.

### Algorithms

- **Optimizer:** ADADELTA with $\beta\_1 = 0.9$, $\beta\_2 = 0.999$, $\varepsilon = 10^{-9}$.
- **Learning rate schedule:** Cosine annealing, $\eta\_{\text{max}} = 10^{-4}$, $\eta\_{\text{min}} = 10^{-6}$.
- **Loss functions:** Sigmoid focal loss ($\alpha = 0.25$, $\gamma = 2$) for separation line masks and merge maps; binary cross-entropy for instance detection.
- **Binarization threshold:** 0.5 for all binary decisions (instance detection, merge maps).
- **Training strategy:** End-to-end (not multi-stage). Each dataset is trained independently. For cTDaR, the model is initialized with iFLYTAB-trained weights, then fine-tuned.
- **Data augmentation:** On iFLYTAB, images are resized with a random ratio in $[0.8, 1.2]$. On SciTSR and PubTabNet, original image sizes are used.

### Data

- **SciTSR:** 15,000 tables from scientific literature. Publicly available. The authors corrected annotation errors in the test set following RobusTabNet.
- **PubTabNet:** ~568K tables from PubMed Central. Publicly available under CDLA-Permissive.
- **cTDaR TrackB1-Historical:** 750 historical handwritten document tables. Available through ICDAR 2019 competition.
- **WTW:** ~14.5K wild table images. Publicly available.
- **iFLYTAB:** 17,291 images (70/30 train/test split). Available through the SEMv2 GitHub repository. License is not specified. No text content annotations are provided; evaluation uses unique markers per text line as proxies.

### Evaluation

- **Metrics:** F1-Measure, TEDS, TEDS-Struct, WAvg.F1, GriTS. Evaluation code is released publicly.
- **Baselines:** SEM (reimplemented without textual branch for fair comparison on iFLYTAB), TSRFormer, RobusTabNet, LGPMA, and others. On SciTSR, the corrected test annotations may make comparison with older methods slightly unfair (the authors acknowledge this).
- **Limitations of evaluation:** iFLYTAB lacks text content, so TEDS (which accounts for text) cannot be used in its standard form; TEDS-Struct is used instead.
- **Statistical rigor:** No error bars, significance tests, or multi-run results are reported.

### Hardware

- **SciTSR / PubTabNet / cTDaR:** Single NVIDIA Tesla V100 (32 GB), batch size 8.
- **iFLYTAB / WTW:** 8$\times$ NVIDIA Tesla V100 (32 GB each), batch size 48.
- **Inference speed:** 7.3 FPS on SciTSR with the full model (single GPU). No total training time or GPU-hour estimates are reported.
- **Framework:** PyTorch.

## BibTeX

```bibtex
@article{zhang2024semv2,
  title={SEMv2: Table Separation Line Detection Based on Instance Segmentation},
  author={Zhang, Zhenrong and Hu, Pengfei and Ma, Jiefeng and Du, Jun and Zhang, Jianshu and Yin, Baocai and Yin, Bing and Liu, Cong},
  journal={Pattern Recognition},
  year={2024},
  publisher={Elsevier},
  doi={10.1016/j.patcog.2024.110490}
}
```


