object-detection · document AI · WASM · 30.3 MB
Finding where a table sits on a page (Table Transformer Detection) is only half the job. Table Transformer Structure Recognition v1.1-all (Microsoft, trained jointly on PubTables-1M and FinTabNet.c) looks inside a table image and predicts its exact structural geometry — rows, columns, column headers, projected row headers, and spanning cells — in a single DETR object-detection pass on your device.
| Model | Xenova/table-transformer-structure-recognition-v1.1-all (ONNX export of microsoft/table-transformer-structure-recognition-v1.1-all) |
|---|---|
| Task / pipeline | object-detection — cropped table image → structural bounding boxes + scores |
| Architecture | TableTransformerForObjectDetection — ResNet-18 backbone + 6-layer encoder / 6-layer decoder pre-norm DETR (d_model: 256, 8 heads, 125 object queries; longest edge resized to 800 px) |
| Classes (6) | table, table column, table row, table column header, table projected row header, table spanning cell |
| Training data | Aligned PubTables-1M + FinTabNet.c (v1.1-all — stronger on financial statements, borderless tables, and multi-row headers than v1.0) |
| Quantization | q8 (8-bit ONNX, onnx/model_quantized.onnx) |
| Backend | WebAssembly (WASM) — runs on every modern desktop & mobile browser; no WebGPU required |
| Download | 30.3 MB (28.8 MiB, q8 ONNX + configs) — cached in browser storage after first download |
| License | MIT (Microsoft Table Transformer) |
| Web APIs | WebAssembly, Web Workers, Canvas 2D, FileReader, Cache Storage — Baseline widely available |
Choose a procedurally rendered sample table below or drop your own screenshot/scan of a table, then run
structure recognition. Inference runs off the main thread in a Web Worker at a 0.25 floor so
dragging the score threshold slider or toggling layers updates immediately without re-running the model.
Run structure recognition, then click any cell in the reconstructed grid to highlight its exact pixel region on the canvas.
Reconstructed logical grid (derived from row × column intersections, headers, and spanning cells):
Waiting for a real structure pass…
Table Transformer does not trace pixel grid lines or run OCR. Its decoder emits 125 learned object
queries in parallel; each query predicts one of the 6 structural classes (or no-object)
and a bounding box in image pixel coordinates. Below is the exact raw output from your run — every query
that cleared the 0.25 floor, sorted by confidence, alongside per-class query counts.
| # | Class | Confidence | xmin | ymin | width × height |
|---|
Optical character recognition reads words, not tables: feed an invoice or earnings report to plain OCR and
columns collapse into a flat stream of disconnected numbers. Microsoft's v1.1-all structure
model solves the geometry half directly in the browser — 30.3 MB cached once, zero server upload, and
trained across both scientific articles (PubTables-1M) and borderless financial filings (FinTabNet.c).
<thead>, <th>, colspan, and rowspan markup from screenshots for screen readers.Inspect all 6 structural classes with color-coded bands, live threshold slider, class soloing, and per-class confidence stats.
Compute exact cell bounding boxes, inspect zoomed OCR-ready cell crops, and export structured JSON, HTML <table>, or CSV coordinates.
Sketch a grid or schedule freehand on a whiteboard canvas and watch Table Transformer turn your drawing into a live editable HTML table.
Stage 1 locates tables on a full document page (table-transformer-detection) → crops → Stage 2 parses exact rows, columns & headers with v1.1-all.
Because Table Transformer formulates structure recognition as standard object-detection, the
Transformers.js API is one pipeline call returning pixel-space bounding boxes:
import { pipeline } from "@huggingface/transformers";
const recognise = await pipeline(
"object-detection",
"Xenova/table-transformer-structure-recognition-v1.1-all",
{ device: "wasm", dtype: "q8" },
);
const parts = await recognise(tableCropDataURL, {
threshold: 0.25,
percentage: false,
});
// → [
// { label: "table", score: 0.999, box: { xmin, ymin, xmax, ymax } },
// { label: "table column", score: 0.998, box: { ... } },
// { label: "table row", score: 0.996, box: { ... } },
// { label: "table column header", score: 0.994, box: { ... } },
// ...
// ]
To reconstruct cells, sort table row boxes by ymin, sort table column
boxes by xmin, intersect each row × column band, and tag header or merged regions using
table column header, table projected row header, and table spanning cell.