Repository navigation
feat(easyocr): stretch a faint page to full contrast before detection - #112
Merged
Merged
Conversation
Brief 023, issue #110. A book photographed in grey can arrive with its ink sixty or seventy levels below the paper; the detector then breaks words apart and drops letters, and no recogniser behind it can put them back. imaging.lift_faint_ink stretches a page whose darkest thousandth of pixels, over its central three quarters, is lighter than grey level 45 and at least 30 below the paper, and leaves every other page alone. The rule keys on the ink, not the paper: a register of black ink on toned paper lost a little word recall to the same stretch. Both EasyOCR backends and the span-cache tool now take the page through imaging.detector_input, which returns the file's own path for an ordinary page, so it reaches the detector exactly as before. Co-authored-by: Yvette Mankerian <yvettekm@gmail.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The rule fires on three of the seventeen registers and the table moves only there: Abovyan 0.794 to 0.835 word recall, the encyclopedia up a little on both measures, the medical encyclopedia up 0.005 on word recall and down 0.007 on character similarity. The other fourteen rows are unchanged to the last digit, read from the same cached spans. The engines page describes the step and what it costs. Co-authored-by: Yvette Mankerian <yvettekm@gmail.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Deploying tetrak with
|
| Latest commit: |
44d84aa
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f07a6550.tetrak.pages.dev |
| Branch Preview URL: | https://feat-lift-faint-ink.tetrak.pages.dev |
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.
Closes #110 (brief 023, Stage 1).
What
imaging.lift_faint_ink: a page whose darkest thousandth of pixels, over its central three quarters, is lighter than grey level 45 and at least 30 below the paper is stretched withImageOps.autocontrast(cutoff=1). Any other page is left alone.imaging.detector_input: what an EasyOCR reader is handed. The file's own path for an ordinary page, exactly as before; PNG bytes for a TIFF (as before) and for a faint page.easyocr,easyocr-hyandtools/dump_layout_spans.pyall go through it, so the span cache reads a page as the shipped backend does.evaluation/ocr/registers.csvre-emitted; the engines page describes the step.Why
A book photographed in grey reaches the detector with its ink sixty or seventy levels below the paper. The detector breaks words apart and drops letters, and no recogniser behind it can put them back. Abovyan vol. 1 is such a scan, and the register
easyocr-hyloses tohye-paddleby most. The measurements behind the rule are in #109.Measured
Read in the environment the published table was read in (see #111), the rule fires on three registers and nothing else moves:
The other fourteen rows are unchanged to the last digit. Baronian's Azgayin jojer, black ink on toned paper and the one set a blanket stretch hurt, is not stretched and reads identically, span for span. Mshak (not in the table) goes from 0.804 to 0.814.
Not a clean win everywhere: the medical encyclopedia trades 0.007 of character similarity for 0.005 of word recall. Abovyan is still 0.075 behind
hye-paddle; this is the scan's share of that gap, not all of it.Checked
ocrmacand are skipped here, as on main). New tests pin which drawn pages are faint: black on white, toned paper with black ink, a sparse title page and a blank grey leaf are all left alone, and a dark binding at the edge does not pass for ink.Follow-up
The model card's pipeline column quotes the same three registers and will want the new figures once this is released.
🤖 Generated with Claude Code