Commit afbb4c8
feat(tableformer): replicate docling's table-crop preprocessing (page→1024px→bbox→448)
The decode is byte-exact on docling's input tensor; the live pipeline must feed
the same pixels. docling resizes the whole page to 1024px height (cv2.INTER_AREA),
crops the table bbox out of that, then resizes the crop to 448² (bilinear). The
tf_otsl example now does the page→1024px (box-average) crop, and predict_otsl's
448 resize is bilinear, matching docling's two distinct interpolations.
This lands the correct method and confirms the crop geometry matches docling
(434×172px bbox at the same position on 2305v1-pg9). It does NOT yet reproduce
docling's OTSL live: the model is hyper-sensitive to exact pixels, and matching
docling's full raster pipeline byte-for-byte across different libraries (pdfium
render anti-aliasing, cv2 INTER_AREA, torchvision bilinear) is a separate, hard
parity problem — different filter choices swing the token count (54 target vs
88/121 observed). Recorded as the gating step in PDF_CONFORMANCE.md before
OTSL→grid, cell matching, and serialization.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 27b5230 commit afbb4c8
2 files changed
Lines changed: 16 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
34 | 39 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| |||
65 | 64 | | |
66 | 65 | | |
67 | 66 | | |
68 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| |||
0 commit comments