r/computervision • • Oct 06 '26

Help: Project Document grounding using PDF geometry, OCR and visual evidence — 72.6% Word F1

I've been working on document grounding where the goal is to map extracted values back to their exact locations in a PDF.

The interesting constraint is that the grounding layer works from the document itself:

  • PDF character coordinates
  • OCR
  • spatial geometry
  • string/format matching
  • table assignment
  • page-level visual evidence

Current benchmark result:

72.6179% Word Grounding F1

I'm particularly interested in the remaining failures.

Some are straightforward localization problems. Others appear to come from annotation conventions, dense layouts and cases where geometric similarity isn't enough.

I'm the author and would like feedback from people working on document vision/localization.

GitHub

1 Upvotes

6 comments sorted by

1

u/liltingly Oct 09 '26

PDF char boxes will have ascenders/descenders etc that differ from tight and somewhat uniform OCR crops. Same with word boxes which then are looser than char boxes in some libs. Especially what recognizers require (looking at you, PPv6). And some may be font dependent in the PDF layer. You’ll want to determine your standard location. 

1

u/vanraj_solanki Oct 10 '26

Exactly. PDF char boxes carry the full ascender/descender band; OCR crops to ink. Same word, two boxes, IoU collapses. What standard do you settle on glyph-tight, or line-band?

1

u/liltingly Oct 10 '26

Depends — who/what is the downstream consumer? A few options I’ve tried is to trim-to-ink on the pdf boxes with openCV. Can do 2 sides or 1 side. Other option is re-render the page in html or something else where you more exactly get the glyph or char box in a standardized way. Third way is to do 1:1 matching from PDF to OCR and either take OCR height and extent and some other edge or center. 

Of most importance is probably your F1 metric. Knowing that all of these techniques have their own problems — you’ll always have some misalignment or cook your data to be perfect — try and define a more comprehensive “good enough” metric and measure F1 on that. If it’s for machine reading, what’s sufficiently equivalent. For humans, same thing. 

For tiny char objects, IOU will bite you in the ass and can be very shape dependent. 

1

u/vanraj_solanki Oct 10 '26

This is genuinely useful, I been working on the same problem. If you ever want to discuss deeply on this happy to connect.

1

u/[deleted] Oct 06 '26

[removed] — view removed comment

1

u/vanraj_solanki Oct 06 '26

Yeah, dense tables are one of the harder cases I’ve been seeing too. PDF coordinates and OCR give you the raw evidence, but figuring out which text belongs to which cell/field can get messy when the layout is tight.