Repository navigation
fix(ocr): long text lines lost most characters (#3) - #4
Merged
Merged
Conversation
…ters (#3) Recognition capped every line's input width at 320 (aspect < 7); a 30–40 character line got crushed to ~8px per glyph. PaddleOCR sizes width by aspect ratio — raise the cap to 3200 and sort crops by width before batching (as Paddle does) to keep padding small. Reproduced with the issue's screenshot: output now matches PaddleOCR line for line. OCR_PIPELINE_VERSION → v5-wide so existing libraries re-OCR automatically. Demo library: 17/20 images identical, 3 differ by a character or two.
Merged
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.
Fixes the OCR part of #3: on text-heavy screenshots, long lines came back with most characters missing.
Cause — recognition capped each text line's input width at 320 px (height 48 → aspect ratio < 7). A line of 30–40 CJK characters was squeezed to ~8 px per glyph and the model dropped most of it. PaddleOCR sizes the width from each line's aspect ratio, which is why the reporter's local PaddleOCR read the same image fully.
Fix
REC_MAX_WIDTH320 → 3200 (aspect ≈ 66; a single 3×48×3200 crop is ~1.8 MB).OCR_PIPELINE_VERSION→v5-wide: existing libraries re-run OCR automatically after updating.Verified
,清,,低在,很到动,).HOP DELUSION,white code). OCR-dependent eval queries (dost,OLD SACRAMENTO) still match.npm testpassed, typecheck clean.