Skip to content

[RNE Rewrite] feat: Add OCR implementation - #1322

Draft
benITo47 wants to merge 13 commits into
rne-rewritefrom
ocr_dynamic
Draft

[RNE Rewrite] feat: Add OCR implementation #1322
benITo47 wants to merge 13 commits into
rne-rewritefrom
ocr_dynamic

Conversation

@benITo47

Copy link
Copy Markdown
Contributor

Description

Adds a unified, OCR and document understanding pipeline to react-native-executorch. Two OCRs - EasyOCR and PP-OCRv6, plus a higher-level document pipeline that orchestrates orientation correction, UVDoc dewarp, PP-DocLayoutV3 region layout, SLANet table-structure recognition, and reading-order assembly into HTML.

Introduces a breaking change?

  • Yes
  • No

Type of change

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Documentation update (improves or adds clarity to existing documentation)
  • Other (chores, tests, code style improvements etc.)

Tested on

  • iOS
  • Android

Testing instructions

Try OCRing on different images, use different OCR options. See if anything is ill behaved.

Screenshots

Related issues

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings

Additional notes

benITo47 added 12 commits July 20, 2026 19:17
…OcrOptions.tables)

Tables were the odd one out — orientation/dewarp had per-run toggles, tables
fired unconditionally when a table region was found. Add RunOcrOptions.tables
(default true when the model supports them; a per-run false skips the
recognizer), gate the table pass on it, and surface a Table-structure sub-toggle
in the demo alongside orientation/dewarp.
…ailing | _ glyphs)

Flat-gray strip padding left a content→pad seam EasyOCR's CRNN read as a
trailing glyph. Add OcrModelOptions.recognizerPadMode ('constant' default,
'cornerMean' = background-matched), thread it through the recognizer, default
EasyOCR to cornerMean. Not a decode bug — the argmax was predicting the seam.
…f composed strip

Composing a vertical stack into one horizontal strip fed the recognizer a
non-word column with its horizontal-word context, making it hallucinate words
(and the vertical-digit phantoms). Recognize each glyph on its own and join
top-to-bottom — drops the word bias, gives per-glyph confidence. Cost: one
recognizer pass per glyph (fine for the opt-in vertical path).
Vertical reads skip the horizontal drop-score gate because they run
lower-confidence. Expose RunOcrOptions.verticalMinConfidence so callers can
raise it to filter the low-confidence hallucinations the vertical path emits.
@benITo47 benITo47 changed the title Ocr dynamic [RNE Rewrite] feat: Add OCR implementation Jul 20, 2026
Hardens the pipeline — encodeConstraint variant handling, snapUpDim lattice clamp, span-aware table fill, tagged shape-constraint union, dead compose-mode removal, JSI length guards and demo polish. Also pins the document pipeline to the now-published 0.9.0 model tag.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature PRs that implement a new feature refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RNE Rewrite] CV - add OCR pipeline implementation

2 participants