feat(domain): geometry, annotation and sample model - #4
Merged
Conversation
The contract between renderers and exporters. Immutable, pixel-free objects that can be built, reordered and serialised without touching an image. - geometry.py: BBox (ordering-normalised, with union/intersection/IoU/clip/ normalise) and Polygon for rotated or warped regions. - annotations.py: Page -> Region -> Line -> Word plus Table/TableCell. Regions are typed with layout categories used by document-layout benchmarks, carry an explicit reading order, and serialise the page back to HTML or Markdown - the supervision format document-to-markup models are trained against. Tables additionally emit OTSL for table-structure models. - sample.py: Sample = image + Page + Provenance, where provenance records the seed, font, background, renderer, shaper and degradations so any single sample can be explained and regenerated. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
3 of 9 in the v1.0.0 series. Base:
feat/arabic-shaping.What
The contract between the renderers that produce pixels and the writers that serialise them. Immutable, pixel-free objects that can be built, reordered and serialised without touching an image.
geometry.py—BBox(ordering-normalised, with union / intersection / IoU / clip / normalise / pad) andPolygonfor rotated or warped regions.annotations.py—Page → Region → Line → Word, plusTable/TableCell.Page.to_html()/Page.to_markdown()— the supervision format document-to-markup models are trained against.Table.to_otsl()— the tag sequence table-structure transformers consume, alongside HTML for TEDS scoring.sample.py—Sample= image +Page+Provenance. Provenance records seed, font, background, renderer, shaper and every degradation, so a failure mode found months later can be traced to the setting that produced it.Why it matters
The v0 pipeline returned
(image, text, bbox, metadata). One box per page supervises nothing but a whole-page classifier. This is what makes word-level detection, layout analysis and table structure possible from the same render.Verified
176 tests green (70 new).